An ADF is the 512-byte blocks of an Amiga floppy, one after another, with no header. Its contents are the AmigaDOS file system, OFS or FFS. Commodore never published a formal specification of the disk layout; this page follows Laurent Clévy’s The ADF File Format, kept by the ADFlib project, which is the standard description. All numbers are big-endian 32-bit (“longs”) unless stated.
Geometry
| Double density (DD) | High density (HD) | |
|---|---|---|
| Cylinders × heads | 80 × 2 | 80 × 2 |
| Sectors per track | 11 | 22 |
| Blocks | 1,760 (0–1759) | 3,520 (0–3519) |
| File size | 901,120 bytes | 1,802,240 bytes |
| Root block | 880 | 1,760 |
Block n is at byte n × 512. Blocks run sector by sector along a track, then the other side, then the next cylinder. In general the root block is (reserved blocks + highest block) ÷ 2, with 2 reserved blocks on a floppy.
Boot block
Blocks 0 and 1, 1,024 bytes.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
0x00 | 3 | text | Disk type | DOS for an AmigaDOS disk. (PFS or other letters mean another file system.) |
0x03 | 1 | bits | Flags | Which variant of AmigaDOS: see DOS types. |
0x04 | 4 | uint32 | Checksum | See checksums. A bootable disk needs it correct. |
0x08 | 4 | uint32 | Root block | 880. (Written as 880 on HD disks too, though their root is at 1,760.) |
0x0C | 1012 | code | Boot code | 68000 code run at start-up if the disk is bootable; zeros otherwise. |
| Flags | Shown as | File system |
|---|---|---|
| 0 | DOS\0 | OFS, the original file system |
| 1 | DOS\1 | FFS, the fast file system |
| 2 | DOS\2 | OFS with international mode (case folding of accented letters) |
| 3 | DOS\3 | FFS with international mode |
| 4 | DOS\4 | OFS with directory cache (and international mode) |
| 5 | DOS\5 | FFS with directory cache (and international mode) |
| 6, 7 | DOS\6, DOS\7 | Not described by the ADF document; their meaning is not covered here |
Bit 0 selects FFS, bit 1 international mode, bit 2 the directory cache, which implies international mode even though bit 1 is then clear.
Root block
The top-level directory and the volume’s name and dates. Offsets are for 512-byte blocks.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
0x000 | 4 | int32 | type | 2 (T_HEADER). |
0x004 | 4 | int32 | header_key | 0. |
0x008 | 4 | int32 | high_seq | 0. |
0x00C | 4 | int32 | ht_size | Hash table size: 72 (block size ÷ 4 − 56). |
0x010 | 4 | int32 | first_data | 0. |
0x014 | 4 | int32 | chksum | Block checksum. |
0x018 | 288 | int32 × 72 | ht | Hash table: block numbers of the first file or directory in each hash slot; 0 empty. See hashing. |
0x138 | 4 | int32 | bm_flag | −1 when the bitmap is valid. |
0x13C | 100 | int32 × 25 | bm_pages | Block numbers of the bitmap blocks; a floppy needs only the first. |
0x1A0 | 4 | int32 | bm_ext | First bitmap extension block (large hard disk partitions only); 0 otherwise. |
0x1A4 | 12 | date | r_days, r_mins, r_ticks | When the root directory last changed. See dates. |
0x1B0 | 1 | uint8 | name_len | Length of the volume name, at most 30. |
0x1B1 | 30 | text | diskname | The volume name (no / or :). |
0x1CF | 9 | – | Unused | 0. |
0x1D8 | 12 | date | v_days, v_mins, v_ticks | When the volume last changed. |
0x1E4 | 12 | date | c_days, c_mins, c_ticks | When the volume was created (formatted). |
0x1F0 | 4 | int32 | next_hash | 0. |
0x1F4 | 4 | int32 | parent_dir | 0. |
0x1F8 | 4 | int32 | extension | With the directory cache: the first cache block; 0 otherwise. |
0x1FC | 4 | int32 | sec_type | 1 (ST_ROOT). |
Bitmap
One bit per block, saying whether it is free. On a DD floppy one bitmap block covers blocks 2 to 1,759 (1,758 bits); it is usually block 881.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
0x000 | 4 | int32 | Checksum | The block checksum, here at offset 0. |
0x004 | 508 | int32 × 127 | Map | Bit set: block free; clear: block in use. Bit 0 (least significant) of the first long is the first block after the reserved ones (block 2), then upwards. |
A bitmap extension block (hard disks) holds 127 more bitmap block numbers and, in its last long, the next extension block (0 for the last). It has no checksum or type.
Checksums
- Boot block: set the checksum to 0; add the 256 longs of the 1,024 bytes, adding any carry out of bit 31 back in at bit 0; the checksum is the bitwise NOT of the result.
- Every other block (root, headers, extensions, OFS data, link and cache blocks, bitmap): set the checksum to 0; add the 128 longs, ignoring overflow; the checksum is the negative of the sum, so that the block then sums to 0.
Dates
Every date is three longs: days since 1 January 1978, mins
since midnight (0–1,439) and ticks of 1/50 second since the minute
(0–2,999). The time is the Amiga’s local time; no time zone is stored.
Example
00000000 44 4F 53 01 BB B0 A9 8E 00 00 03 70 00 00 00 00 DOS........p....
Reading it: DOS with flags 1, FFS; root block 0x370, 880;
no boot code. With every other long 0, the boot block sum is
0x444F5301 + 0x370 = 0x444F5671, and its bitwise
NOT gives the checksum 0xBBB0A98E. The root block itself is at byte
880 × 512 = 0x6E000.