Technique:Identifying disk and tape images
| On this wiki | Facts · Code · Notes · Topics |
|---|
How to tell which format an unknown home-computer disk, flux, snapshot or tape image is: first by the magic bytes at offset 0, then, for headerless raw dumps, by exact file size; every value links to the format page that cites its source.
Step 1: magic bytes
Read the first 16 bytes. If one of these matches, you are done (each row links the page with the source evidence).
| Bytes at offset 0 | Format | Notes |
|---|---|---|
GCR-1541 (47 43 52 2D 31 35 34 31), or GCR-1571 |
Format:G64 GCR disk image | version byte 0 at offset 8 |
WOZ1 or WOZ2 then FF 0A 0D 0A |
Format:WOZ disk image | Apple II bit stream; 12-byte header, chunks from byte 12 |
SCP (53 43 50) |
Format:SCP flux image | disk-type byte at offset 4 says the machine |
HXCPICFE (HFE v3: HXCHFEV3) |
Format:HFE image (HxC) | 512-byte header |
0E 0F |
Format:Atari ST and MSA disk images (MSA) | big-endian 10-byte header; .ST has no magic |
ZXTape! 1A (5A 58 54 61 70 65 21 1A) |
Format:ZX Spectrum TAP and TZX tape images (TZX; also .cdt for the Amstrad CPC) | version bytes follow |
MV - CPC (standard) or EXTENDED CPC DSK |
Format:CPC DSK disk image | track count at 0x30, sides at 0x31 |
2IMG (32 49 4D 47) |
Format:Apple II disk images (DSK, PO, 2IMG) | 64-byte header wrapping DOS-order, ProDOS-order or nibble data |
96 02 |
Format:Atari ATR disk image | 16-byte header; the sector size at offset 4 must be 128 or 256 |
1F A6 DE BA CC 13 7D 74 |
MSX .cas cassette, see Format:MSX DSK disk image#Tape | the same 8 bytes also start every block inside the file |
44 4F 53 xx ("DOS" + flags) |
Format:Amiga ADF disk image | only on AmigaDOS-formatted disks; non-DOS (game) disks are headerless |
Two traps: HFE and G64 both look like "disk" files but hold bit cells, not sectors, so a sector extractor cannot read them directly. A TZX starting with ZXTape! may carry MSX data in TSX block 0x4B.
Step 2: raw images without magic, by exact size
These formats have no header at all, so the file length is the only test. Sizes quoted by the pages are exact; sizes marked (derived) are computed here from the geometry on the page and are not printed in a source.
| Size in bytes | Candidate | Source page |
|---|---|---|
| 174848 | D64, 35 tracks (683 sectors x 256) | Format:Commodore D64, D71 and D81 disk images |
| 175531 | D64, 35 tracks plus 683 error bytes | same |
| 196608 | D64, 40 tracks (768 sectors x 256) | same |
| 197376 | D64, 40 tracks plus 768 error bytes (derived) | same |
| 349696 | D71 (2 x 683 x 256) | same |
| 819200 | D81 | same |
| 143360 | Apple II .dsk/.do/.po, 35 x 16 x 256 | Format:Apple II disk images (DSK, PO, 2IMG) |
| 901120 | Amiga ADF, DD 80 x 2 x 11 x 512 | Format:Amiga ADF disk image |
| 912384 | ADF with 81 tracks (accepted by MAME) | same |
| 1802240 | ADF, HD (22 sectors per track) | same |
| 368640 (derived) | MSX 360 KiB (40 x 2 x 9 x 512), or an Atari ST 9-sector image of 40 tracks | Format:MSX DSK disk image |
| 737280 (derived) | MSX 720 KiB (80 x 2 x 9 x 512), or an Atari ST 9-sector 80-track image | Format:MSX DSK disk image, Format:Atari ST and MSA disk images |
| 49179 | ZX Spectrum .SNA, 48K (27 + 49152) | Format:ZX Spectrum Z80 snapshot |
| 131103 or 147487 | ZX Spectrum .SNA, 128K | same |
Atari ST .ST images are 9, 10 or 11 sectors per track, up to 82 tracks, 2 sides, 512 bytes (Format:Atari ST and MSA disk images), so the size is sectors x tracks x 2 x 512, for example 80 x 2 x 9 x 512 = 737280 and 80 x 2 x 11 x 512 = 901120 (derived).
Step 3: sizes that collide
901120 is both an ADF and an ST with 11 sectors per track, and 737280 is both an MSX/PC-style 720 KiB image and an ST 9-sector image. Look inside: an ADF starts with DOS (or is all boot code and a root block at sector 880 with type 2 and secondary type 1, see Format:Amiga ADF disk image), while MSX and ST images have a FAT12 boot sector. For a 143360-byte Apple image the extension (.do or .po) tells the sector order, but a .dsk can be either: test for a DOS 3.3 VTOC at track 17 sector 0 or a ProDOS volume directory in block 2 (Format:Apple II disk images (DSK, PO, 2IMG)).
Step 4: files with no magic and no fixed size
- .TAP (ZX Spectrum): a chain of little-endian u16 block lengths; walk the chain, and if it ends exactly at the end of the file it is a TAP (libspectrum rejects a truncated length or block, Format:ZX Spectrum TAP and TZX tape images).
- XFD (Atari 8-bit) is an ATR without its 16-byte header; the sector size must be inferred from the file size (Format:Atari ATR disk image#XFD).
- If a D64 image is longer than expected by exactly one byte per sector, the extra bytes are an error table, not data.
Why it matters
The format decides what survives: sector images (D64, ADF, ST, DSK) lose copy-protection, which flux and bit-cell images (SCP, HFE, G64, WOZ, extended CPC DSK) keep. When you must pick a reader, pick it by the format that holds the protection you care about.