Introduction
An Atari binary load file is a run of segments. Each is a start address, an end address and the bytes that go from the first to the last. There is no count of segments, no total length and no checksum: the loader reads segments until the file ends. All 16-bit numbers are little endian, low byte first.
| Part | Size | What |
|---|---|---|
| Marker | 2 bytes | FF FF; required at the start of the file, optional before any other segment |
| Start address | 2 bytes | where the first data byte goes |
| End address | 2 bytes | where the last data byte goes |
| Data | end − start + 1 bytes | the bytes themselves |
Marker
The file must start with the two bytes FF FF. Atari DOS refuses a file without them
(DOS 2 answers “not a binary load file”), and the explorer reports that the file does not begin with
the marker. A later segment may be preceded by the same two bytes, which the loader skips:
programs that join several files by appending them end up with a marker in the middle.
The marker has no other meaning. It follows that a segment starting at $FFFF cannot
be told from a marker: the explorer, like the loaders that skip the marker, reads those two bytes
as one (this is an inference from how the marker is skipped, not something a document says).
Start and end address
The start address is where the first data byte is loaded. The end address is the address of the
last byte, not the one after it, so a segment of one byte has the same start and
end, and the data is end − start + 1 bytes long. A segment of 256 bytes at
$0600 ends at $06FF.
An end address below the start address is not a valid segment; the explorer reports it and lists the rest of the file as extra bytes. Segments can lie anywhere in the 64 KiB address space, including the zero page, page 2 where the operating system keeps its vectors, and (for programs that switch the ROM out) the addresses under the ROM.
Data
The data is copied to the addresses from the start to the end. A segment that is shorter in the file than its addresses say is damaged; the explorer shows the bytes that are there and reports how many the header promised. Segments are loaded in file order, so a later segment that covers the same addresses replaces the earlier bytes.
A segment that covers the vectors $02E0 to $02E3 sets the run address
or the init address: see Loading and start-up.
Example
00000000 FF FF 00 06 03 06 A9 00 60 EA E0 02 E1 02 00 06 ..........
Read from the start: marker; start $0600, end $0603, four data bytes
A9 00 60 EA (lda #$00, rts, nop); start
$02E0, end $02E1, data 00 06, which is the address
$0600.
What the explorer reports
- the file does not start with
FF FF; - a segment whose end is below its start;
- a segment whose data runs past the end of the file;
- a marker, or fewer than four bytes, with no segment after it;
- bytes after a segment it cannot read, shown as extra bytes.
The tree covers the whole file in every one of these cases.