The catalogue of a DFS disc is its first two sectors, 512 bytes. Sector 0 holds the names, sector 1 everything else about the disc and the files. The same file is in the same place in both: entry n of sector 0 is the name of entry n of sector 1. Numbers of two bytes are little-endian. The bytes below were read on twelve real disc images (the BeebEm disc folder and three discs of an assembly-language book) and on built images; all twelve say 800 sectors, so a 40-track catalogue (400 sectors) is only seen on built images.
Sector 0: the names
| Bytes | Meaning |
|---|---|
| 0–7 | The first 8 characters of the disc title (padded with spaces or $00) |
| 8–255 | 31 entries of 8 bytes: bytes 0–6 the file name, 7 characters padded with spaces; byte 7 the directory character ($ by default) with bit 7 the locked flag |
The directory character stands in for directories: a file A.PROG is the file PROG in directory
A. DFS has no sub-directories; it is just a letter before the name, and *DIR chooses the one that
is listed.
Sector 1: the disc and the files
| Bytes | Meaning |
|---|---|
| 0–3 | The last 4 characters of the disc title: the title is 12 characters in all |
| 4 | The cycle number, in BCD: it goes up by one each time the catalogue is rewritten |
| 5 | Number of entries times 8: 0 to 248 (31 files) |
| 6 | Bits 0–1: bits 8 and 9 of the number of sectors on the disc. Bits 4–5: the boot option set by *OPT 4: 0 nothing, 1 *LOAD $.!BOOT, 2 *RUN $.!BOOT, 3 *EXEC $.!BOOT (the file is run when the disc is booted with Shift and Break) |
| 7 | The low 8 bits of the number of sectors: 400 for 40 tracks, 800 for 80 |
| 8–255 | 31 entries of 8 bytes, the same files in the same order as sector 0, see below |
A file entry (8 bytes in sector 1)
| Byte | Meaning |
|---|---|
| 0–1 | Load address, bits 0–15 |
| 2–3 | Execution address, bits 0–15 |
| 4–5 | Length in bytes, bits 0–15 |
| 6 | The high bits, two each: bits 0–1 bits 8–9 of the start sector; bits 2–3 bits 16–17 of the load address; bits 4–5 bits 16–17 of the length; bits 6–7 bits 16–17 of the execution address |
| 7 | Start sector, bits 0–7 |
A real example, the first file of the disc Assembly_Language_Programming_Exercises.ssd: the name entry is
45 78 39 2E 34 20 20 24 (Ex9.4 , directory $) and the file entry is
00 19 23 80 CD 05 CC 51. The load address is $1900, the execution address $8023, the
length $05CD (1,485 bytes) and the start sector $51 (81). Byte 6 is $CC:
bits 0–1 are 0 (start sector below 256), bits 2–3 are 3 (load address high bits), bits 4–5 are 0, bits 6–7 are 3 (execution
address high bits). With both high bits set an address is shown as &FFFF1900, which tools take to mean an
address in the host machine when a second processor is attached. Saved BASIC programs on these discs carry $8023 (some $801F) as their execution address,
an address in the paged ROM area where BASIC lives.
Order of the entries
On the twelve real discs the entries run from the file at the highest sector down to the file at the lowest: the file written last is the first entry. A disc written by another tool may order them differently; the viewer lists them in the order it finds them.
Watford DFS
Watford's DFS added a second catalogue in sectors 2 and 3 for up to 62 files. A disc that has one starts sector 2 with
eight $AA bytes. The viewer notices the marker and says so, but does not read the extra entries.
What the viewer checks
- the entry count byte is a multiple of 8 and at most 248;
- the number of sectors is at least 2 (and at most 800 for the viewer to take the file for DFS when it has no
.ssdor.dsdname); - every file starts at sector 2 or later and ends within the sectors the catalogue says the disc has;
- no two files share a sector;
- names are printable ASCII.
A disc that fails the first two checks has its entries left unread: they would only be noise.