What the catalogue says about a file is all there is: a name, three numbers and a place on the disc. This page is how the viewer turns that into the file's bytes and into something it can show.
Reading a file
A file is the run of whole sectors that starts at its start sector: sector start up to sector start + ⌈length ÷ 256⌉ − 1 of its side (see geometry for where a sector is). The last sector is only partly used: the file's length says how many bytes. There is no chain and no allocation table: a file is contiguous, and what is free is whatever the files do not cover. The viewer read all 227 files of the twelve real discs this way and compared them with a second reader written for the tests that follows the sector order the jsbeeb loader uses (identical bytes for every file).
Load and execution addresses
The load address is where the BBC's *LOAD puts the file in memory unless a command gives another; the
execution address is where *RUN starts it. The catalogue keeps 18 bits of each. The BBC Micro's own
memory is 16 bits, so the top two bits matter only with a second processor, where both set (&FFFF in
the top half) means the address is in the host machine's memory. The BASIC programs on the real discs here have load addresses such as &1900,
&0800 and &FFFF1900: the catalogue does not say where BASIC's program area starts, and
the file is loaded where its entry says.
The viewer prints these values in the BBC's notation (&1900) in its tables and fields, and in the
$1900 notation of the 6502 pages in the disassembly.
What kind of file it is
A DFS catalogue has no file type. The viewer guesses, and only from the bytes:
| Looks like | When | Opens as |
|---|---|---|
| BASIC | the bytes read as a tokenised BASIC program from the first $0D to a $0D $FF end | a listing |
| text | every byte is a printable character, tab, carriage return or line feed (the BBC ends a line with $0D, and some text has a $0A too) | text, with a second entry for the raw bytes |
| code | anything else: machine code or data, shown disassembled at the load address with the execution address marked | the BBC file viewer |
The execution address is not used to decide: $8023 and $801F are what saved BASIC programs
carry in the real discs seen, but a program that carries something else is still BASIC if its bytes are. A file of one
or two bytes can be mistaken either way.
Locked files
Bit 7 of the directory character is the locked flag: *DELETE and saving over the file are refused while it is
set. The viewer shows it as L in the files table and in the name entry.
.INF sidecars
A file taken out of a disc by a disc tool has lost its catalogue entry. Many tools keep it in a small text file beside the
extracted file, with the same name and the extension .inf: a line holding the file's name (with the directory
character), then its load address, execution address and length in hexadecimal, and often a locked marker. The form
varies between tools. It is not part of the disc image and the explorer does not need one: the viewer names each file it
opens with its two addresses instead, for example $.PROG [L1900 X8023].bbc, which the
BBC file viewer reads back as the load and execution address.
Limits
A side has at most 31 files. The sector count has 10 bits, but the discs seen all say 400 or 800. A file can be up to 256 KB long by the 18-bit length, far more than a disc holds. Names have 7 characters and one directory letter.