shortname: 'Amiga'
comment: '880kB 3.5" DSDD'
read_support_status: UNICORN
write_support_status: UNICORN

documentation:
<<<
Amiga disks use MFM, but don't use IBM scheme. Instead, the entire track is
read and written as a unit, with each sector butting up against the previous
one. This saves a lot of space which allows the Amiga to not just store 880kB
on a DD disk, but _also_ allows an extra 16 bytes of metadata per sector.

This metadata is mostly unused, so the default for FluxEngine is to ignore it
and just use the 512 bytes of main sector data. If you want it, specify a
528-byte sector size. The metadata will come after the user data.

Bizarrely, the data in each sector is stored with all the odd bits first, and
then all the even bits. This is tied into the checksum algorithm, which is
distinctly subpar and not particularly good at detecting errors.
>>>

documentation:
<<<
## References

  - [The Amiga Floppy Boot Process and Physical
    Layout](https://wiki.amigaos.net/wiki/Amiga_Floppy_Boot_Process_and_Physical_Layout)

  - [The Amiga Disk File FAQ](http://lclevy.free.fr/adflib/adf_info.html)
>>>

image_reader {
	filename: "amiga.adf"
	type: IMAGETYPE_IMG
}

image_writer {
	filename: "amiga.adf"
	type: IMAGETYPE_IMG
}

layout {
	format_type: FORMATTYPE_80TRACK
	tracks: 80
	sides: 2
	layoutdata {
		sector_size: 512
		physical {
			start_sector: 0
			count: 11
		}
	}
}

encoder {
	amiga {}
}

decoder {
	amiga {}
}

filesystem {
	type: AMIGAFFS
}


option_group {
	comment: "Sector size"

	option {
		name: "without_metadata"
		comment: "512-byte sectors"
		set_by_default: true

		config {
			layout {
				layoutdata {
					sector_size: 512
				}
			}
		}
	}

	option {
		name: "with_metadata"
		comment: "528-byte sectors"
		set_by_default: true

		config {
			layout {
				layoutdata {
					sector_size: 528
				}
			}
		}
	}
}

