Compatibility

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

PCB16K48K/+128/+2
Latest ZXC1/2/3 ROM Version: 3.02
Latest ZXC4 ROM Version: 1.01
ZX Tape Player Utility Version: 2.4.0
PROM Size: 16K - 32K (depending on target PCB)
Click here to jump to the downloads section.


Description

This ROM cartridge patches the Spectrum's LOAD and SAVE routines to receive and send data via a RS232 serial port, thereby allowing programs to be loaded/saved directly from/to a PC. The ROM cartridge provides support for the Spectrum 128 RS232 socket, the Spectrum 128 KEYPAD socket, and the ZX Interface 1 RS232 socket. The load and save channels can be independently selected. RS232 communications occur at 57600 baud, thus allowing programs to be loaded and saved at a rapid speed.

The version for the ZXC2 and ZXC3 ROM cartridges consists of a patched copy of the Spectrum ROM, with the patches located in the spare locations at the end of the Spectrum ROM. The ROM cartridge is therefore 16K in size.

The version for the ZXC4 exploits the Cassette paging mechanism provided by the ZXC4 and so uses the Spectrum's internal ROM. The RS232 routines are therefore contained in a shadow ROM. This has the added benefit that the ROM cartridge can also be used with the Spectrum 128 in 128 BASIC mode. Note that the use of the ZXC4's Cassette paging mechanism means that the ROM cartridge must be located such that the Shadow ROM is within bank 3 of a bankset. The Cartridge Creator utility will automatically pad out the compilation as necessary to ensure this occurs.

When a LOAD, VERIFY, MERGE or SAVE command is executed, the ROM cartridge must determine the channel type to use. It does this by examining the contents of the unused system variable at location 23728 ($5CB0) when loading, verifying or merging, and by examining the unused system variable location 23729 ($5CB1) when saving. These are will hold channel identifiers, with supported values being 'C' for cassette, 'I' for Interface 1 RS232, 'R' for Spectrum 128 RS232, and 'K' for Spectrum 128 KEYPAD. Any other value will cause the ROM cartridge to prompt the user for the channel type by displaying a simple menu on the bottom row of the screen (when first powered on, these system variable locations will hold values of $00 and so a menu will be displayed by default).

Spectrum RS232 Load Menu Screenshot Spectrum RS232 Save Menu Screenshot

Press the highlighted key to select the corresponding channel, or BREAK to exit the menu. When a load or save command is subsequently encountered, the same channel will automatically be used. To switch to another channel, locations 23728 and 23729 can be POKEd with the new channel identifiers or with $00 to cause the corresponding menu to be displayed next time a load or save operation occurs.

Note that the ZX Interface 1 made use of the unused system variables at 23728 and 23729, storing the printer output line width and current print position. If a ZX Interface 1 is connected, then it will introduce its new system variables and initialise these two 'unused' system variables upon the first time an error occurs or one of its new commands is executed. This will result in location 23728 being set to 0 (the current print position) and location 23729 being set to 80 (the output line width). This means that the next time a load or save operation is encountered, the menu will be displayed even if channel types had previously been selected. Setting the channels types now will cause them to remain set because the ZX Interface 1 will not overwrite these system variables again. Should the printer output routines of the ZX Interface 1 wish to be used then it will be necessary to POKE these system variables to restore the output line width and current print position.

Should a program overwrite these unused system variables, e.g. a program that is loaded using just LOAD ""CODE, then any subsequent load operation will most likely cause the load menu to be displayed again (depending on the value now present in system variable at 23728).


Program Transfer from/to a PC

I have produced a Windows application to allow emulator TAP and TZX files to be loaded/saved via RS232 from/to a PC. A screenshot of the application is shown below:

ZX Tapre Player

To load a file into the RS232 ROM, ensure Spectrum mode is selected and then use the drop down list to select either TZX or TAP file format. Click the Browse button and select the folder containing the Spectrum files and the Files pane on the left hand side will be updated with all applicable files. Clicking on a file in this list will cause a contents breakdown of the file to be listed in the File Contents pane. Select the serial port from the drop down list and ensure the baud rate is set to 57600 (9600 is only applicable for legacy versions of the RS232 ROM up to V1.03, and 19200 is only applicable for legacy versions up to V2.00). On the Spectrum, type LOAD "" and the load menu will be displayed (unless a load channel has previously been selected). Choose the desired RS232 channel and then click the PLAY button on the ZX Tape Player utility. The blocks shown within the File Contents pane will be transferred through the serial connection in sequence. The STOP and PAUSE buttons can then be used. When stopped, the REWIND button is available and clicking it will cause the reselect the first block of the file. Alternatively, it is also possible to click on any of the blocks within the File Contents pane and then play from that point onwards.

The RS232 routines in the emulator cannot cope with a burst of data bytes from the PC but instead relies on the handshaking lines being checked by the PC between bytes. Not all serial ports do this, although most USB-to-RS232 adapters do. If loading problems are encountered, try checking the Single Byte Writes under the Mode drop down setting.

To save from the Spectrum to the PC, click on the RECORD button and specify a location and name of the file to create. On the Spectrum, type SAVE "name" and the standard "Start tape, then press any key" message will be displayed. Pressing a key will cause the save menu to be displayed (unless a save channel has previously been selected). Choose the desired RS232 channel and then the program will be transferred to the PC. The PC file remains open to receive further data from the PC, thereby allowing multi-part programs to be transferred. Once all parts have been saved, click the STOP button. When recording, the PAUSE button is available if required.


RS232 Cable Wiring

It is possible to connect using two different RS232 cable configurations - a Data cable and a Serial Printer cable. The Data cable is the preferred configuration.

Note that for both wiring configurations shown below, pin 6 of both the Spectrum 128 RS232 and KEYPAD sockets is on the side with the clip mechanism. The flat cable required by these sockets does not contain an outer screen conductor and so it is advisable to keep the length of cable to a minimum. Significant distances could be spanned by plugging in a standard serial extension cable since this will almost certainly have a screen conductor. When making a serial cable to connect to the ZX Interface 1, use cable that contains an outer screen conductor and connect this to the metal body of the 9 way / 25 way D-type connector at both ends.


Data Cable

A Data RS232 cable uses RTS/CTS handshaking to ensure reliable data transfers and so removes the necessity for a PC application to explicitly control the DTR line. This configuration is therefore more appropriate if the cable is also to be used for connecting to standard PC applications and guaranteed data transfers are required (if the PC application is capable of buffering as much data as is sent to it then the Serial Printer cable will be equally suitable).

The tables below show the Data cable wiring appropriate for the different types of RS232 sockets:

PinNamePC-9PC-25Name
10V570V
2TXD32TXD
3RXD23RXD
4DTR74RTS
5CTS85CTS
612V66DSR
612V18DCD
PinNamePC-9PC-25Name
10V570V
2CTS85CTS
3DTR74RTS
4RXD23RXD
5TXD32TXD
612V66DSR
612V18DCD
PinNamePC-9PC-25Name
2TX32TXD
3RX23RXD
4DTR74RTS
5CTS85CTS
70V570V
99V66DSR
99V18DCD
Spectrum 128 RS232 Spectrum 128 Keypad ZX Interface 1 RS232

For the Spectrum 128 RS232 and Keypad sockets, pin 6 is at the side with the clip. Further details can be found in the topic describing the Spectrum 128 Keypad.


Serial Printer Cable

A Serial Printer RS232 cable is primarily intended to allow the Spectrum to control a printer fitted with a serial interface, but can also be used to transmit data to a PC. The ZX Tape Player utility has been written to control the DTR signal line such that reliable data transfers from the Spectrum are achieved using a Serial Printer cable.

The tables below show the Serial Printer cable wiring appropriate for the different types of RS232 sockets:

PinNamePC-9PC-25Name
10V570V
2TXD32TXD
3RXD23RXD
4DTR420DTR
5CTS85CTS
612V66DSR
PinNamePC-9PC-25Name
10V570V
2CTS85CTS
3DTR420DTR
4RXD23RXD
5TXD32TXD
612V66DSR
PinNamePC-9PC-25Name
2TX32TXD
3RX23RXD
4DTR420DTR
5CTS85CTS
70V570V
99V66DSR
Spectrum 128 RS232 Spectrum 128 Keypad ZX Interface 1 RS232

For the Spectrum 128 RS232 and Keypad sockets, pin 6 is at the side with the clip. Further details can be found in the topic describing the Spectrum 128 Keypad.



Downloads

There is a specific version of the ROM cartridge for use on the ZXC1, ZXC2, or ZXC3 with its paging mechanism disabled (either via hardware, or through software set by embedding it in a ZX Cartridge Creator compilation but this will utilise a second 16K bank).

To program the ZXC3 ROM cartridge using the FLASH programming mechanism of the ZXC3 requires a different version of the ROM cartridge. This is because the ZXC3 cannot program the last 64 bytes of the ROM address space. It is therefore necessary to shift the character set bitmaps down in memory such that the last 64 bytes of the ROM address space are not used. This difference will not affect programs that determine the location of the character set bitmaps using system variable CHARS, but any program that simply assumes the bitmaps will reside at $3D00 will not display correctly.

There is also a specific version for use on the ZXC4, which utilises the Cassette paging mechanism provided by the ZXC4.

A built-in serial port or one provided by a plug in card will typically perform faster than a USB adapter (which seem to introduce delays between bytes transmitted).

Click here to download the Spectrum RS232 ROM cartridge. 16K
Click here to download the Spectrum RS232 ROM cartridge (shifted character set bitmaps). 16K
Click here to download the Spectrum RS232 ROM cartridge. 32K
Click here to download the ZX Tape Player utility.