Compatibility

This range of cartridges works on the following PCBs and with the following models of Spectrum:

PCB16K48K/+128/+2
Latest ROM Version: 3.10
File Transfer Version: 1.06
PROM Size: 16K - 32K (depending on build)
Click here to jump to the downloads section.



Description

This 16K ROM cartridge can only be used with a ZX Spectrum 128 and makes it run as a ZX81. The cartridge contains a modified ZX81 ROM which means that the ZX Spectrum 128 is actually running as a ZX81, not just emulating one. It is possible to load ZX81 games directly from cassette and the vast majority of titles will run successfully (including many high resolution games). The emulator is included with permission on the ZX Spectrum Next (issue 1).

The cartridge works by taking the standard ZX81 ROM and patching the display, cassette and printer routines. The patches reside in the 8192 - 16383 memory area which is not available on a standard ZX81 system. The ZX81 expects the 16K memory area 16384 - 32767 to be available for its display file, system variables and program area but the 16K/48K Spectrum has its display file fixed at 16384 and so this would clash. However, the Spectrum 128 supports two display files - the usual one at 16384 and a second one that can be paged in at 49152. The cartridge therefore uses the second display file thus leaving the 16384 - 32767 memory area free for the ZX81 ROM to use.

The ZX81 produces its display using a combination of software and hardware. The Spectrum 128 cannot utilise the ZX81 video driver ROM routines as it does not have the hardware capability required. Instead it must periodically examine the ZX81 display file and produce an equivalent output in the Spectrum's display file. Maskable interrupts are employed to do this, although it takes several interrupts to copy the entire ZX81 display. The ROM cartridge also correctly mimics the collapsed display file found on a ZX81 with less than 4K of memory.

High resolution ZX81 games utilise a separate display file from the normal one and this must also be copied by the interrupt routine when it is being shown. This is trapped by examining the IX register which is usually changed to point to the hi-res display driver. It is then necessary for the software to examine the display driver routine in order to determine the location of the high resolution display file. A variety of display drivers exist and so all popular configurations are checked for, including drivers for pseudo hi-res, mixed hi-res/lo-res and true hi-res. Since each variation must be explicitly looked for, there is the possibility that not all high resolution programs will work. Please report any high or low resolution programs that do not run correctly on the emulator. Click here to view the list of known incompatible ZX81 programs.

The cassette routines correctly mimic the speed of the original routines and so programs can be directly saved from and loaded into the Spectrum 128. The border colour is toggled between white and black and simulates (as best as possible) how the real ZX81 display would appear. When loading ZX81 programs, the volume control typically needs to be lower than it would for Spectrum tapes and should cause the display to show white and black bars of equal height.

Fast and slow mode are simulated by setting the Spectrum 128's attributes and border to black when in Fast mode. During this time the Spectrum 128's display file is not updated and hence the ZX81 program runs faster just as it would do on the real machine.

The ZX Printer routines are also patched to make them fully functional. Maskable interrupts are simply disabled whilst printing is occurring so that correct timing is achieved.

There are two versions of the ZX81 ROM cartridge: one emulating a ZX81 with edition 1 ROM and another emulating a ZX81 with edition 2 ROM. The edition 1 ROM suffered from a serious floating point bug which caused PRINT SQR 0.25 to be calculated incorrectly as 1.3591409. It was also necessary to follow every PAUSE command with a POKE to the FRAMES system variable otherwise the computer might crash. See Stephen Agate's website for details of the differences between the two ROM editions.

At start up, a Spectrum 128 style menu allows selection of the memory configuration and also provides a tape loader option. The memory configuration options are 1K, 4K, 16K and 32K, with 32K being the maximum RAM supported by the ROM cartridge. The tape loader option defaults to a 16K configuration and provides a quick method to load a program from cassette. The cursor keys are used to move through the menu options and ENTER is used to select the highlighted option. The RAM menu for both edition 1 ROM and edition 2 ROM ZX81 emulators is shown below:


ZX81 Edition 1 ROM Cartridge Memory Configuration Menu ZX81 Edition 2 ROM Cartridge Memory Configuration Menu

Other memory configurations can be selected from BASIC by poking RAMTOP and then executing NEW.

To simplify using the emulator on a Spectrum 128, the ZX81 keyboard layout is remapped to match as closely as possible the layout on the Spectrum 128. Most ZX81 keywords are already in a similar position to those on the Spectrum 128 and so it is mainly the symbols and graphic characters that have been moved. I've produced a diagram showing the mapping of the ZX81 keys on the Spectrum 128 keyboard to help identify where these characters have moved to. It is possible to revert to the true ZX81 keyboard mapping by typing PRINT USR 8255. The remapped keyboard layout can be switched back to by typing PRINT USR 8252. The default key mapping is determined by bit 0 of the byte at 2042h (8258d), and so this bit can be set as desired before programming the emulator image into an EPROM. If the bit is reset to 0 then the remapped Spectrum 128 keyboard layout is used; if set to 1 then the true ZX81 keyboard layout is used.

In addition to loading/saving programs via cassette, it is also possible to load and save via a serial link, e.g. to load/save programs from/to a PC. When a LOAD or SAVE command is executed, other Spectrum 128 style menus are displayed. These menus provide options to load/save from cassette, the Spectrum 128's RS232 socket, the Spectrum 128's Keypad socket and the ZX Interface 1's RS232 socket. The LOAD and SAVE menus are shown below:


ZX81 ROM Cartridge Load Menu ZX81 ROM Cartridge Save Menu

The ZX81 program filename is always included when loading and saving, irrespective of whether using cassette or a serial link. When a serial connection is used, a single byte is initially transmitted to indicate the type of transfer required. This allows the system at the other end of the serial link to automatically determine the actions to perform, e.g. to deliver the specified program or store the incoming bytes. This single prefixed byte has the value of 20h when save is requested, a value of 0Ah when loading a specified named program (e.g. LOAD "name"), and a value of 02h when loading the next available program (e.g. LOAD "").

Printer output can be directed to the ZX Printer or to the Spectrum 128's RS232 socket, the Spectrum 128's Keypad socket or the ZX Interface 1's RS232 socket. The PRINTER menu is shown below:

ZX81 ROM Cartridge Printer Menu

When outputting to a serial connection, the data is sent as a bitmap in Epson format and hence is suitable for direct connection to a compatible serial printer. The data is transmitted one row at a time, with the following EPSON codes used for each row: 7/72 inch line spacing (1Bh 31h), double-density 8-bit graphics (1Bh 4Ch 00h 01h).

Once an option has been selected from the LOAD, SAVE or PRINTER menus, this becomes the default option for that action until a reset or NEW occurs. However, it is possible to re-select the menus by typing PRINT USR 8240, PRINT USR 8243 and PRINT USR 8246 for the LOAD, SAVE and PRINTER menus respectively. Alternatively, the default options can be altered by poking the following memory locations:

FunctionAddress01234
Printer65533MenuZX PrinterZX Interface 1128 RS232128 Keypad
Load65534MenuCassetteZX Interface 1128 RS232128 Keypad
Save65535MenuCassetteZX Interface 1128 RS232128 Keypad

Loading, saving and printer output via a serial connection occurs at 9600 baud with 8 data bits, no parity and 2 stop bits. This allows 16K to be transferred in approximately 20 seconds. Note that the IF1 RS232 option should not be selected unless a ZX Interface 1 is connected otherwise it is likely that the Spectrum 128 will crash. Ideally this option should only be shown when a ZX Interface 1 is connected but it is not actually possible to detect if this is the case. The lead wiring required to a PC is identical to that shown for the Spectrum RS232 ROM cartridge.

I've produced a Windows application to allow ZX81 programs to be loaded and saved over a serial link. It also allows the capturing of printer output. This program supports the .P and .81 emulator formats as well as a new .P81 format. This new format differs by including the ZX81 program name before the program bytes, as is done in cassette recordings, and hence it allows more accurate archiving of ZX81 programs. Also, unlike the .P format, the .P81 format does not include any surplus bytes at the end of the ZX81 program bytes. The application will ignore such surplus bytes and indicates if these exist by showing the real program length as well as the file length.

ZX-Transfer Utility Screenshot

The application acts as a server for delivering or storing ZX81 programs as and when requested by the 'ZX81' ROM cartridge. The Program Details area shows information about the file requested for loading or saving - its filename, the file path on the PC to save to or load from, and the file's size. It also shows the real length of the ZX81 program (the .P emulator format often has surplus bytes appended at the end), and the range of memory addresses that the program occupies. The Program Info area shows the bytes of the ZX81 program name and then the system variables. The Reset button allows a transfer to be aborted. From the View menu, the File Options and Printer Output windows can be shown.

ZX-Transfer Utility - Printer Output Screenshot ZX-Transfer Utility - File Selection Screenshot

The Printer Output window shows all data received from LPRINT, LLIST and COPY commands. The Feed button performs a line feed by including one row of blank output, the Clear button discards all captured output, and the 'Save' button stores all captured output as a bitmap to a specified folder.
The File Options window allows the selection of the folder on the PC where ZX81 programs should be loaded from and save to, and lists all ZX81 files found in the selected folder. The Formats drop down lists allow the default file formats to be selected. The application supports both the 'ZX81' ROM cartridge and the 'ZX80' ROM cartridge (described below). When the PC File Path option is checked, the application allows ZX81 filenames to contain a PC file path. For example, specifying to load the ZX81 program 'E:/ZX81/Programs/Mazogs.p' will cause the file Mazogs.p to be loaded from E:\ZX81\Programs. Relative file paths can also be specified, e.g. '../Mazogs.p" will load from the parent folder. If a file path is specified without a filename then the application will compose a list of all ZX81 programs within the chosen folder and will generate a program that allows selection of a file from this list. The file to load is selected using the cursor keys or by pressing the first letter of the required program, e.g. pressing the S key will show all files beginning with the letter S. Pressing NEWLINE then loads the selected program. A screenshot of the file loader program is shown below.

ZX File Transfer Utility - Menu Screenshot

To simplify the process of converting programs between cassette and PC format I have incorporated a menu within the ROM to perform such transfers. It is invoked either by holding down the BREAK key when resetting the Spectrum 128 or by typing PRINT USR 8249.

ZX81 ROM Cartridge Transfer Menu

The ROM cartridge image can also be used with an emulator. This is acheived by selecting to emulate a spectrum 128 and pointing it to the 'ZX81' ROM instead of the Spectrum 128 ROM. To load a .P file into an emulator, perform the following:

Since program names are included at the start of the .P81 files, they can not be loaded into an emulator using the method above. It is therefore necessary to convert .P81 files to .P files and this can be done using the ZX File Converter.

I've also produced a version of the cartridge that fixes the bugs in the ZX81 ROM, which I have named ZX81+. There is a bug in the division routine which causes PRINT 1/2=0.5 and PRINT INT(0.5+0.5) to both give the incorrect answer of 0. There is another bug which causes LPRINT .00001 to be printed as .0XYZ1. See Geoff Wearmouth's website for full details of these bugs and their fixes.

Bug Free ZX81 ROM Cartridge Memory Configuration Menu

Quicksilva produced the QS Character Board peripheral for the ZX81 which allowed the character set to be replaced by a version held in an on-board RAM visible at locations 8400h to 87FFh, and they subsequently included support for the board in their games QS Invaders and QS Scramble. Both of these games will not run properly on the standard ZX81 emulator (see the list of incompatible ZX81 programs for an explanation of why not) and so I have produced a version of the emulator (based on the edition 2 ROM) that mimics the QS Character Board and adds support for the Quicksilva games. To run these games correctly, it is necessary for the emulator to identify them when they are loaded and then modify them so that they work with the Spectrum 128 hardware. As a result, archive copies of these programs should not be created using this version of the emulator (unless done so via the Transfer Menu) since they would not operate correctly on a real ZX81 or on a PC based ZX81 emulator. Supporting the QS Character Board results in a very slight degradation in overall speed of the emulator, which affects standard lo-res and hi-res games and not just the Quicksilva games.

QS Character Board ZX81 ROM Cartridge Memory Configuration Menu

dk'tronics produced a 4K Graphics ROM kit for the ZX81 which provided seven alternate character sets, and they subsequently included support for the board in their games Asteroids, Centipede, Defender, Invaders and Meteor Storm. The Graphics ROM was located at addresses 2000h to 2FFFh and included routines to select the different character sets. These routines simply changed the value held in the I register such that the ZX81 video hardware accessed a character set within the Graphics ROM instead of the character set within the Sinclair ROM. I've produced a version of the ZX81 emulator, based on the Edition 2 ROM, which supports the dk'tronics Graphics ROM. This version of the emulator utilises the paging abilities of the ZXC2 / ZXC3 / ZXC4 PCB and requires at least a 32K ROM.

dk'tronics Graphics Board ZX81 ROM Cartridge Memory Configuration Menu

The character sets are selected via USR 11904, USR 11909, USR 11914, USR 11919, USR 11924, USR 11929 and USR 11934, which sets the I register to 20h, 22h, 24h, 26h, 28h, 2Ah and 2Ch respectively. The Sinclair character set is re-selected via USR 11939, which sets the I register back to 1Eh.

Kayde produced a variation of the dk'tronics 4K Graphics ROM kit which differed in only one of the character sets, and they subsequently included support for the board in their games Peckmen, Centipede, and Space Invaders. I've produced a version of the ZX81 emulator, based on the Edition 2 ROM, which supports the Kayde Graphics ROM. This version of the emulator utilises the paging abilities of the ZXC2 / ZXC3 / ZXC4 PCB and requires at least a 32K ROM.

Kayde Graphics Board ZX81 ROM Cartridge Memory Configuration Menu

Timex licensed the rights to the ZX81 to sell in the USA, rebranding it the TS1000. They followed it with the TS1500, which was essentially a ZX81 in a Spectrum style case with 16K built in. Some changes were also made to the ROM. The initialisation routine now assumed 16K was fitted rather trying to detect the quantity, and this was followed by a test to see if an additional ROM was present in the region 2000h to 3FFFh due to the connection of a TS1510 ROM cartridge and to execute it if so. The two bugs in the ZX81 ROM in the division and LPRINT routines were also fixed. See Wilf Rigter's website for details on the ROM differences between the ZX81 and TS1500. Since the TV system in the USA refreshes at 60Hz instead of 50Hz as in the UK, more CPU time is spent by the TS1000/TS1500 in generating the TV display than a ZX81, and as a result it runs programs slower.

TS1500 ROM Cartridge Memory Configuration Menu


Downloads

Click here to download the ZX81 Edition 1 ROM cartridge. 16K
Click here to download the ZX81 Edition 2 ROM cartridge. 16K
Click here to download the ZX81 Bug Free ROM cartridge. 16K
Click here to download the ZX81 Edition 2 (QS Character Board) ROM cartridge. 16K
Click here to download the ZX81 Edition 2 (dk'tronics Graphics Board) ROM cartridge. 32K
Click here to download the ZX81 Edition 2 (Kayde Graphics Board) ROM cartridge. 32K
Click here to download the TS1500 ROM cartridge. 16K
Click here to download the ZX File Transfer utility.
Click here to download the ZX File Converter utility.
Click here to view the list of known incompatible ZX81 programs.

I've produced a diagram showing the mapping of the ZX81 keys on the Spectrum 128 keyboard to help identify where these characters have moved to.

Click here to download the Spectrum 128 ZX81 Emulator Keyboard Layout.