A DFS disc is single density (FM): 10 sectors of 256 bytes on each track, 2,560 bytes a track, on 40 or 80 tracks and one or two sides. The images hold only the sector data, in order; they have no sector headers, no CRCs and no gaps, so a disc with deliberately damaged sectors (some copy protection) cannot be stored in them.
Single-sided order (.ssd)
Sector n of the side, with n counted from 0 on track 0, is at byte offset n × 256.
Track t, sector s is n = t × 10 + s. Sector numbers in the catalogue (the start
sector of a file, the number of sectors) count this way.
Double-sided order (.dsd)
The two sides are stored track by track: side 0 track 0, side 1 track 0, side 0 track 1, side 1 track 1, and so on. Sector n of side d is at
((⌊n ÷ 10⌋ × 2 + d) × 10 + n mod 10) × 256
For example sector 34 of side 1 is track 3, sector 4, at (3 × 2 + 1) × 2,560 + 4 × 256 = 18,944. Each
side is a complete DFS disc: it has its own catalogue (side 0's at offset 0, side 1's at 2,560), its own title, its
own files and its own count of sectors. A file never crosses to the other side, but a file longer than one track
leaves the image's file order, because the other side's track lies between its tracks: its sectors are not
contiguous in a .dsd. The explorer follows the sector numbers, not the file offsets.
This is the order the jsbeeb emulator's loader builds the tracks in (side 0 then side 1 for each track), and the order the two real .dsd images with a DFS catalogue on each side on this Mac use (their side 1 catalogues are where this order puts them). A double-sided image with side 0 entirely first (sequential) may exist; it is not offered as a layout.
Image sizes
| Bytes | Tracks in the file | Reading |
|---|---|---|
| 102,400 | 40 | .ssd of a 40-track side |
| 204,800 | 80 (or 40 on two sides) | .ssd of an 80-track side, or .dsd of 40 tracks: the extension and the sector count in the catalogue tell them apart |
| 409,600 | 80 on two sides | .dsd of 80 tracks |
When the file name has no .ssd or .dsd, the viewer takes a file whose catalogue says 400 or 800 sectors as DFS, and reads a 204,800-byte file with a catalogue of 800 sectors as one side, with a catalogue of 400 as two sides of 40 tracks.
Short images
Disc images are often cut after the last used track. Games.ssd in the BeebEm folder is 64,000 bytes, 25
tracks, and its catalogue says 800 sectors; Assembly_Language_Programming_Exercises.ssd is 22,272 bytes. The
viewer shows the missing sectors as outlines in the picture, does not count them as an error, and reports a file only when
some of its own bytes are missing. jsbeeb fills a short image with zeros when it loads it.
Discs that are not DFS
The extensions are also used for discs of other filing systems that happen to be in these sector orders. Three real
examples: the two Torch .dsd images in the BeebEm folder and the demo disc SDIGUS.DSD do not read
as DFS (a count byte that is not a multiple of 8, or a catalogue of 0 sectors); the viewer opens them as sectors only
and says why. The Acorn CP/M disc CPM_Utilities_Disc.dsd does read as DFS: each side holds one file of
204,288 bytes, $.CPMDISC, that fills the side. What is inside that file is not read.
The ADFS images (.adf, .adl and the .img files of the BBC Master 512) are another
filing system and are not read here.