The first sector
Sector 0 is 512 bytes. It follows the layout of a PC boot sector up to offset 30, with little-endian words in the parameter block, but the Atari does not look for $55AA.
| Offset | Size | Field |
|---|---|---|
| 0 | 2 | A branch ($60xx, BRA.S) to the boot code |
| 2 | 6 | Free text, often the formatter’s name or zeros |
| 8 | 3 | The serial number |
| 11 | 2 | Bytes per sector: 512 |
| 13 | 1 | Sectors per cluster: 2 on a normal ST disk |
| 14 | 2 | Reserved sectors: 1 |
| 16 | 1 | Number of FATs: 2 |
| 17 | 2 | Number of root directory entries |
| 19 | 2 | Total sectors, both sides |
| 21 | 1 | Media descriptor |
| 22 | 2 | Sectors per FAT |
| 24 | 2 | Sectors per track |
| 26 | 2 | Number of sides |
| 28 | 2 | Hidden sectors |
| 30 | 480 | Boot code and padding, up to the last word |
| 510 | 2 | A word chosen so that the checksum comes out right on a bootable disk |
The fields from offset 11 to 29 are the BIOS parameter block (BPB). TOS reads the geometry from it; a disk whose BPB is not usable (a game with its own loader, or a disk that was never formatted) is still a readable disk of sectors.
The checksum
Add the 256 big-endian words of the sector, keeping the low 16 bits. If the sum is $1234, TOS treats the sector as executable and runs it at boot,
starting at its first byte (the branch). Any other sum means a plain data disk. The word at offset 510 is the one a disk tool changes to make the sum come out right. The explorer shows the
sum, and on an executable sector disassembles it with the 68000 decoder; the instructions, the data and the padding are not told apart.
Geometry
The image has no header: the number of tracks, sides and sectors comes from the parameter block (sectors per track, sides, total sectors). When the block is unusable, the explorer takes the geometry from the size: 80 to 84 tracks of 9 to 12 sectors, one or two sides, which is a handful of known sizes: 368,640 (80 × 9 × 1), 409,600 (80 × 10 × 1), 737,280 (80 × 9 × 2), 819,200 (80 × 10 × 2) and 901,120 (80 × 11 × 2) bytes are the common ones. A size that fits more than one geometry is shown as a guess.
| Bytes | Sectors | Usually |
|---|---|---|
| 368,640 | 720 | 80 tracks, 9 sectors, 1 side (360 KB) |
| 409,600 | 800 | 80 tracks, 10 sectors, 1 side |
| 737,280 | 1,440 | 80 tracks, 9 sectors, 2 sides (720 KB) |
| 819,200 | 1,600 | 80 tracks, 10 sectors, 2 sides |
| 901,120 | 1,760 | 80 tracks, 11 sectors, 2 sides |
Not described
Known, not yet covered
- Reference: where TOS loads the boot sector and what it expects of the code (registers, return) is not described; the layout is from a hard-disk driver document and a summary of Hatari’s source. The table of common sizes is arithmetic from the track, sector and side counts, not a published list.
- Viewer: the boot code is shown at an address you choose (0 by default), not where TOS puts it; no boot loader is identified by name.
Links
Reference
- bootiext.txt – the logical boot sector table with the parameter block offsets