Format:Atari ATR disk image
| Platforms | Platform:Atari 8-bit |
|---|---|
| Magic | 96 02 |
| Extensions | .atr .xfd .atz |
| On this wiki | Facts · Code · Notes · Topics |
SIO2PC/Atari800 disk image of the Atari 8-bit: a 16-byte header with magic 0x96 0x02, the image size in 16-byte paragraphs and the sector size (128 or 256), followed by raw sectors whose first three are always 128 bytes.
Header
The header is 16 bytes, read by atari800 as struct AFILE_ATR_Header (src/afile.h): offset 0 magic 0x96, 1 magic 0x02, 2 image size in 16-byte paragraphs (low 16 bits, little endian), 4 sector size (u16, must be 128 or 256), 6 high 16 bits of the paragraph count, 8 seven bytes of unused data ("gash"), 0x0F write-protect byte (non-zero opens the image read-only). Atari800's reader combines the four paragraph bytes, shifts right by 3 to get the number of 128-byte units (single-density sector count), and for 256-byte sectors adds 3 when that count is odd (logical 128-byte boot sectors). Correction: an earlier version of this page guessed the write-protect flag at 0x0B and the high word at 8; the struct puts them at 0x0F and 6. Fact: Fact:Atari ATR disk image/struct/ATR header (16 bytes).
Boot sectors
Sectors 1-3 are always 128 bytes. On a double-density disk the image stores them either as 128 bytes (logical) or padded to 256 (SIO2PC/physical); Atari800 distinguishes the padded kinds by looking for a non-zero byte in file bytes 0x190-0x30F. Sector n >= 4 is at header + 0x180 (logical) or 0x300 + (n-4) x sector size.
XFD
XFD is the same sector data without the 16-byte header (size must then be inferred).
Sources
atari800/atari800 src/sio.c lines 296-335, 600-612, 920-940, commit b49865e63f5675c798d0122a5ff65c89b2f2748b; MAME's atari_dsk.cpp only registers the extensions atr, dsk and xfd for the legacy loader.
Code & repositories
- https://github.com/atari800/atari800 @
b49865e63f5675c798d0122a5ff65c89b2f2748b· license: GPL-2.0
Atari800 emulator: src/sio.c disk image mounting (ATR header handling)
Tested on: source read, not run: source reading only · checked 2026-10-18; last activity 2026-10-12; Note: the latest release ships binaries; the wiki links only the source, never the binaries