Atari 8-bit File Formats Explained: ATR, XFD, ATX, DCM, XEX, CAS, CAR and ROM

Download Atari 8-bit software today and you will meet a pile of file extensions: .atr, .xfd, .atx, .dcm, .pro, .xex, .cas, .car, .rom, .bin. Some are images of whole disks, tapes or cartridges. One (.xex) is just a program file, as DOS would see it. This guide explains what each format contains and which to choose. It also goes byte by byte through the four you will handle most, so you can repair, convert or create them yourself.

You need: nothing beyond a hex viewer if you want to follow along. Any Atari emulator will open all of these files.

1. The quick map

Extension What it is Origin Copy protection?
.ATR Disk image: 16-byte header + raw sectors Nick Kennedy, for SIO2PC No
.XFD Disk image: raw sectors, no header Xformer emulators (earlier .SD/.DD) No
.ATZ / .ATR.GZ gzip-compressed ATR emulator convention No
.DCM Compressed disk image Bob Puff's DiskComm (Disk Communicator) No
.PRO Disk image with protection data Steven Tucker's APE ProSystem Yes
.ATX Disk image with timing/layout data Jorge Cwik's VAPI project Yes (90K single density only)
.SCP, .A2R, .RAW Flux-level captures from imaging hardware SuperCard Pro, Applesauce, KryoFlux Raw flux
.XEX / .EXE / .COM / .OBX DOS binary-load program file Atari DOS n/a
.CAS Decoded cassette data Ernest Schreurs' Digital Cassette Image tools; extended by Tomasz Krasuski (A8CAS) Extended chunks only
.WAV (.FLAC, .OGG) Raw audio of a tape — Yes (it's the signal)
.CAR Cartridge dump + 16-byte header naming the bank-switching type Atari800 emulator, version 0.8.0 n/a
.ROM / .BIN Raw cartridge (or OS) dump, no header — n/a

Rules of thumb:

  • Use ATR for any normal, unprotected disk. Everything supports it: emulators, SIO2PC software, FujiNet, SIO2SD and the other SD devices.
  • Use ATX to preserve or play an original protected disk. Altirra's documentation is blunt about this: ATR, DCM and XFD hold no layout, timing or error information, so protected software in those formats has either been cracked or won't work.
  • Use XEX for single-file programs. Use CAR rather than raw ROM for cartridges, so the emulator doesn't have to guess the banking scheme.
  • Keep tapes as WAV/FLAC for preservation, especially if they have voice or music on the audio track. CAS can't store audio.

2. Disk geometry in one table

An image is only a list of sectors, so it helps to know what a real disk held:

Density Drive Layout Sector size Capacity
Single 810, 1050 40 tracks × 18 = 720 sectors 128 bytes 92,160 bytes (90K)
Enhanced ("dual") 1050 40 tracks × 26 = 1,040 sectors 128 bytes 133,120 bytes (130K)
Double XF551, upgraded/third-party drives 720 sectors 256 bytes 184,320 bytes (180K)

Larger images (360K, 720K and hard-disk-sized ATRs up to 16MB) exist for MyDOS, SpartaDOS and modern storage devices. One quirk carries into every 256-byte format: the first three sectors, the boot sectors, are always 128 bytes. Images store them as 128-byte records, which is why a 180K ATR is slightly smaller than 720 × 256.

3. ATR, byte by byte

An ATR is a 16-byte header followed by every sector in order, starting with sector 1. The header, little-endian:

Offset Size Meaning
0–1 word Signature $0296, stored as 96 02. It is the 16-bit sum of the ASCII letters "NICKATARI"
2–3 word Image size in paragraphs (16-byte units), low 16 bits
4–5 word Sector size: 128 (80 00) or 256 (00 01)
6 byte High byte(s) of the paragraph count, added in SIO2PC rev 3.00 for big images
7–15 — Flags and extras. Usage varies by tool: Kennedy's SIO2PC used a flags byte and a "first bad sector" word, ACE used the final bytes as an error-map count. Otherwise zero

Worked example: a 90K single-density disk holds 720 × 128 = 92,160 bytes. Divided by 16 that is 5,760 = $1680 paragraphs, so the header is:

96 02 80 16 80 00 00 00 00 00 00 00 00 00 00 00

For a 180K double-density image, the data is 3 × 128 + 717 × 256 = 183,936 bytes = 11,496 = $2CE8 paragraphs, giving 96 02 E8 2C 00 01 00 …. This matches how Altirra's own ATR writer builds the header: paragraph count from the 128-byte boot sectors plus the full-size remainder.

Converting XFD to ATR therefore just means prepending the right 16 bytes. An XFD is the same sector dump with no header, and its density is inferred from its file size. Here is a minimal Python sketch that reads a header and checks it:

import struct, sys
hdr = open(sys.argv[1], "rb").read(16)
magic, paras_lo, secsize, paras_hi = struct.unpack("<HHHB", hdr[:7])
if magic != 0x0296:
    sys.exit("not an ATR")
size = (paras_hi << 16 | paras_lo) * 16
print(f"{size} data bytes, {secsize}-byte sectors")

4. XEX: the DOS binary-load format

An executable is not a disk image. It is a file, the format Atari DOS's binary save and the Assembler Editor cartridge produce. The layout:

FF FF                     header (identifies a binary file)
<start lo> <start hi>     segment 1: first address
<end lo>   <end hi>       segment 1: last address (inclusive)
<data …>                  end-start+1 bytes
<start> <end> <data>      segment 2 … n (more "load chunks")
E0 02 E1 02 <lo> <hi>     optional: a segment that writes RUNAD

Two OS locations make a binary file run itself:

  • RUNAD, 736–737 ($2E0–$2E1). If a segment loads an address here, the loader jumps to it after the whole file has loaded.
  • INITAD, 738–739 ($2E2–$2E3). If a segment loads an address here, that code runs immediately, as soon as the segment is in memory. Loading resumes when it returns with RTS. Programs use this for title screens, memory checks and "loading…" pictures shown midway through the load.

Because a disk image isn't involved, emulators, SIO2PC programs and SD devices boot an XEX by supplying a small loader of their own. That is why the occasional XEX misbehaves on one device but not another. A sloppy file, such as Altirra's example of a demo with a segment two bytes too long, may be tolerated by one loader and rejected by DOS.

5. CAS: tape images as chunks

A CAS file is a series of chunks. Each one starts with an 8-byte header: a 4-character ID, a 16-bit little-endian length, and two auxiliary bytes. Then come length bytes of payload. The chunk types:

ID aux1/aux2 Payload
FUJI — File header; optional description text
baud baud rate (normally 600) none
data inter-record gap before this block, in milliseconds One tape record exactly as it was on tape
fsk gap in ms Raw FSK pulse lengths, for non-standard signals
pwms, pwml, pwmc, pwmd settings/gap Turbo (pulse-width) data: settings, raw pulses, compressed pulses, data bytes

A standard OS tape record is 132 bytes: two $55 speed-measurement bytes, a control byte ($FC full record, $FA partial, $FE end of file), 128 data bytes and a checksum. The OS writes 600-baud FSK, using 5,327 Hz for mark and 3,995 Hz for space. The first five chunk types come from the original format. The fsk/pwm* chunks are the later extensions that let CAS carry protection tricks and Eastern European turbo systems. What CAS cannot hold is the audio track. Altirra loads WAV, FLAC and Ogg recordings directly, and since 4.30 also accepts a CAS-plus-Ogg pair for tapes with sound.

6. CAR: cartridges with a type tag

Cartridge boards used dozens of bank-switching schemes: 8K, 16K, XEGS 32K–1M, OSS, Williams, SpartaDOS X, MaxFlash and more. A raw .rom dump doesn't say which one it is. The CAR header does:

Offset Size Meaning
0–3 4 chars CART
4–7 32-bit big-endian Cartridge type number (the mapper)
8–11 32-bit big-endian Checksum: simple sum of all ROM bytes
12–15 — Unused
16… — ROM data

Altirra checks the checksum and rejects a type number it doesn't support. Atari800 accepts types 0–160 (-cart-type) and documents the numbering in its cart.txt. Note the byte order: CAR is big-endian, unlike nearly everything else on the Atari.

Troubleshooting

  • "Not an Atari disk file" or the image won't mount: check the first two bytes. 96 02 is an ATR. A header-less file whose size is exactly 92,160, 133,120 or 183,936 bytes is probably an XFD.
  • Protected game crashes after the title screen: it is probably a bad ATR conversion. Find an ATX, or a cracked release.
  • CAS loads in the emulator but not on the real machine via an SD device: turbo chunks need hardware turbo support, or a device that emulates it.
  • Cartridge shows garbage: it was probably a raw ROM loaded with the wrong mapper. Choose the type manually, or find the CAR version.

Further reading

Credits