A D71 is every 256-byte sector of a Commodore 1571 disk, track by track, with no header. Tracks are numbered from 1 and sectors from 0. The numbers here are from the VICE manual (chapter 17, section D71), read through a fetch tool that summarises, so they are “our words”; the 1541 disk they extend is described on the D64 pages.
Sectors per track
| Tracks | Sectors per track | Side |
|---|---|---|
| 1–17 | 21 | 0 |
| 18–24 | 19 | 0 |
| 25–30 | 18 | 0 |
| 31–35 | 17 | 0 |
| 36–52 | 21 | 1 |
| 53–59 | 19 | 1 |
| 60–65 | 18 | 1 |
| 66–70 | 17 | 1 |
The byte offset of track t, sector s is the track’s offset plus s × 256. Offsets the manual
prints, which the tests check: track 1 at 0x00000, 36 at 0x2AB00, 53 at 0x41000, 60 at
0x49500, 66 at 0x50100, 70 at 0x54500.
Image sizes
349,696 bytes (1,366 sectors), or 351,062 bytes when one error byte per sector follows. Any other size is not a standard image: the viewer reads what is there and lists the missing or extra bytes as problems.
Header and BAM, track 18 sector 0
The header and the BAM of side 0 are one sector, as on a 1541.
| Offset | Size | Meaning |
|---|---|---|
$00 | 2 | Track and sector of the first directory sector, normally 18/1 |
$02 | 1 | DOS version, $41 (“A”) for 1541 compatibility |
$03 | 1 | Double-sided flag: $00 single-sided, $80 double-sided |
$04–$8F | 140 | BAM entries for tracks 1 to 35, 4 bytes each (below) |
$90–$9F | 16 | Disk name, PETSCII padded with $A0 |
$A2–$A3 | 2 | Disk ID |
$A5–$A6 | 2 | DOS type, usually “2A” |
$DD–$FF | 35 | Free-sector counts for tracks 36 to 70, one byte each |
Other bytes of the sector are padding ($A0 around the name and ID, usually zero elsewhere); the viewer shows them as
“Unused”.
BAM entries
Tracks 1 to 35: four bytes each at $04 + 4 × (track − 1): a count of free sectors, then a 3-byte bitmap. A set bit is a free
sector; bit 0 of the first byte is sector 0, bit 0 of the second byte is sector 8, and so on. Bits for sectors the track does not have are
clear.
Tracks 36 to 70: the free count is the byte at $DD + (track − 36) of sector 18/0, and the 3-byte bitmap is in sector 0 of
track 53 at offset 3 × (track − 36). The viewer checks, for every track, that the count equals the number of bits set and
that no bit is set for a sector the track lacks.
A directory listing counts the free blocks of every track except 18 and 53; the viewer’s “Blocks free” does the same (this exclusion of 53 is our reading and is not stated in the text we read).
Directory and file entries
The directory is a chain of sectors starting at 18/1 (read from the header’s first two bytes), eight 32-byte entries a sector. The manual gives an interleave of 3 for the directory and 6 for files in native 1571 mode. An entry:
| Offset | Size | Meaning |
|---|---|---|
$00 | 2 | Next directory sector (in the first entry of a sector only); track 0 ends the directory |
$02 | 1 | File type: bits 0–3 the type (0 DEL, 1 SEQ, 2 PRG, 3 USR, 4 REL), bit 5 replace, bit 6 locked, bit 7 closed (clear gives a “splat” file, shown with *). A zero byte is a scratched entry. |
$03 | 2 | Track and sector of the file’s first sector |
$05 | 16 | File name, PETSCII padded with $A0 |
$15 | 2 | REL files: first side sector |
$17 | 1 | REL files: record length |
$1E | 2 | File size in sectors, low byte first |
File chains
Every sector of a file begins with a track and a sector: where the file continues. A first byte of 0 ends the chain and the second byte is then the index of the last used byte of the sector, so that sector holds that byte number minus 1 bytes of data; every other sector holds 254. The viewer reports a chain that loops, leaves the disk, runs into a sector another chain owns, or whose length disagrees with the directory’s size field.
Error bytes
An image of 351,062 bytes ends with one byte per sector, in sector order: $01 is no error and the codes $02 to
$0B and $0F are the drive’s errors 20 to 29 and 74, as on the D64 page.
Not described
Known, not yet covered
- REL side sectors and the 1571 super side sector; GEOS 128 disks.
Unknown
- The file allocation order of the 1571’s DOS beyond the interleave values above.