ADF (Amiga Disk File) Format¶
The ADF format is a sector-by-sector dump of an Amiga-formatted floppy disk, used by emulators and disk imaging tools. This article documents the complete on-disk structure of Amiga filesystems. Source: Laurent Clévy's ADF FAQ v1.13.
File size¶
| Disk type | Blocks | File size |
|---|---|---|
| DD (double density) | 1760 (11×2×80) | 901,120 bytes |
| HD (high density) | 3520 (22×2×80) | 1,802,240 bytes |
Each block is 512 bytes. Block ordering: sectors → sides → cylinders.
Block 0 = sector 0, side 0, cylinder 0
Block 11 = sector 0, side 1, cylinder 0
Block 22 = sector 0, side 0, cylinder 1
...
MFM encoding¶
Amiga floppies use MFM (Modified Frequency Modulation) encoding. Unlike PC floppy controllers (FDC), the Amiga does MFM encoding/decoding in software via the CPU (sometimes assisted by the Blitter). This is why PC floppy drives can't read Amiga disks even though both use MFM — the sync word and sector format differ.
Bootblock (blocks 0-1, 1024 bytes)¶
Offset Size Field Description
0x00 4 DiskType 'D','O','S' + 3 flag bits
0x04 4 Checksum Special bootblock checksum
0x08 4 Rootblock Block number of root (880 for DD)
0x0C 1012 Boot code Optional executable boot code
DiskType flag bits¶
| Value | File system |
|---|---|
| 0 | OFS (Old/Original File System) |
| 1 | FFS (Fast File System) |
| 2 | OFS + International mode |
| 3 | FFS + International mode |
| 4 | OFS + Directory Cache + International |
| 5 | FFS + Directory Cache + International |
If the first 3 bytes are PFS, the disk uses the third-party Professional File System.
OFS vs FFS¶
- OFS data blocks store 488 bytes of user data (512 − 24 byte header).
- FFS data blocks store the full 512 bytes (no header overhead).
- FFS is faster and supports directory caching, links, and international mode.
Bootblock checksum (68000 assembly)¶
lea bootbuffer,a0
move.l a0,a1
clr.l 4(a1) ;clear checksum field
move.w #(BOOTBLOCKSIZE/4)-1,d1
moveq #0,d0
lp: add.l (a0)+,d0 ;accumulate longwords
bcc.s skip
add.l #1,d0 ;add carry back
skip:
dbra d1,lp
not.l d0 ;bitwise complement
move.l d0,4(a1) ;store as checksum
Rootblock (block 880 for DD, 1760 for HD)¶
Located at the physical middle of the disk to minimize average seek time.
Key fields:
| Offset | Size | Field | Description |
|---|---|---|---|
| 0x00 | 4 | type | T_HEADER (2) |
| 0x0C | 4 | ht_size | Hash table size (72 longwords for floppy) |
| 0x14 | 4 | checksum | Rootblock checksum |
| 0x18 | 288 | ht[72] | Hash table — block numbers for root directory entries |
| −0xC8 | 4 | bm_flag | Bitmap flag (−1 = valid) |
| −0xC4 | 100 | bm_pages[25] | Bitmap block pointers |
| −0x5C | 4 | r_days | Last root alteration: days since 1 Jan 1978 |
| −0x58 | 4 | r_mins | Minutes past midnight |
| −0x54 | 4 | r_ticks | Ticks (1/50s) past minute |
| −0x50 | 1 | name_len | Volume name length |
| −0x4F | 30 | diskname | Volume name |
| −0x28 | 12 | v_date | Last disk alteration date |
| −0x1C | 12 | c_date | Filesystem creation date |
| −0x04 | 4 | sec_type | ST_ROOT (1) |
Date format¶
All Amiga dates: days since 1 January 1978, minutes past midnight, ticks (1/50 second). Constraints: 0 ≤ mins < 1440, 0 ≤ ticks < 3000. The Amiga filesystem has no inherent Y2K problem.
Hash table — directory lookup¶
File and directory names are hashed to find their block number:
int HashName(unsigned char *name) {
unsigned long hash = strlen(name);
for (int i = 0; i < strlen(name); i++) {
hash = hash * 13;
hash = hash + toupper(name[i]); /* case insensitive */
hash = hash & 0x7ff;
}
return hash % ((BSIZE/4) - 56); /* 0 <= hash < 72 for floppy */
}
HashTable[hash] gives the first block number. Collisions are resolved by a chained linked list via the next_hash field in each file/directory header block. For example, file_1a, file_24, and file_5u may hash to the same value.
Forbidden characters in names¶
/ and : are forbidden. Allowed: *!@#$%|^+&_()=\-[]{}';",<>.? and accented characters.
File storage¶
Files are stored as a chain of blocks:
- File Header Block — contains filename, size, comment, protection bits, and an array of data block numbers.
- Data Blocks — OFS: 488 bytes data + 24 byte header. FFS: full 512 bytes data.
- Extension Blocks — if the file header can't hold all data block numbers, extension blocks chain additional arrays.
Directory storage¶
Directory blocks have the same structure as the root block but with sec_type = ST_DIR (2) and parent_dir pointing to the parent.
Links¶
- Hard link — points directly to the target's file header block number. Same filesystem only.
- Soft link — stores the path string to the target. Can cross filesystems.
Hard disk structure (Rigid Disk Block)¶
Hard disks start with a Rigid Disk Block (RDB) containing: - Partition table (one or more partitions) - Drive geometry (cylinders, heads, sectors) - Filesystem information - Bad block list - Park cylinder
The RDB is located before the first partition, typically at cylinder 0. Each partition has its own bootblock, rootblock, and bitmap, independent of other partitions.
See Also¶
- AmigaDOS Filesystem On-Disk Structures
- dos.library Reference
- Standard Device Libraries — trackdisk.device
Sources: Laurent Clévy, "The .ADF (Amiga Disk File) format FAQ" v1.13 (2010).
Raw: raw/adf/adf-format-spec.md; raw/rkm/guru-book.md
Updated: 2026-08-08