Acorn, Watford, Solidisk and Duggan DFS Filesystem Structure ============================================================ http://mdfs.net/Docs/Comp/Disk/Format/DFS Acorn System/Atom DOS, Acorn DFS, Watford DFS, Solidisk DFS and Angus Duggan's HDFS share the same basic file structure and each filing system understands a large subset of each filestructure. Single density DFS floppy disks have 10 physical sectors of 256 bytes on each track, numbered from 0 to 9. Double density DFS floppy disks have 18 physical sectors of 256 bytes on each track, numbered from 0 to 17. Tracks are sequential, that is the tracks start at track 0 on one disk of a disk, and continue up the same side of the disk. DFS uses 256-byte logical disk sectors. Logical sectors are counted with 10-bit or 11-bit numbers starting from &000 at the start of the filesystem. Acorn DFSs use 18-bit file lengths and 10-bit sector numbers, so the largest possible DFS disk system is 256K and the largest possible file is 256K-1. Watford DFS, Solidisk DFS and Duggan HDFS use 19-bit file lengths and 11-bit sector numbers, so the largest possible WDFS/SDFS/HDFS disk system is 512K and the largest possible file is 512K-1. Note that WDFS, SDFS and HDFS extend the DFS catalog structure, but put their additional information in different locations. DFS, WDFS and HDFS directories can be distinguished by looking at byte &106 in the catalog: 106: b3=0 b2=0 DFS or WDFS disk up to 256K 106: b3=0 b2=1 WDFS, disk larger than 256K 106: b3=1 b2=0 HDFS, single-sided disk 106: b3=1 b2=1 HDFS, double-sided disk Sector 0,1 ---------- The first two sectors contain the catalog. It contains 32 entries, a header followed by 31 file entries. The entries are split across the two sectors, with the first eight bytes holding the name in sector 0 and the second eight bytes holding the information in sector 1. The catalog is always stored sorted by file sector start address, with highest sector address at the start and lowest address at the end, so the catalog is sorted by decrementing sector number of all entries including the header. HDFS subdirectories and DFS62 multiple catalogs use the same layout. Catalog header, entry 0: Sector 0 Sector 1 000 001 002 003 004 005 006 007 100 101 102 103 104 105 106 107 +---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+ | Disk Title | | DiskTitle |Cyc|Num|Op|Sect| +---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+ File entries, entries 1-31: Sector 0 Sector 1 000 001 002 003 004 005 006 007 100 101 102 103 104 105 106 107 +---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+ | Filename |Dir| | Load | Exec | Size |Op|Sect| +---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+ Catalog header: 000-007 First eight bytes of the disk title, padded with spaces. 100-103 Last four bytes of disk title, padded with space. The disk title is the directory name in HDFS. 104 Disk cycle, HDFS: Key number 105 (Number of catalog entries)*8 - offset to end of directory 106 b7-b6: zero b5-b4: !Boot option (*OPT 4 value) b3: 0=DFS/WDFS, 1=HDFS b2: Total number of sectors b10, HDFS: (number of sides)-1 b1-b0: Total number of sectors b9-b8 107 Total number of sectors b7-b0 HDFS: The total number of sectors b10 is stored in b7 of byte 000. File entries: 000-006 Filename and attributes 007 Directory and attributes 100-101 Load address b0-b15 102-103 Exec address b0-b15 104-105 File length b0-b15 106 b7-b6: Exec address b17-b16, SDDFS: also Load address b17-b16 b5-b4: File length b17-b16 b3-b2: Load address b17-b16 b1-b0: Start sector b9-b8 107 Start sector b7-b0 Solidisk DDFS: byte 106 bit 2 = b10 of Start sector byte 106 bit 3 = b18 of File length File attributes are stored in b7 of bytes 0-7: 000,b7: HDFS: Start sector b10 001,b7: HDFS: File length b18 002,b7: HDFS: unused 003,b7: HDFS: file/directory 004,b7: HDFS: not readable 005,b7: WDFS: File length b18 HDFS: not writable 006,b7: WDFS: Start sector b10 HDFS: not executable 007,b7: All: Locked Sector 2,3 ---------- Watford DFS allows a second 31-entry catalog in sectors 2 and 3. It is identified by the first eight bytes of sector 2 containing &AA: 000-007 Eight bytes of &AA 008-0FF 31 file entries 100-104 Five bytes of &00 105 (Number of catalog entries)*8 - offset to end of directory 106-107 Copy of boot option and disk size in sector 1 108-1FF 31 file info entries Disk Doctor second directory ---------------------------- An entry with name "!.!!!!!!!" which is locked is a Disk Doctor second directory, with the same layout as the first directory. The Disk Doctor *SWAP command swaps the two directories on the disk. Each directory has to refer to its own section of the disk to avoid overwriting objects stored in the other catalog. Notes ----- Some early DFSs allow the user to write disk titles or filenames with bit 7 set. This may cause these entries to appear to erroneously have HDFS or WDFS attributes. Most DFSs disallow top-bit set filenames and disk titles. The Solidisk DDFS extensions have been worked out from Andrew Benham's FUSE DFS module at www.adsb.co.uk/bbc/linux in the absense of any extant documentation, and may be incorrect.