The ATR format was invented by Nick Kennedy for his SIO2PC. It is a 16-byte header followed by the disk’s sectors in order. There is no formal specification; this page follows Jindřich Kubec’s ATR File Format Description and the APE emulator’s Disk Image FAQ (atarimax.com), which numbers the header bytes from 1, so its byte 8 is offset 7 here. All numbers are little-endian.
Header
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
0 | 2 | uint16 | wMagic | 0x0296, stored 96 02: the sum of the character codes of NICKATARI. |
2 | 2 | uint16 | wPars | Size of the disk image in paragraphs (size ÷ 16), low 16 bits. |
4 | 2 | uint16 | wSecSize | Sector size: 128 (0x80) or 256 (0x100). |
6 | 1 | uint8 | btParsHigh | The high part of the size in paragraphs, added by revision 3.00 (APE: “Extended paragraphs”). Neither source gives the formula for combining it with wPars; as the high part it would count units of 65,536 paragraphs. |
7 | 4 | uint32 | dwCRC | APE’s 32-bit authentication CRC; the algorithm is not described. Kubec marks it “added by APE?”. |
11 | 4 | – | dwUnused | Unused. |
15 | 1 | bits | btFlags | APE: bit 0 write protect, bit 1 sealed (authenticated) image, bits 2–7 unused. |
Sectors
Sectors are numbered from 1, as the Atari numbers them, and stored in order straight after the header: sector n starts at 16 + (n − 1) × sector size for 128-byte sectors.
Kubec: if the sector size is over 128, the first three sectors should be 128 bytes long (the APE FAQ notes a double-density drive sends the first three boot sectors as 128 bytes), so sector n (n ≥ 4) starts at 16 + 384 + (n − 4) × 256. Kubec adds that a few files make those sectors 256 bytes long instead.
The APE FAQ gives the ATR equivalents of the three Atari disk formats: 720 sectors of 128 bytes (single density), 1,040 sectors of 128 bytes (1050 enhanced density), and 720 sectors of 256 bytes (double density). The sizes below follow from those.
| Disk | Sectors | Sector size | Paragraphs | File size |
|---|---|---|---|---|
| Single density | 720 | 128 | 0x1680 (5,760) | 92,176 bytes |
| Enhanced density (1050) | 1,040 | 128 | 0x2080 (8,320) | 133,136 bytes |
| Double density | 720 | 256 (first three 128) | 0x2CE8 (11,496) | 183,952 bytes |
What the sectors hold depends on the disk operating system that wrote them (Atari DOS 2, MyDOS, SpartaDOS and others); those file systems are not described here.
Example
00000000 96 02 80 16 80 00 00 00 00 00 00 00 00 00 00 00 ................
Reading it: magic 96 02; size 0x1680 paragraphs, 92,160
bytes of sectors; sector size 0x80, 128; high size byte 0; no CRC; not
read-only. Sector 1 starts at offset 16.