Graphics Operating SystemApplications Divers
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 


From drawing straight lines to building mouse-driven menus, GOS gives programmers power over the PCW's screen

For some time now Mirrorsoft have been hard at work producing a desktop publishing package called Fleet Street Editor Plus, This sophisticated system will allow you to take wordprocessed text, mix it with graphics, and lay it all out in magazine style on your PCW screen before printing it. One of the problems facing programmers who try to write such systems is how to display everything on the PCW's screen, which after all was only ever intended to run LocoScript,

Mirrorsoft's programmers devised an elaborate library of subroutines to do all the hard work for them, and it is this library which is now being sold as the Graphics Operating System, a programmers' toolkit for the PCW.

Who needs GOS?

The Graphics Operating System (GOS to its friends) is unequivocally aimed at programmers. It is very simply a set of ready-written subroutines which allow you to draw shapes on the screen and manipulate them afterwards, and which can be called up from any point in your own program.

The GOS routines themselves are written in machine code, and can be accessed from almost any programming language - BASIC, Pascal and machine code are the three examples cited in the manual, but any language which allows you directly access the PCW's memory will do.

At first glance, GOS seems to be highly priced. Under the pressure of further glances, the price resolutely refuses to budge, and herein is a Mirrorsoft policy. The price effectively includes a Yun time licence', which means that should you write a program which uses GOS, you are free to sell your program together with the necessary GOS routines without fear of Mirrorsoft jumping on you for breach of copyright of their software.

However, it will only be a tiny minority of PCW owners who need this run time licence (ie. commercial programmers), and it seems to be an unusual practice to ask programming hobbyists to subsidise business users.

The power at your fingers

GOS provides an impressive range of graphics functions for your delectation. All the simple ones are there, like drawing lines and boxes, and at the other end of the scale GOS allows you to control a mouse and print LocoScript-style menus out on the screen, all with a few lines of program.

Here's a brief catalogue of its power: you can plot points, draw lines, boxes, circles and ellipses. You can fill enclosed areas with a pattern, and remove the fill if it goes wrong. You can move, copy, stretch, rotate, reflect and erase selected areas of the screen, and you can save and load screens to disc tor later use. You can put a menu up on the screen, find out where a mouse is currently pointing to, and restore the area that was beneath the menu when you have finished. Finally you can put text on the screen in a choice of five fonts, and control the line thicknesses as you draw.

The hows and wherefores of using all these routines are contained in a lengthy manual, which confirms GOS's programmers-only status. A demonstration program is supplied, showing off GOS's functions, and the manual lists the programming behind this in BASIC, Pascal and Z80 assembler. Readers are expected to learn how to use the routines by studying and adapting these listings, whereas a few more worked examples and explanations would have helped, The bulk of the manual is a reference section detailing all the individual routines, which is admirably clear and concise, once you have understood the basic modus operandi,

A few features spring to mind which are not available from GOS: you can't put standard PCW text on thescreen, but only one of the specialty designed fonts. GOS is not designed with animated graphics (games programming) in mind, so scrolling the screen and manipulating 'sprites' is not particularly efficient.

Operating the system

Since most PCW owners would be thinking of using Mallard BASIC to run GOS from, the examples chosen will be in BASIC. Don't forget that any computer language can be used to call GOS as long as it gives you direct access to the PCW's memory, ie, it has an equivalent of BASIC's PEEK, POKE and USR commands.

When you first run BASIC, you have to tell it that the GOS routines are available: you do this by the command (from CP/M's A> prompt) LINK BASIC, which links GOS into BASIC and drops you into the *Ok' prompt.

You will notice that with GOS loaded, you only have 17k of workspace left for your own programs, which is a drag. You have to have the whole set of GOS routines loaded, you can't just pick the few you might want to use.

GOS functions all have a code number, between 0 and 100 or so. Once you have set up the USR command as the manual tells you, you POKE the function number into a specific location, POKE the parameters for the command into the correct area of memory (eg, the coordinates for the drawing you want to do) and then run the function with a USR command.

The competition

On the lines of graphics utility programs, there are two existing competitors to GOS, In theory, you could also use the free GSX software which comes on your PCW discs, but in practice it is very hard to find any cheap documentation anywhere, and it's very hard to use anyway, CP Software's 'All about graphics and everything on the PCW' (thatfs a short version of the title!) works in almost exactly the same way as GOS -PEEKs and POKEs from languages like BASIC. All about, at £19.95, is aimed more towards the games programmer, with some impressive scrolling functions and sprite-handling functions. It doesn't cater for any mouse handling, nor does it provide GOS's area stretching functions. Real hackers will be pleased that CP actually give you the assembler source code for the routines, so you can modify and re-use it in your own code.

Secondly, there is ExBasic from Nabitchi, costing £11.45. This is actually a modification to BASIC's PRINT statement - it won't work with Pascal or anything else. There are no nasty PEEKs and POKEs to do, and it is aimed at the novice programmer rather than the expert programmer, ExBasic runs far more slowly that GOS or All about, and is not fast enough for you to write games with.

For example, clearing the screen is function number 82, and it doesn't need any data inputs to do its job. So, POKE the special byte (in fact address 49155) with 82. and give the command Z = USR(0) which catls the actual machine code routine. Z is a dummy variable that you don't care about.

More complex is the matter of actually drawing things on the screen. The PCW screen has 720 dots across it and 256 down. Unfortunately, this means you have to store the screen x-coordinate in two bytes, as a high/low pair. The /-coordinate can be contained in a single byte, but some GOS functions expect it as a high/low pair too (with the high byte being zero, of course), which can mean you doing 10 or more POKEs before you can call a function. Look at the example listing to see how BASIC and GOS together draw a box with clipped corners.

To programmers, one of the best things about GOS is the consistent design of the calling interface. Once you have understood a simple example or two, you can use just about any of GOS's features by looking at the reference manual. The most complex thing is understanding how the screen coordinate system works, and how to split a number greater than 255 into a high/low pair.

If anything goes wrong inside GOS - for example, you might have given an impossible set of coordinates to the routine - it returns an error code in a specific memory location so that your program could make some appropriate report to the user.

GOSh, wow?

Without doubt GOS provides a well designed set of graphics routines. With the exception of the 'fill' command, they are all quite fast, and the mouse and menu commands really give you the ability to write quite sophisticated interfaces into your own programs. The manual is slightly unfriendly, but since the package wilt only be used by expert programmers it contains quite enough information.

However, the ordinary drawing functions are covered quite adequately in both Ex Basic from Nabitchi and All abouc Graphics... from CP Software, at a fraction of the price. If you want to write your own mouse and menu operated art package, GOS is a powerful ally - if you want to draw circles, it looks to be a pricey option.


★ PUBLISHER: Mirrorsoft
★ YEAR: 1987
★ AUTHOR(S): ???
★ PRICE: £69.95


Je participe au site:
» Newfile(s) upload/Envoye de fichier(s)
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

» Applications » Arnor BCPL Programming Language
» Applications » Disc Miser (The Amstrad User)
» Applications » Disc Nurse (Amstrad Action)
» Applications » Chit-Chat
» Applications » Amstrad Action Daily Diary
» Applications » OAX


L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!

CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 806 millisecondes et consultée 479 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.