RL's Cassette Routine
RL's Cassette Routine is a utility for saving and loading programs to cassette at very high speed. The utility gets located above RAMTOP, which is lowered to $7C00, and invoked using USR 32384.
The program is on an unlabelled cassette and so might not be original. It does not have an inlay or instructions. If you can provide any details on the origins or author of this program then please contact me.
The cassette contains a loader routine saved in normal ZX81 tape format followed by the Cassette Routine saved in high speed format. The loader routine sets the stack to $41FE and reads the program to addresses $4201-$7FFF. It then transfers $0398 bytes from $4201 down to address $4001 and sets the stack to $7BFC. It then returns to BASIC with error report 0/0. The result is that RAMTOP has been set to $7C00, with the utility located above it. The BASIC area is empty, ready to type in or load a program for fast saving, or to fast load a program.
The high speed format saves a '0' as a narrow pulse and a '1' as a wider pulse. Bytes are saved MSB first and are followed by a parity bit, which is set to '1' if there are
an odd number of '1's in the byte. The structure of the high speed format is as follows:
- 1 byte (parity bit not checked when loading)
- n narrow pulses (a minimum of 48 expected when loading)
- 1 wide pulse
- 1 byte of value $64 (parity bit not checked when loading)
- 2 bytes specifying the Start Address -1 (least significant byte first)
- 2 bytes specifying the End Address (least significant byte first)
- 256 byte blocks), consisting of:
- 1 byte of value $80 (value not checked when loading)
- 1 wide pulse (any preceding narrow pulses are ignored when loading)
- 256 data bytes (or fewer for final block)
To allow the utility to be easily loaded into an emulator I've converted it into standard ZX81 tape format. Once loaded, the utility is relocated above RAMTOP and a usage message displayed. The utility can now be used just as if it had been loaded from cassette in its original high speed format.