The Sinclair ZX81 is one of the smallest (in terms of power) platforms supported by the Z88DK.
Starting from z88dk v1.8 the actual port has been greatly improved.
zcc +zx81 -lm81 -create-app program.c
To keep most of the code runnable it works in FAST mode by default; you might wish to try to run your program in SLOW mode, by using the “-startup=2” flag, but you do it at your risk: double check every application before delivering !
An alternate experimental math library exists. It can be activated with the “-lm81_tiny” flag, and help saving some space, but please note that the support for Floating Point and “long” types support is still under development, and might give unexpected results, even a program crash.
Programs cannot easily be run over the first 16K memory limit: the RAMTOP is not positioned automatically over it. There is also a further problem when running in HRG mode, a special character vector declared in the startup code need to be kept in that limit too.
Z88DK is now capable of running in graphics mode with a small hardware modification to the memory expansion, known as the Wilf Rigter’s WRX mode. There are many ways to modify your memory circuitry to make the High Resolution work; here is a link to the original article, explaining (at the end) how to do it easily with the original 16K RAMPACK expansion.
The High Resolution can be activated by passing a value greater than 2 to the “startup” parameter, in example:
zcc +zx81ansi -lm81 -startup=4 -lgfx81hr192 -create-app program.c
..will enable the 256×192 graphics (with immediate return to text mode on exit), the ANSI VT emulation and the corresponding graphics library.
See also the HRG section of the ZX81 library description page.
Depending on the selected mode the “gfx81hr192” or the “gfx81hr64” graphics library can be used in place of the standard “gfx81” one. If you desire to keep the standard text handling, you can use the “copytxt” function to mix the text with graphics.
Depending on the display mode specified (and thus the interrupt handler routine being activated) the ZX81 speed varies. The “bogomips” tool gives the following results, it is supposed the ZX81 in fast mode runs as fast as the ZX Spectrum:
| ZX81 SLOW mode | (startup=2) | 600 |
| ZX81 FAST mode | (startup=1) | Can’t compute |
| ZX81 HRG192 | (startup=3 or 4) | 1200 |
| ZX81 HRG64 | (startup=5 or 6) | 4050 |
| ZX Spectrum | (keeping a key pressed) | 7700 |
| ZX Spectrum | (no key pressed) | 7850 |
In High Resolution mode it is possible to have a full featured VT/ANSI emulator, with extra ASCII characters and visual attributes. When the 256×192 mode is used it can have exactly the same resolution as the ZX Spectrum (with the exception of the colors).
WARNING: THIS SECTION IS FOR EXPERT USERS ONLY
Before making the library, set the ZXCOLS environment variable. Valid presets are:
24, 28, 32, 36, 40, 42, 51, 64, 80, 85, 128, ROM24, ROM28, ROM32 and ROM36.
When possible the library will be built with a “packed” font to save memory. If you need to save further space, you can choose the ROMxx options: they are all based on the standard ROM font (note that no undercase letters will be displayed in that case: a converter will re-map the missing symbols).