Format:CPC DSK disk image
| Platforms | Platform:Amstrad CPC |
|---|---|
| Magic | 4D 56 20 2D 20 43 50 43 (standard), "EXTENDED CPC DSK" (extended) |
| Extensions | .dsk |
| On this wiki | Facts · Code · Notes · Topics |
Amstrad CPC / CPCEMU disk image: a 256-byte header starting "MV - CPC" (standard) or "EXTENDED CPC DSK" (extended, per-track sizes), track count at 0x30, sides at 0x31, then 256-byte Track-Info blocks each followed by its sector data; the extended form can describe protected disks.
Header (0x100 bytes)
- 0x00: "MV - CPC" for a standard image (the full CPCEMU text is longer; only 8 bytes are compared) or "EXTENDED CPC DSK" (16 bytes compared) for extended.
- 0x30: number of tracks. 0x31: number of sides (heads).
- Standard: u16 little-endian track size at 0x32, the same for every track (it includes the 0x100-byte Track-Info block). Track n starts at 0x100 + n x size.
- Extended: a table of one byte per track starting at 0x34; the byte times 256 is the size of that track including its Track-Info block, and 0 means the track is absent (not stored). Tracks are stored interleaved by side for two-sided images (track 0 side 0, track 0 side 1, ...); for single-sided images MAME skips alternate slots.
Track data
Each track begins with a 0x100-byte Track-Info block (identifier "Track-Info", track and side numbers, sector size code, sector count, gap and filler, then one sector-info entry per sector with C, H, R, N, ST1, ST2 and, in extended images, the real data length). Sector data follows at track offset 0x100. Track-Info field order (MAME struct track_header, packed): 13-byte tag, 3 unused bytes, track number 0x10, side 0x11, data rate 0x12, recording mode 0x13, sector size code 0x14 (size = 128 << N), sector count 0x15, gap3 length 0x16, filler byte 0x17; sector entries start at 0x18, 8 bytes each: C, H, R, N, ST1, ST2, u16 data length (ST1 bit 5 or ST2 bit 5 = CRC error, ST2 bit 6 = deleted data, ST1 bit 2 = no data). Facts: Fact:CPC DSK disk image/struct/Track-Info block header (0x18 bytes), Fact:CPC DSK disk image/struct/Sector info entry (8 bytes). MAME's older legacy reader in the same file compares only 8 bytes of "EXTENDED"; the current reader compares all 16 bytes of "EXTENDED CPC DSK".
Why extended
Protected CPC disks use sectors with the wrong size code, error flags (ST1/ST2) and multiple copies of a sector id; only the extended per-sector data length can store these.
Sources
MAME src/lib/formats/dsk_dsk.cpp lines 22-23, 52-55, 241-264, 284-285, 313-316, 363-420, 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