How this page was made. The CPCWiki page for the format could not be fetched (HTTP 403), so the layout below was derived from six real CPC tape files on the machine that built this site (six commercial games of 36,636 to 73,322 bytes, read in place, not copied): each walks to its last byte with these rules, and the header fields were read at these offsets. The names of the fields are those of the Amstrad firmware’s cassette header record as remembered (not re-read), so they are labels, not a sourced description. Two-byte values are low byte first.
Blocks
| Offset in the block | Size | Field | Description |
|---|---|---|---|
0 | 2 | Length N | The number of bytes after these two: the flag and the contents. |
2 | 1 | Flag | $2C for a header block, $16 for a data block. |
3 | N − 1 | Contents | The 28-byte header, or the data. |
In all six files every header block is 29 bytes long (length 29, flag $2C, 28 bytes of header) and is followed by one data block (flag $16) whose length is the header’s data length plus one. Data blocks are up to 2,048 bytes (2,049 with the flag).
Header
| Offset in the header | Size | Field | Description |
|---|---|---|---|
$00 | 16 | Name | Zero padded (ALIEN, COMMANDO, OVERLANDER, HEADER in the files seen). |
$10 | 1 | Block number | 1 on the first block of a file. |
$11 | 1 | Last block flag | $FF on the last block of a file, 0 on the others (0 on the first of a file of several blocks in one file seen). |
$12 | 1 | File type | From the firmware guide, as remembered: bit 0 set = protected; bits 1 to 3: 0 BASIC, 1 binary, 2 screen image, 3 ASCII. The files seen have 1 (protected BASIC: a program loaded at $0170) and 2 (binary, with a load address such as $5C00 or $A400 that is also the entry address). |
$13 | 2 | Data length | The number of bytes in the data block that follows. |
$15 | 2 | Data location | The address the data loads at. |
$17 | 1 | First block flag | $FF on the first block of a file. |
$18 | 2 | Logical length | The length of the whole file (equal to the data length when the file is one block). |
$1A | 2 | Entry address | Where a binary file starts running; 0 for BASIC. |
Data blocks
The flag $16 and the data. The tape file keeps neither the segment structure nor the CRCs of the cassette recording: the data of a block is stored in one piece. A file of several blocks continues with the next header block (block number 2, then 3 …) until the one flagged last.
The registry recognises the format by this structure: the file is exactly a chain of pairs (a 29-byte block with flag $2C, a data block with flag $16 and length equal to the header’s data length plus one) and ends where the file ends. None of 60,000 random files of nine sizes, none of 20,000 files of random printable text and none of the 32 other .tap files on the machine was taken for a CPC tape, and the six real tapes were; a ZX Spectrum tape, whose first block is 19 bytes long with flag 0, cannot start like this.