A D81 is every 256-byte sector of a Commodore 1581 disk, track by track, with no header. Tracks are numbered from 1 and sectors from 0. The numbers are from the VICE manual (chapter 17, section D81), read through a summarising fetch tool, so they are “our words”.
Geometry
80 tracks, each of 40 sectors (0 to 39), 3,200 sectors in all. Track t starts at (t − 1) × 0x2800, so track 40 is at
0x61800 and track 80 at 0xC5800 (the manual prints the last). Files and the directory use an interleave of 1.
Image sizes
819,200 bytes, or 822,400 bytes when one error byte per sector follows. Any other size is read as far as it goes and the missing or extra bytes are listed as problems.
Header, track 40 sector 0
| Offset | Size | Meaning |
|---|---|---|
$00 | 2 | Track and sector of the first directory sector, 40/3 |
$02 | 1 | DOS version, $44 (“D”) |
$04–$13 | 16 | Disk name, PETSCII padded with $A0 |
$16–$17 | 2 | Disk ID |
$19–$1A | 2 | DOS version “3” and disk format version “D”: shown together as the DOS type “3D” |
$AB–$BC | – | GEOS border sector and ID string on a GEOS disk (not described further) |
BAM, track 40 sectors 1 and 2
Side 0 of the BAM (40/1) covers tracks 1 to 40 and side 1 (40/2) tracks 41 to 80, each with the same layout:
| Offset | Size | Meaning |
|---|---|---|
$00 | 2 | Next BAM sector: 40/2 on the first; track 0 and sector $FF on the second |
$02 | 1 | Version, $44 |
$03 | 1 | The one’s complement of the version, $BB |
$04–$05 | 2 | Disk ID |
$06 | 1 | I/O byte: bit 7 verify on, bit 6 check header CRC |
$07 | 1 | Auto-boot flag |
$08–$0F | 8 | Reserved |
$10–$FF | 240 | Entries for 40 tracks, 6 bytes each: a free count and a 5-byte bitmap. Track 1 (or 41) is at $10, track 40 (or 80) at $FA. |
A set bit is a free sector; bit 0 of the first bitmap byte is sector 0. The viewer checks that every count equals the bits set and that no bit is set beyond sector 39.
Directory and file entries
The directory is a chain of sectors from 40/3 (sectors 3 to 39 of track 40, up to 37 × 8 = 296 entries in the root), eight 32-byte entries a sector, in the same entry layout as the D71; the type bits add type 5, a CBM partition (sub-directory).
A partition counts as a sub-directory only if (the manual’s rule, our words) it starts on sector 0 of a track, its size is a multiple of 40 sectors, it is at least 120 sectors and it neither starts on nor crosses track 40. For such an entry the first-sector field is where the partition begins and the size field its length in sectors. The viewer shows both and does not follow them.
If the auto-boot flag is set, the drive looks for a USR file named “COPYRIGHT CBM 86”: a 2-byte load address, a size byte, the program and a checksum. The viewer lists the file; it does not decode that layout.
File chains
As on the other Commodore disks: the first two bytes of a sector are the track and sector of the next; a track of 0 ends the chain and the second byte is the index of the last used byte, so the last sector holds that number minus 1 bytes; every other sector holds 254.
Error bytes
An image of 822,400 bytes ends with one byte per sector in sector order ($01 is no error). The codes are those of the
D64 page; whether the 1581 reports the same set is not stated in the text we read.
Not described
Known, not yet covered
- The inside of a partition; REL side sectors; the auto-boot file format; the GEOS header bytes.
Unknown
- The 1581’s own list of error codes in the error bytes.