Format:ZX Spectrum TAP and TZX tape images
| Platforms | Platform:ZX Spectrum, Platform:Amstrad CPC |
|---|---|
| Magic | 5A 58 54 61 70 65 21 1A |
| Extensions | .tap .tzx .cdt |
| On this wiki | Facts · Code · Notes · Topics |
Tape images for the ZX Spectrum and clones: .TAP is just the raw blocks (u16 length, flag byte, data, XOR checksum); .TZX starts "ZXTape!" 1A, a major and minor version byte, then typed blocks (0x10 standard speed, 0x11 turbo, 0x12 pure tone ... 0x5A glue) describing pulses so custom loaders work.
TZX header
Eight signature bytes "ZXTape!" 0x1A, then major and minor revision bytes (10 header bytes in all), then blocks, each starting with a one-byte id. Amstrad CPC tapes use the same container as .cdt.
Block ids and layouts (libspectrum / MAME)
- 0x10 standard speed data: u16 pause, u16 length, data. 0x11 turbo: 0x0F bytes of timing parameters then u24 length and data. 0x12 pure tone: 4 bytes. 0x13 pulse sequence: count byte then 2 bytes per pulse. 0x14 pure data: 7 bytes of parameters then u24 length and data. 0x15 direct recording: 5 bytes then u24 length. 0x18 CSW recording, 0x19 generalized data.
- 0x20 pause or stop-the-tape; 0x21/0x22 group start/end; 0x23 jump; 0x24/0x25 loop start/end; 0x26 call sequence; 0x27 return; 0x28 select; 0x2A stop tape in 48K mode; 0x2B set signal level.
- 0x30 text description; 0x31 message; 0x32 archive info; 0x33 hardware type; 0x35 custom info; 0x5A glue (merge) block.
- Deprecated in TZX 1.20: 0x16 C64 ROM type data, 0x17 C64 turbo tape, 0x34 emulation info, 0x40 snapshot block.
- 0x4B is the TSX data block used for MSX tapes (handled by MAME).
TAP
A sequence of u16 little-endian block lengths each followed by that many bytes (libspectrum tap.c lines 60-131 copies each block unchanged, flag and parity byte included, fails on a truncated length or block, and gives each block a 1 s pause; Fact:ZX Spectrum TAP and TZX tape images/behavior/TAP block framing). Unverified (not in tap.c): first byte 0x00 header or 0xFF data flag, last byte XOR of all others; a 19-byte header block holds type (0 program, 1 number array, 2 character array, 3 code), 10-character name, length, and two parameters (autostart line / load address).
Sources
fuse-emulator libspectrum (GPL-2.0-or-later) tzx_read.c lines 33-34, 124-144, commit 0518d5c559bc71580300e2089376ac5d56df5d56 (speccytools mirror); MAME src/lib/formats/tzx_cas.cpp lines 8-26, 105-190, 598-805, commit 1d7a454ed79e97d35d2a9f127ac029ead94711d6.
Code & repositories
- https://github.com/mamedev/mame @
1d7a454ed79e97d35d2a9f127ac029ead94711d6· license: BSD-3-Clause (declared by the contributor; GitHub's detector did not recognize COPYING)
MAME src/lib/formats/*_dsk.cpp and tzx_cas.cpp: floppy and tape image loaders
Tested on: source read, not run: source reading only · checked 2026-10-18; last activity 2026-10-18; Note: the latest release ships binaries; the wiki links only the source, never the binaries - https://github.com/speccytools/libspectrum @
0518d5c559bc71580300e2089376ac5d56df5d56· license: GPL-2.0
libspectrum (Fuse): tzx_read.c, z80.c (GPL-2.0-or-later)
Tested on: source read, not run: source reading only · checked 2026-10-18; last activity 2026-10-02