Introduction
A ZX Spectrum TAP file holds the blocks of a Spectrum cassette tape as plain bytes. It is the simplest Spectrum tape format and the easiest to make by hand, which is why cross-compilers and assemblers for the Spectrum often write it.
TAP keeps only what the Spectrum’s standard loader reads, not the sound of the tape, so
it cannot hold turbo loaders or copy protection; TZX
does that. The Commodore 64 also has a .tap format, but it is unrelated: it
records the pulse lengths of the tape and starts with the text
C64-TAPE-RAW.
Structure
The file is a series of blocks with no file header. Each block is a 2-byte
little-endian length, then that many bytes exactly as the Spectrum saves them: a flag
byte, the data and a checksum byte, which is all the previous bytes of the block XORed
together. The flag is 00 for a header block and FF for a data
block.
A program or file saved from BASIC is a pair of blocks. The header block is 19 bytes long: the flag, a type byte (0 for a program, 1 and 2 for arrays, 3 for bytes of code), a 10-character file name, the data length, two parameters such as the start line or load address, and the checksum. The data block follows.
0Block length little-endian2 bytes2Header block flag00, type, name, length, parameters, checksum19 bytes21Block length little-endian2 bytes23Data block flagFF, data, checksumvaries
Links
Software
- Fuse, a ZX Spectrum emulator (Windows, macOS, Linux)
- ZEsarUX, an emulator of the Spectrum and other machines (Windows, macOS, Linux)
- Spectaculator, a ZX Spectrum emulator (Windows)