Introduction
When an Atari starts with a disk in the first drive, the operating system reads sector 1 of the disk into memory, looks at its first six bytes, reads
the number of sectors it asks for after it, and runs the code. This is the boot. Atari DOS
disks use it to load DOS.SYS; games use it to start themselves with no DOS. The boot
sectors are always read as 128 bytes each, even on a double density disk, as the
sector layout says.
The boot header, sector 1
| Byte | Size | What |
|---|---|---|
| 0 | 1 | boot flags: usually 0 |
| 1 | 1 | the number of sectors to read, counting sector 1 |
| 2–3 | 2 | the load address: where sector 1’s bytes are put; each next sector follows 128 bytes later |
| 4–5 | 2 | the init address: stored in DOSINI ($000C), and so called at every reset |
| 6 on | the code, which begins at the boot continuation address, the load address plus 6 |
A disk whose sector 1 says 0 sectors is not a boot disk; a data disk made by a formatter often
has zeros here. The explorer calls a boot header plausible when it names at least one sector, no more
than the disk has, and a load address that leaves room below $10000 for them.
The boot continuation address
After reading the sectors the operating system calls the code at the load address plus 6 as a
subroutine. The routine ends with rts and tells the system whether to carry on by the
carry flag: clear means success, set means the boot failed. The shortest possible one is
clc then rts (18 60); the boot loader of an emulator that
was disassembled for the tests starts with exactly that, then keeps its real work in the routine the
init address names. The explorer names the load address plus 6 boot_continue and the
init address boot_init in the disassembly, and starts the code from the continuation
address. What the OS does after that point (calling through DOSINI, then running DOS or the
program) is as the published descriptions say and is not checked against a real disk here.
Where the code is in the file
In an ATR of single or enhanced density the boot sectors are the first 128-byte sectors after the
header, so the code is contiguous. A double density ATR stores sectors 1 to 3 either as three
128-byte slots (then 384 bytes in all, and the other sectors follow at 256 bytes) or
as three 256-byte slots with the useful 128 bytes first; the explorer tells which by whether the
sector data is a multiple of 256 bytes plus 128 (the first) or a plain multiple of 256 (the second),
and the options bar can change it. What a drive sends for a boot sector above the third on a double
density disk is not described here: the explorer takes the first 128 bytes of each and shows the
disassembly as separate pieces where those bytes are not next to each other in the file.
In the explorer
The Disk page gives the sector count, load and init address. The boot code is disassembled at its load address with the Atari’s named addresses. Boot code very often loads a second stage with SIO calls; only the sectors the first header names are shown.