|★ APPLICATIONS ★ DIVERS ★ GRAPHICS OPERATING SYSTEM|8000Plus) ★|
|Graphics Operating System||Applications Divers|
GRAPHICS OPERATING SYSTEM
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.
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.
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.