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. Emulators play each block as the ROM would write it, followed by a pause of about a
second. The extension .tap is also used for two unrelated tape formats,
the Commodore raw-pulse tape and the
Oric tape; see
all the .tap variations for how to tell them apart.
A .tap file dropped on any page of this site opens in the explorer, which
shows every block with its flag, length and checksum checked, decodes the headers, lists
BASIC programs, and shows code blocks as bytes. Z80 disassembly is planned and not built yet.
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
Variants
- ZX Spectrum tape image – blocks of a 2-byte length, a flag, the contents and an XOR checksum
- Oric tape image – the bytes of an Oric-1 or Atmos cassette: leader, sync, a 9-byte header, the name and the data
- Commodore raw-pulse tape image – the lengths of the pulses on a C64, VIC-20 or C16 tape
Links
Software
- Fuse – ZX Spectrum emulator that loads TAP files (Windows, macOS, Linux)
- ZEsarUX – emulator of the Spectrum and other machines (Windows, macOS, Linux)
- Spectaculator – ZX Spectrum emulator that loads TAP files (Windows)
Reference
- TAP format – the Sinclair Wiki’s description of the format
Not described
The container is described: the blocks page covers lengths, flags, checksums, the four header types, BASIC programs and code. What remains:
Known, not yet covered
- Viewer: code blocks are shown as bytes; a Z80 disassembler is a later job and will be linked here. Number and character arrays, and screens (
SCREEN$), are shown as bytes, not as values or a picture.
Unknown
- Reference: how the contents of a number or character array block are laid out. The Spectrum ROM defines it, but no tape with an array block was available to check a description against, so none is given on the blocks page.