Amstrad GSX drivers
Amstrad PCW and CPC implementations of CP/M include GSX drivers for the computers' respective screens. This page compares the various drivers' features and internal implementation.
CPC drivers: DDMODE0, DDMODE1, DDMODE2
The three drivers on the CPC6128 CP/M disc are very similar, differing only in two or three places. A number of GSX features aren't implemented:
- Line drawing: There is a single fixed line width.
- Marker drawing: There is a single fixed marker size.
- Text output: There is a single font at a single size. Text rotation is not supported.
- Area fill / filled rectangle: Draws outlines only.
- No input capability (mouse/tablet).
- No cell array capability.
CPC mode 0, showing 'filled' rectangles.
CPC mode 1, showing 'filled' star shapes.
CPC mode 2, showing 'filled' star shapes.
Internally, the drivers implement GSX operations using CPC firmware calls. So, for example, to draw a line, the driver will call GRA SET LMASK to set the pattern, then GRA MOVE ABSOLUTE followed by GRA LINE ABSOLUTE to draw the line.
CPC driver version 4: DDMODE2
DR Graph included an enhanced driver for CPC Mode 2. This includes the
CPC6128 GIOS #4 at offset 0102h, suggesting it is version
4 of the driver.
The only additional feature of this driver is support for a pointing device (mouse or tablet).
Mouse/tablet is implemented using the following BDOS calls, which must be implemented by an RSX already present in the system:
Detect tablet: Call 0005h with: C = 3Ch DE = address of RSXPB: defb 1,1 ;Function 1, one parameter defw 1 ;On return, will be set to 0 if driver ;initialisation failed. Read tablet: Call 0005h with: C = 3Ch DE = address of RSXPB: defb 2,3 ;Function 2, 3 parameters defw loc ;GSX device number minus 1 (1 for first mouse, ;2 for second mouse, etc.) defw x ;Current X-coordinate defw y ;Current Y-coordinate The top 3 words of the stack are: return address X-coordinate Y-coordinate On return, A should be 0 for if the button was clicked, 0FFh if it was not. As far as I can see, the new position is returned by updating the copies of the coordinates on the stack, rather than the values in the RSXPB.
CPC drivers version 5: DDMODE1, DDMODE2
DR Draw v1.0.1 included later versions of the CPC Mode 1 and Mode 2
drivers. They include the text
CPC6128 GIOS #5 at offset 0102h,
suggesting that they are version 5 of the driver.
These include support for filled areas:
CPC mode 1, showing filled rectangles.
CPC mode 2, showing shaded rectangles.
DR Draw does not include an updated Mode 0 driver, but once I had compiling source for the other two it was trivial to produce one. Since this is a derivative work of the existing drivers, it's under Locomotive's copyright and I can't distribute it.
CPC mode 0, showing filled rectangles.
PCW8256 driver: DDSCREEN
DDSCREEN, supplied with the PCW8256, takes the same sort of approach to the CPC -> PCW transition as the CP/M system file. The driver is clearly divided into two sections: the first half corresponding more or less to the CPC driver, and the second half providing the PCW-specific drawing code to replace the CPC firmware.
One quirk of the PCW implementation is that the screen size isn't fixed; it uses whatever window is reported by the TE ASK system call, and (thanks to GSX scaling) all output will be restricted to that window.
The list of features implemented by the driver is pretty much the same as the original CPC Mode 2 driver.
PCW driver, showing 'filled' star shapes.
PCW driver version 8: DDSCREEN
Digital Research supplied an enhanced version of the PCW driver with all known versions of DR Draw and DR Graph, and this was the version shipped with CP/M for the PCW9512 and later PCWs.
The enhanced driver contains the string
PCW8256 GIOS #8 at
Additional features in the enhanced driver match those in the version 5 drivers for the CPC:
- Filled areas are actually filled.
- Mouse/tablet support.
While testing, I was able to provoke a few crashes by passing what seemed, to me, to be perfectly reasonable parameters to the 'fill rectangle' call. Either these were caused by bugs in my programming, or there isn't sufficient parameter validation on this call.
The version numbering suggests there may have been a version 4 driver for the PCW, which had mouse support but no filled areas.
PCW driver, showing filled rectangles that are actually filled.
Electric Studio Light Pen: DDESP
DDESP.PRL is supplied with the Electric Studio lightpen for the PCW. Rather than use the pointing-device interface detailed above, DDESP acts as a wrapper for DDSCREEN.PRL. On startup it loads DDSCREEN.PRL (which must be present; it searches for it on drives M:, A: and B:). It then forwards nearly all GSX calls to DDSCREEN.PRL, with the exception of:
- Function 1 (v_opnwk)
- Sets the screen to dark ink on bright background (so the lightpen can track the electron beam).
- Loads and relocates DDSCREEN.PRL.
- Initialises the lightpen.
- Sets the DDSCREEN locator input mode to 2 (sample mode).
- Function 2 (v_clswk)
- Resets the screen to bright ink on dark background.
- Function 5, subfunction 16 (vq_tabstatus)
- Returns 1 (pointing device present).
- Function 28 (vrq_locator)
- Reads the light pen position (if a light pen is present) and simultaneously polls the DDSCREEN locator device (allowing cursor keys to be used).
- Function 33 (vsin_mode) for locator device
- Records new input mode, does not pass through to DDSCREEN.PRL.
No Spectrum +3 Driver
No GSX driver was provided for the Spectrum +3. I think it would have been reasonably straightforward to create a monochrome driver based on the PCW8256 codebase, replacing PCW-specific parts of the second module with Spectrum versions (once I had building source for the PCW version, it took me a couple of hours to get something that looked vaguely plausible on the +3). My guess is that this wasn't done because of disk space; adding GSX to the +3 CP/M distribution would have required a second floppy disk to be added to the package.
Prototype Spectrum driver. Since this is based on the PCW driver, it's under Locomotive's copyright and I can't distribute it.
JOYCE includes built-in GSX support based on the GEM VGA driver. This implements mouse support and filled areas, along with other facilities such as cell arrays.
JOYCE, showing filled star shapes.
John Elliott, 27 May 2016