The Fdio Project

Why and how

It is hard to imagine, but there was a time before the IBM PC. And even in the early years of the PC, by far not every system immediately adapted to the IBM standards. In fact, most vintage systems defined their own standards, so the early days of computing were determined by a much higher degree of heterogenity, than it is today.

One important objective of standards is to ensure interoperability, and interoperability between computer systems generally means using the same media, the same information structure, and the same semantics. In the era of the HP 9845, the floppy disc already was the most important medium for data interchange on desktop level. Paper tapes and cards had their best times already behind them, and the mini tape cartridge was an indeed low cost alternative for local mass storage, but not really designed for interoperability with other systems. Fortunately, the floppy disc already had been standardized in form factor and magnetic characteristics, so from 3.5" up to 8" floppies the medium could be used in each floppy drive, provided that the form factor of medium and drive was the same.

Yet the information structure was not standardized at all. There had been industry standards like the IBM 8" format, but in principle, even the low level data encoding wasn't standardized. In addition, head count, cylinder count, sector count and sector size differed from system to system, which makes it sometimes really hard to gain access to vintage media on a modern standard PC.

Nevertheless, assumed you do own a PC with a floppy drive of the right form factor, there is in principle a good chance that the drive may read (and sometimes even write) those vintage media. Consider that a normal drive isn't much more than a spinning motor, a movable read/write head and some electronics to encode and decode the signals from the magnetic head to/from digital bits, even a modern floppy disc drive is theoretically capable of accessing the information stored on old floppy discs. Provided you tell the drive in detail what to do.

Exactly this is the problem with DOS, Windows and even Linux. There is a defined set of supported recording formats, and everything else will overburden the standard OS floppy drivers. The solution is on-hand, the floppy controller has to be programmed directly without the support of the OS drivers. This is exactly what the Fdio program does, it talks directly to the standard PC floppy controllers and tells them what to do in order to read or write vintage floppy discs.

I could have implemented another Windows floppy driver, but due to the complexity of this approach I chose to simply develop a console program which does the job. Since direct device access without a driver is somewhat tricky under NT based Windows versions, I decided to use a special low-level controller driver developed by Simon Owen for this task. The FDRAWCMD package is a real good thing, and it is freely available.

Although handling 9845 and LIF floppies was the main reason to develop Fdio, its use is by far not limited to those formats. Fdio is quite generic, supports both FM and MFM encoding, and can be tuned for almost everything which can be handled physically by a standard floppy disc drive. However, not every standard floppy disc drive is physically able to read everything. Sometimes the tolerances are different, and either the error rates get high or the drive can't synchronize to the medium at all. In such cases, the only solution might be to connect a good old single density floppy disc drive, or even to use the original vintage drives and find another way how to transfer the data to and from a PC.

HP Floppy Disc Formats

In principal, the HP 9845 just supports three different floppy disc formats, that of the 9885, that of the 9895A floppy disc drive, and single-sided IBM 3740 media. All form factors are 8" (5.25" drives were invented in the mid-seventies, but were not yet considered as an alternative at the design time of the 9845). So for gaining access to a standard HP 9845 floppy disc, you'll need an 8" floppy drive for your PC.

Actually, since I personally don't own one, I just can hope that Fdio works with those 8" drives, but I never tried. So some feedback would be great.

Floppy disc support can be extended for the HP 9845 by installing an admittedly rare option ROM from Structured Software Systems. With such an option ROM installed, the 9845 can use any AMIGO based floppy disc drive, including those with 5.25" and 3.5" form factor. The media produced with this combination can generally be handled by the Fdio program.

The later HP 9000 series 200 systems had built-in 5.25" floppy disc drives which used the same format as the 82901 external floppy disc drives. The first drives which could handle 3.5" floppy discs were the 9121 external floppy disc drives. Later the 9122 floppy disc drives supported the 3.5" DD and HD formats, but already used the SS/80 command set. Generally, for LIF floppy discs HP mainly used the 5.25" and the 3.5" form factors. All those discs can be handled with Fdio.

All HP floppy discs (at least until the entry in the PC compatibles) use a sector size of 256 bytes. The formats are summarized in the following table:

Drive 9885 9895 IBM 3740 82901 9121 9122D/S 9122C
Form Factor 8" 8" 8" 5.25" 3.5" 3.5" 3.5"
Track Density -- -- -- low high high high
Capacity 502.5 1,155 kBytes 240.5 kBytes 280 kBytes 280 kBytes 616 kBytes 1,232 kBytes
Cylinders 67 77 74 35 70 77 77
Heads 1 2 1 2 1 2 2
Sectors 30 30 26 16 16 16 32
Start Sector 0 0 ?? 0 0 0 0
Sector Size 256 256 128 256 256 256 256
Data Rate ?? ?? ?? 500 kbps 250 kbps 250 kbps 500 kbps
GAP3 (access/format) ?? ?? ?? 27/84 32/50 32/50 14/54
SR/HUT ?? ?? ?? 0xdf 0xdf 0xdf 0xdf
Interleave (default) 5:1 7:1 ?? 2:1 2:1 2:1 2:1
Head Skew -- ?? ?? 2 -- 2 2
Cylinder Skew 5 ?? ?? 2 4 4 4
Encoding M2FM M2FM FM MFM MFM MFM MFM

DOS Floppy Disc Formats

Just for comparison, here are the characteristics for common DOS floppy disc formats:

Drive
3.5"
5.25"
DS/DD DS/HD DS/ED SS/DD SS/DD DS/DD DS/DD DS/HD
Form Factor 3.5" 3.5" 3.5" 5.25" 5.25" 5.25" 5.25" 5.25"
Track Density low high high low low low low high
Capacity (kBytes) 720 1,440 2,880 160 180 320 360 1,200
Cylinders 80 80 80 40 40 40 40 80
Heads 2 2 2 1 1 2 2 2
Sectors 9 18 36 8 9 8 9 15
Start Sector 1 1 1 1 1 1 1 1
Sector Size (bytes) 512 512 512 512 512 512 512 512
Data Rate (kbps) 250 500 1,000 300 300 300 300 500
GAP3 (access/format) 27/80 27/108 27/83 42/80 42/80 42/80 42/80 27/84
SR/HUT 0xdf 0xdf 0xdf 0xdf 0xdf 0xdf 0xdf 0xdf
Interleave 1:1 1:1 1:1 1:1 1:1 1:1 1:1 1:1
Head Skew 0 0 0 -- -- 0 0 0
Cylinder Skew 0 0 0 0 0 0 0 0
Encoding MFM MFM MFM MFM MFM MFM MFM MFM

The Fdio Utility

Fdio just handles the raw sector data and doesn't care about any file system information. The main job for Fdio is to save the low-level floppy data into binary image files and, in turn, restore original floppy disc media from binary images. Besides, Fdio provides typical media operations like formatting, duplication and diagnostics. Finally, Fdio has the ability to perform a deeper analysis of unknown media in order to determine the medium characteristics.

All functions have been implemented into one single executable, which runs as a console application under all WIN32 versions from Windows 95 up to Windows Vista. For direct floppy access under Windows NT/2000/XP/Vista the free FDRAWCMD driver package must be installed (the package was developed by Simon Owen and is included in the distribution packages which can be downloaded below, more information about the FDRAWCMD driver can be found here).

Fdio can be executed in the form

fdio <command> [<options>] [<parameters>]

Below is a summary of all commands. Execute Fdio with the -h option for a summary. Also have a look into the README file for up-to-date information.

Command Description
-format <drive> Low level formats a floppy disc.
-dup <source> <target>

Sector-by-sector copy from <source> to <target>. <source> and <target> can either be drives or images. Can be used to duplicates media, to create images from media or to restore media from images.

Normally, duplication works with ordered sectors, i.e. the sector data is arranged in the sequence of the sector IDs. It can be switched to reading raw track data with the -raw option.

The duplication range can be limited with the -r option.

-verify <drive> Performs a sector-by-sector read verify on the floppy disc. All data on the disc will be preserved.
-info <drive>

Report the medium type (only works if there is already a preset for the medium, see the -preset command below).

Note that the reported data reflects only the most likely preset, not the actual characteristics of the medium. Use the -analyze option for a comprehensive check of the medium characteristics.

-analyze <drive> Performs a detailed medium format analysis in order to determine medium characteristics for own preset definitions. Can be used with any medium.
-describe <drive>

Creates a detailed map of the medium in XML format, including all structural information. Can be used with any medium.

Every cylinder which can be positioned with your floppy drive hardware will be checked, so media with low track density in high density drives may lead to unpredictable results for non-existent/intermediate tracks.

-preset [<preset>] Shows details about a specific <preset>. If <preset> is omitted, all presets are listed.
-reset Resets the floppy disc controller (can be useful if the controller has been left in an unkown state).
-license Show license information.

Most commands can be tailored with one or more options. Below is a summary of all available options. Again, execute Fdio with the -h option for a summary. Also have a look into the README file for up-to-date information.

Option Description
-h Output a summary of the command line options.
-d <drive>

Specify the drive type which is used in the operation (overrides BIOS settings).

<drive> is one of

PC180 (5.25" 180K)
PC320 (5.25" 320K)
PC360 (5.25" 360K)
PC720 (3.5" 720K)
PC1200 (5.25" 1.2M)
PC1440 (3.5" 1.44M)
PC2880 (3.5" 2.88M)
PC8SD (8" Single Density)
PC8HD (8" High Density)

Can be useful in case your OS or BIOS reports wrong drive types or the OS doesn't detect a connected drive. This setting is valid for any drive used in the operation. So, if you for example are using the -dup command to copy from one drive to another, the selection applies to both drives.

-l <loglevel>

Specifies detail of HPDir's reporting. Possible values are
0 (=silent operation, no output except errors),
1 (=output errors and warnings only),
2 (=like 1 plus some basic information - this is the normal mode),
3 (=like 2 plus detailed logging of all floppy disc activity),
4 (=like 3 plus verbose reporting of some data which passes the floppy disc controller)

Loglevel 4 applies to direct controller action only (available under Windows 9x/ME). Also, for reliability reasons, no output will be generated for burst transfers due to timing restrictions (the output would disturb the contiuous transfer of disc data).

Controller communication can't be tracked with the FDRAWCMD driver.

-p <preset> Use a predefined preset instead of the default (see the -preset command above)
-g <c,h,s,size> Specify the disc geometry for known media (overrides any autodetection) with the following parameters:

c: cylinders per disc
h: heads per disc
s: sectors per track
size: sector size in bytes

-i <interleave> Specifiy the n:1 interleave factor (overrides autodetection).
-s <headskew> <cylskew> Specify head and cylinder skew (overrides autodetection).
-r <first> <last>

Specify a range for dup. <first> denotes the first 256-byte-block (starting at 0), <last> the last 256-byte-block (inclusively). If the sector size is higher than 256 bytes, partial sector copy is possible.

As an example, if you need to copy the second and third sector from a disc in <drive> with sector size of 512 bytes into <file>, use

fdio -dup -r 2 5 <drive> <file>

and only blocks 2, 3, 4 and 5 (covering the second and third 512-byte sector) will be copied.

-raw Use raw track access mode for dup (read only). In this mode, the sector ID is ignored and the sector data is just read in the order they are placed on the track, including any junk sectors.
-v Show version info.
-license Show license info.

 

There are several often-used presets for different vintage floppy formats built into the Fdio utility which are used for autodetecting the floppy format. Execute 'fdio -preset' to show the supported presets. If you like to add some more, simply create a config file with the name fdc.ini. There is a sample file fdc_example.ini included in the distribution. Executing 'fdio -analyze <drive_number>:' will help you finding the right parameters for unknown media.

How Fdio Works

As mentioned above, the main objective of the Fdio program is to recover data from non-standard floppy disc media in proper sequence. It is not the aim of this program to register all structural information of the media (e.g. for exact recon- struction of the original disc). Use programs like Teledisc for this purpose. On the other side, you in general can't use tools like Teledisc for extracting the original payload data.

The Fdio model assumes a uniform drive geometry and uses the first track as master. Any track which deviates from the first sector (e.g. in sector count or modulation) is treated as 'junk' in order to separate valid payload data from other information, which is of no use for storing information data. So, if the original format uses different modes/geometries for different tracks, this can't be handled by Fdio. This differs from other solutions, which are dealing on sector level and in general don't care about what data is usable and what is used for copy protection or simply junk (e.g. from previous formatting).

In normal mode, the first thing Fdio does before any operation is to get the floppy drive data from the operating system. Since it is technically not possible to determine reliably whether a drive is connected and which are the form factor and the capabilities of the drive, we rely on the data once specified by the user in the system BIOS. In case the drives are not reported correctly by the OS or BIOS, you can use the -d option to specify the type of drive installed on your own.

For read, write and verify operations, Fdio next tries to detect the proper medium characteristics. To do it quick, Fdio tries to read the first track with all medium presets matching the form factor in the order they are listed with the -presets command. The first working preset is then used for any further read or write operation. In case you need to use another preset, use the -p option to select your own or one of the -g, -i or -s options to override the detected settings. If you are always using the same preset, simply disable auto-detect in the fdc.ini file by using the 'preset=' directive.

Once the proper medium parameters are set, Fdio reads or writes all valid sectors in the proper order to/from other drives or image files, ignoring everything else. So images represent the net payload data stored on the medium, without any structural information.

Depending on the Windows version, Fdio can either go directly on the floppy controller, or can use the FDRAWCMD driver for low-level floppy access. Both methods have their advantages and disadvantages.

Direct controller access gives most control over the hardware, but works under Windows 9x and ME only, since the NT driver model protects the low-level hardware. Fdio does not use DMA for direct controller access, so for making sure the critical part of the data transfers from the controller to the host is not disturbed by any user or program action, Windows interrupts will be partly disabled, as you can recognize by short 'freezed' mouse movement. In general this should not be an issue, since control is quickly passed back to the host, however if the floppy controller gets locked up for any reason, it can happen that Windows gets stuck, too.

In fact I am convinced Simon Owen did a real good job with his FDRAWCMD driver package, so I encourage to use this way as the first choice.

Analyzing Media

The presets provided with the Fdio program cover the common DOS formats plus the formats used with vintage HP floppy drives (mostly used with the LIF file system). This is OK for the context of this site, however you may like to use Fdio with some other formats. Also, the provided presets may fail even on expected DOS or LIF discs, for whatever reason.

If you know the characteristics of the disc format you are using, you can create your own presets and add them to the fdc.ini file. Fdio also provides some kind of analysis for unknown media in order to let Fdio determine those characteristics for you. Simply run Fdio with

fdio -analyze <drive>

and Fdio with do a sophisticated check of the medium, providing you with the preset data you need. Take into account that even this kind of analysis has its limits. Fdio still assumes a uniform geometry and the same encoding (FM/MFM) all over the floppy disc, and not all tracks are completely analyzed (Fdio does a probe check in three dimensions - sectors, heads and tracks, and therefore does its job quite fast but does not check all sectors of the medium). Also, floppy media still can hold data from previous formatting, which differs from the current format. Copy protection mechanisms can make it even harder to get some meaningful information about the disc. Alltogether, Fdio does its best to provide you with the data needed for working with the disc, but it may fail anyway.

If you need a complete map of the medium, with all sectors and tracks, use the -describe command:

fdio -describe <drive>

Fdio then creates a list of all tracks with a comprehensive description of all structural information in the following notation:

<cylinder num=...>
    <head num=...>
        <sector ... />
        <sector ... />
        ...
    </head>
    <head num=...>
        <sector ... />
        ...
    </head>
    ...
</cylinder>

This can be helpful for fault analysis in case the -analyze option does not lead to usable results. When using Fdio with the FDRAWCMD driver under Windows NT/2000/XP/Vista, the results however can be somewhat strange for discs with low density tracks (40 tracks per side and less).

Downloads

Click here for downloading Fdio:

Fdio 2.1 Windows 9x/ME/NT/2000/XP/Vista executable: fdio-21.zip

This version may still have a bugs. Please use the contact feature to let me know if something doesn't work as expected.

Troubleshooting

See the README included in the Fdio package for troubleshooting procedures.