Home | Native | Master 512
The following describes the logical structure of ADFS floppy disks for the BBC Computer. (Note that some of the detail in the New Advanced User Guide is incomplete or wrong.)
ADFS files have names of up to 10 characters. There is a hierarchical directory structure. As always on BBC filing systems, the root directory is called "$". Sub-directories, like files, have names of up to 10 characters. A directory can hold up to 47 entries (files or sub-directories).
Every file has associated with it a "Load address" and an "Execution address". There are also four attributes: "W", "R", "L" and "E", meaning "Write enable", "Read enable", "Locked" and "Execute only".
In addition, a "cycle number" is kept for each entry in each directory. This is a number kept within each directory. It is incremented, and is stored with the appropriate item, each time one is modified. The cycle numbers are displayed by *CAT, and they give an indication of which files in a directory have been modified most recently, but otherwise they serve no useful purpose.
There are three sizes of disks: Small (160k), Medium (320k) and Large (640k). "Small" means single-sided 40-track disks, "Medium" single-sided 80-track, "Large" double-sided 80-track. (The ADFS system does not cater for double-sided 40-track disks.)
Each disk has a "boot option", a number between 0 and 3 indicating the action to be taken when the disk is booted using Shift/Break.
Note that here BBC terminology is used for number formats, i.e. hex numbers are preceded with an "&".
ADFS disks are recorded using double-density. They have a sector size of 256 bytes, with 16 sectors per track, numbered on each track from 0 to &F. Logically the sectors on the disk should be considered as a single sequence, starting at logical sector 0, incremented in the order: sector - track - side. (So first are the sectors on side 0, track 0, then side 0, track 1, etc. For "Large" disks (which use two sides) side 0, track 79 is followed by side 1, track 0.) The data is divided into three areas. All are made of whole numbers of sectors, and they occur in the following order:
There are no gaps between the sections, so the data area starts at sector number 7. Note: In all that follows multi-byte numbers are always stored low byte first. Sector numbers, etc, in fact never exceed two bytes for floppy disks, but three bytes are allowed to cater for hard disks. |
Items (files and sub-directories) are stored in ADFS as contiguous pieces of data. They cannot be broken up into sections occupying different parts of the disk. However the system needs to keep track of which sectors are in use, and this is done by means of the "Free Space Map" (or "FS Map"). The FS Map provides a list of those sectors which are not currently in use. They are listed as blocks of sectors, with starting sector and size of free block. There are a few other items stored in this area as well. In detail the map is laid out: Sector 0
Sector 1
|
Each directory is stored as a block of 5 sectors, i.e. &500 bytes. The root directory takes up sectors 2 to 6, others are elsewhere on the disk. A block of data is a sub-directory (rather than a file) if the top bit is set in byte 3 of its own entry in its parent directory. There are also identifiers within the structure, in particular the directory identifier string stored twice at location offsets 1 and &4FB The overall layout is as follows (a few items are not relevant for the root directory):
Each directory entry takes up 26 (&1A) bytes, and has the following format:
Note that sub-directory entries have load and execution addresses both set to 0, and file length set to &500. |
Characters in file and directory names must be standard ASCII (values between &21 and &7E - "top bit set" characters are not allowed, and various other characters (such as ".") will confuse the system so should not be used). The names are terminated with &D or a zero byte, unless they fill the whole space allocated to them. The top bits of the first five bytes of the name (extending beyond the end of the name if it is shorter than 5 characters) are used for attributes as follows. In each case the attribute is set if the bit is 1, clear if it is 0.
|
A sub-directory is a data item like a file, the only difference being that the "directory" bit (top bit of byte 3) is set in its own directory entry. The structure of a sub-directory is exactly the same as the root directory. |
The file data and sub-directory entries are stored on the rest of the disk, starting at Sector 7. |
Home | Native | Master 512