ibm
====
## Generic PC 3.5"/5.25" disks
<!-- This file is automatically generated. Do not edit. -->

IBM scheme disks are _the_ most common disk format, ever. They're used by a
huge variety of different systems, and they come in a huge variety of different
forms, but they're all fundamentally the same: either FM or MFM, either single-
or double-sided, with distinct sector header and data records and no sector
metadata. Systems which use IBM scheme disks include but are not limited to:

  - IBM PCs (naturally)
  - Atari ST
  - late era Apple machines
  - Acorn machines
  - the TRS-80
  - late era Commodore machines (the 1571 and so on)
  - most CP/M machines
  - NEC PC-88 series
  - NEC PC-98 series
  - Sharp X68000
  - Fujitsu FM Towns
  - VAX & PDP-11
  - etc

FluxEngine supports reading these. However, some variants are more peculiar
than others, and as a result there are specific decoders which set the defaults
correctly for certain formats (for example: on PC disks the sector numbers
start from 1, but on Acorn disks they start from 0). The IBM decoder described
here is the generic one, and is suited for 'conventional' PC disks. While you
can read all the variant formats with it if you use the right set of arguments,
it's easier to use the specific decoder.

There is a generic decoder which should adjust automatically to whichever disk
format you are using, but it's unreliable and not recommended. This format
should also be used if you are writing images such as DIM which specify the
image format. FluxEngine will use these parameters.

## Options

  - Format variants:
      - `auto`: try to autodetect the format (unreliable)
      - `160`: 160kB 5.25" 40-track 8-sector SSDD
      - `180`: 180kB 5.25" 40-track 9-sector SSDD
      - `320`: 320kB 5.25" 40-track 8-sector DSDD
      - `360`: 360kB 5.25" 40-track 9-sector DSDD
      - `720_96`: 720kB 5.25" 80-track 9-sector DSDD
      - `720_135`: 720kB 3.5" 80-track 9-sector DSDD
      - `1200`: 1200kB 5.25" 80-track 15-sector DSHD
      - `1232`: 1232kB 5.25" 77-track 8-sector DSHD
      - `1440`: 1440kB 3.5" 80-track 18-sector DSHD
      - `1680`: 1680kB 3.5" 80-track 21-sector DSHD; DMF

## Examples

To read:

  - `fluxengine read ibm --auto -s drive:0 -o ibm.img`
  - `fluxengine read ibm --160 -s drive:0 -o ibm.img`
  - `fluxengine read ibm --180 -s drive:0 -o ibm.img`
  - `fluxengine read ibm --320 -s drive:0 -o ibm.img`
  - `fluxengine read ibm --360 -s drive:0 -o ibm.img`
  - `fluxengine read ibm --720_96 -s drive:0 -o ibm.img`
  - `fluxengine read ibm --720_135 -s drive:0 -o ibm.img`
  - `fluxengine read ibm --1200 -s drive:0 -o ibm.img`
  - `fluxengine read ibm --1232 -s drive:0 -o ibm.img`
  - `fluxengine read ibm --1440 -s drive:0 -o ibm.img`
  - `fluxengine read ibm --1680 -s drive:0 -o ibm.img`

To write:

  - `fluxengine write ibm --160 -d drive:0 -i ibm.img`
  - `fluxengine write ibm --180 -d drive:0 -i ibm.img`
  - `fluxengine write ibm --320 -d drive:0 -i ibm.img`
  - `fluxengine write ibm --360 -d drive:0 -i ibm.img`
  - `fluxengine write ibm --720_96 -d drive:0 -i ibm.img`
  - `fluxengine write ibm --720_135 -d drive:0 -i ibm.img`
  - `fluxengine write ibm --1200 -d drive:0 -i ibm.img`
  - `fluxengine write ibm --1232 -d drive:0 -i ibm.img`
  - `fluxengine write ibm --1440 -d drive:0 -i ibm.img`
  - `fluxengine write ibm --1680 -d drive:0 -i ibm.img`

Mixed-format disks
------------------

Some disks, such as those belonging to early CP/M machines, or N88-Basic disks
(for PC-88 and PC-98), have more than one format on the disk at once. Typically,
the first few tracks will be low-density FM encoded and will be read by the
machine's ROM; those tracks contain new floppy drive handling code capable of
coping with MFM data, and so the rest of the disk will use that, allowing them
to store more data.

FluxEngine can read these fine, but it tends to get a bit confused when it sees
tracks with differing numbers of sectors --- if track 0 has 32 sectors but
track 1 has 16, it will assume that sectors 16..31 are missing on track 1 and
size the image file accordingly. This can be worked around by specifying the
size of each track; see the `eco1` read profile for an example.

N88-Basic format floppies can be written by either specifying the `n88basic`
format, or by using D88 or NFD format images which include explicit sector
layout information.

Writing other formats can be made to work too, by creating a custom format
specifier, using the `n88basic` format as an example.
Please [get in touch](https://github.com/davidgiven/fluxengine/issues/new) if
you have specific requirements.

360rpm 3.5" disks
-----------------

Japanese PCs (NEC PC-98, Sharp X68000, Fujitsu FM Towns) spin their floppy
drives at 360rpm rather than the more typical 300rpm. This was done in order
to be fully backwards compatible with 5.25" disks, while using the exact
same floppy controller. Later models of the PC-9821, as well as most USB floppy
drives, feature "tri-mode" support which in addition to normal 300rpm modes,
can change their speed to read and write 360rpm DD and HD disks.

Neither the FluxEngine or Greaseweazle hardware can currently command a
tri-mode drive to spin at 360rpm. However on both devices the FluxEngine
software is capable of both reading and writing 300rpm disks at 360rpm and vice
versa, so it shouldn't matter.

