8FORMAT

This is a follow-up to my previous article about connecting old 8″ drives directly to a PC equipped with a classic floppy disk controller. Since there is a way on how to do it on a hardware level without paid or proprietary equipment, there still needs to be a free and available software solution that enables the OS to interface these drives, as they were not officially supported on the PC during its entire history whatsoever. So, during my experiments, I’ve came up with one: 8FORMAT – a small software bundle that’s also released open source.

Since 8 inch drives are vintage and they predate the PC as we know it, my original intent was to experiment with these drives without relying on specialized equipment – an x86 PC with a regular floppy controller, with a makeshift cable and a power supply that feeds the drive, was aimed to be enough to make the drive operational. As such, to keep things simple, an OS was chosen that also runs on vintage equipment with no issues, and can provide down-to-the-bone hardware access without driver hassle. Yes, 8FORMAT is a DOS application. So, what does it do exactly?

Available command-line arguments

Like Dave Dunfield’s ImageDisk (IMD), 8FORMAT is also a multi-purpose DOS application that interfaces the floppy disk controller directly. However, 8FORMAT also tries to persuade the system BIOS to “accept” the drive, so that it can be used directly in DOS – or even Windows (up to 9x/ME). For this to work however, also a FAT filesystem needs to be created on the 8-inch disk, and no DOS utility, including IMD, would do that out of the box. So 8FORMAT was a product of my direct experimentation with these drives under the PC environment, with all of their quirks and pitfalls.
The application has 2 main modes: formatting and using the disk. In the vanilla format mode, 8FORMAT will initialize and format the sectors with the chosen geometry or TYPE. A total of 5 pre-defined geometry types are provided, both the “historical” ones and the “extended”, or experimental ones, to be tried under DOS on an x86 PC. The format and read/write gaps between sectors are auto-set, but can be also tweaked. In addition to that, 8FORMAT can also try writing the DOS boot sector and filesystem, even on a non-512-byte-formatted disk (highly experimental), and it also supports custom floppy disk controllers given their base address, IRQ and DMA settings. Defaultly however, 8FORMAT will only format the disk, and won’t create any filesystems at all.
In the use mode, 8FORMAT will install a resident “driver” that overrides the “Diskette Parameter Table” (DPT, INT 1eh) of the PC BIOS and the INT 13h “get drive type” and geometry calls, forcing any application or OS reliant on the BIOS to work with the 8″ drive, even if the physical sector size is non-standard. This includes most versions of DOS and early versions of Windows that were basically just improved DOS shells (1.01 to 4.x, i.e. 95, 98).
However, due to limitations in the BIOS and how the DPT works, once the driver is installed resident, this 8-inch drive data is applied for all floppy drives – 5,25″ or 3,5″ drives will become non-operational and their system BIOS setting ignored. As such, the 8″ drive cannot coexist (properly) with other standard floppy drives in one machine, or on one floppy controller to be exact. And, for this very same reason, 8FORMAT shall only be launched from a hard drive/RAM drive or similar.
The use mode can be either invoked by calling 8FORMAT with the /USE argument, to start using an 8-inch disk in the drive, and it is also asked at the end of a successful format operation.

Experimenting with a 256-byte physical-sectored 8″ disk under DOS
(invoking the /USE mode)

The command-line arguments might seem a little intimidating, but are quite self-explanatory. One of the main arguments is specifying the TYPE, or geometry and density combo of the disk being formatted. This can be one of the following:

  • the DSSD type, which is a double-sided variant of the “historical” single-density format, with 128 byte sectors and 26 of them per track. Choosing this type requires a floppy controller that supports FM encoding;
  • the DSDD type, which is – again – a historical format, yielding 8 sectors per track, 1024 bytes each, encoded with regular MFM.

These two types were originally used in mainframe and “minicomputer” environments, running CP/M or similar. From the PC perspective, these have a non-standard physical sector size. Although 8FORMAT can make the BIOS recognize these formats, and even try writing a DOS filesystem on them; there are not many applications that use the BIOS disk calls with a physical sector size other than 512 bytes (see the “quirks” below).
In addition to these two “historically standard” formats, there are three “extended” experimental formats that I have came up with, named EXT1 to EXT3. All are encoded with regular MFM:

  • The EXT1 type is a variant of the historic DSDD type, except that it uses 512 byte size per sector. So, instead of eight 1K sectors per track, there are sixteen 512B sectors per track; with the sector gaps reduced slightly to make them fit in a track proper. This type can essentially be called a “DOS-compatible DSDD”, and will safely occupy all the extents of a double-sided, double-density 8-inch floppy disk.
  • The EXT2 type is a double-sided variant of the “SS/DD” diskettes that were used in Tandy TRS-80 Model II and similar rigs: 26 sectors per track, each sector with a size of 256 bytes.
  • And finally, the EXT3 type, which 8FORMAT tries to access like if it was a 5,25″ 360K drive – but with a 500kbps data rate, and with 77 tracks instead of 40, i.e. nine 512-byte sectors per track.

Of course, any of these types can be converted to single-side by specifying /1 as an optional command line argument.
It’s worth noting that only the two 512-byte-sectored formats, EXT1 and EXT3, can be safely used directly under the DOS environment on a PC, because of details that follow below (especially in “Quirk #3”); on an x86 PC, the rest of the formats are for experimentation purposes, mostly when treated as logical formats with a 512-byte geometry (see “Quirk #10”).

Formatting and verifying, to be followed with a FAT filesystem creation

To work with 8″ floppies, a high-density capable floppy disk controller will be required. That is, an FDC that can read and write regular 1,44MB 3,5″ (or 1,2MB 5,25″) disks without any issues. In technical terms, this means that the FDC supports a 500 kbps data transfer at a 500 kilohertz clock rate.
However, to experiment with type DSSD, the FDC as whole (not just the chip itself!) – in addition for being HD capable, shall also support FM data transfers, and 128-byte sectors. And tell you what, not many floppy controllers can do that.
This is because 8″ single-density FM disks, even though they have a practical data rate of 250 kbps, require 2 bits to store each databit, and not just one as with MFM. Using the FM encoding, one clock bit is reserved for synchronization. And for this to work, the PC FDC requires to be set to a “high density” data rate. In addition to that, every 8″ floppy disk controller has had a clock rate fixed at 500 kilohertz, which the “DD-only” PC FDCs won’t do.

Finished formatting, asking the user to install the resident driver

The resident driver part (8TSR.EXE of the software bundle) is invoked by 8FORMAT after specifying the /USE argument, to start using the 8-inch disk in DOS, or directly after a successful format operation, shall the user press ENTER to reflect the new 8-inch geometry. 8FORMAT with /USE shall always be called before the very first 8-inch disk operation with BIOS or DOS, unless the disk was just formatted and ENTER pressed when asked to do so.
This DOS TSR determines the location of the BIOS Diskette Parameter Table (DPT), copies it into a memory location it can write into (if necessary), instructs the BIOS to start using the new 8-inch drive parameters (due to platform limitations, for all floppy drives – sadly), hooks the INT 13h interrupt to start returning the new 8-inch geometry when asked by applications, and also hooks the timer interrupt, that tries to make sure nothing overrides the new 8-inch drive DPT. /NB: This is because in DOS real mode, memory access is unrestricted./
Afterwards, the 8-inch drive can usually be accessed with normal DOS commands, to copy new files, move the other, run applications etc. But, using “specialized” tools that don’t even have the slighest idea about what kind of drive is present in the system (vanilla FORMAT, DISKCOPY, various disk doctors and whatnot) can corrupt the data written on the disk. Remember, 8″ drives were not supported on the PC at all – and the 8FORMAT/8TSR is a hack 🙂

8-inch drive stepper motor timings and disk geometry successfully updated

The last application of the software bundle is TESTREAD.COM. This is a small DOS application that invokes BIOS INT 13h services /the same ones that DOS uses/ to verify reading a couple of sectors off the specified floppy drive, of what size the sectors are, and dumping them to disk. This can be used, for example, together with 8FORMAT /USE to proof-read whether the actual BIOS can read a non-512-byte-sector floppy, even though 99.9% of applications using BIOS calls WILL expect that the PC BIOS always returns a 512 byte floppy buffer. See the “Quirks” below.

Reading 1K sectors with BIOS INT 13h off an 8″ floppy in DOS
(8TSR modifies the BIOS Data Area to accomplish this)

Now come some of the software pitfalls, or “quirks”, of operating an 8-inch drive with a PC; i.e. not just related to the usage of 8FORMAT. Most of the hardware ones, were talked about in the parent article, we’ll go deeper in here with the sofware ones, though.

  • Quirk #1: The Disk Change bus signal:

In the original article, I have written about the necessity of connecting the FDC’s input signal of Disk Change to GND to permanently indicate that the drive is always Ready (=0), and to configure the BIOS with the drive either as Not Installed, or as a 5,25″ 360K drive. 8TSR (8FORMAT /USE) will then do the rest to configure the proper geometry of the 8-inch drive for BIOS.
This is because most 8″ drives won’t provide a reliable Disk Change line (or no such line at all), i.e. the one that is HIGH if a disk was changed in the drive, and goes automatically LOW after a short head seek. The PC BIOS expects this proper behavior of the Disk Change signal on all drives except when configured as a 360K drive. Otherwise, you will be seeing “Not ready” Abort/Retry/Fail errors, and the sort, even if it is permanently set as Ready (signal on GND).
However, if you do have a drive that provides a reliable Disk Change signal, you can configure the BIOS to fake the 8″ drive into a 5,25″ 1,2MB drive, not requiring 8FORMAT/8TSR, and having the possibility of a second floppy drive on same cable.
But, this will not use the full disk geometry as an “8FORMAT EXT1″ would; the 8” disk would be only formatted to some 1.1MB, with 15 sectors per track, instead of full 16; and the last 3 tracks would fail to format properly, since all 8-inch drives are 77 track only /although some will do 78, sometimes with a loud accompanying “CLACK!”/. In a worst-case scenario, actual hardware damage.

  • Quirk #2: BIOS floppy seek during the power-on self test (POST):

This seeking behavior was originally done by BIOSes to distinguish between 80- and 40-track floppy drives, and to give an error message if this did not correspond with what was set in the CMOS NVRAM. The problem here is that the BIOS does this with a stepper motor rate that is very high for an 8-inch drive. This can (and often it will) throw out an 8-inch drive temporarily out of alignment. 8FORMAT can mitigate that behavior though, see ‘Undocumented Commands’ below. However, a safe bet is to disable the seek at boot (if there is an option for that), or keep the power supply of the 8″ drive off during POST, whilst ignoring any errors relating to it.

  • Quirk #3: Fixed 512-byte buffer size for INT 13h floppy services:

Almost all applications designed to work with a PC floppy drive using the BIOS INT 13h services, DOS kernel included, had a hard-coded buffer size of 512 bytes. This is fine if they didn’t consider the fact that you could change this by altering the physical sector size byte in the Diskette Parameter Table. Having this set to 128 or 256 bytes, the rest of the buffer is read or written as unitialized garbage (in the best case, zeros); having this set to 1024 bytes causes a buffer overflow.
As an example, 8FORMAT /USE DSDD (1024-byte sectors) under DOS with a FAT filesystem and doing a DOS operation on the drive will usually crash the DOS kernel. Another example, DOS operations using 8FORMAT with EXT2 (256-byte sectors) will only seem to work properly for a short period of time, as it starts padding the buffer with God knows what. Beware.

  • Quirk #4: The Diskette Parameter Table (DPT):

8FORMAT communicates with the floppy disk controller directly through I/O ports, no problem there. But, it is the task of the resident portion 8TSR to hack-in the 8-inch drive timings and geometry support, for BIOS and anything that is BIOS-reliant, like DOS. However, if the particular BIOS has the mercy of recognition what is in the DPT, is a question of its own. Some “later” BIOSes that only support 1,44MB 3,5″ drives can completely ignore contents of the DPT, and use fast 3,5″ drive stepper timings that will cause seek errors on 8-inch drives. I’ve seen this happen on a Siemens-Nixdorf laptop BIOS. (Connecting an 8inch drive to a laptop is an experiment of its own…)

  • Quirk #5: Windows co-existence:

8TSR, launched internally by 8FORMAT, is a DOS resident application. Early versions of Windows will detect that the INT 13h disk services are being re-routed by a 16bit application, and as such, will fall back to using slow BIOS disk services instead of its own drivers. This will provoke a warning, but the drive will be usable if 8FORMAT /USE was loaded before Windows was (e.g. Autoexec.bat). Still, it’s best not to use Windows with 8-inch drives, unless the drive was configured as a 5 1/4″ 1.2MB one.
The older NT-kernel-based Windows do not care about the BIOS DPT, and – as such – 8FORMAT /USE won’t work. However, the formatting process can still usually be done, as the VDM subsystem permits direct floppy port access – at least, perhaps except the DSSD FM format. /The BIOS INT 13h is MFM-only, and it will never read FM-formatted disks, even if the FDC supports them./

Goodness gracious, now what

  • Quirk #6: The Quick Format switch, /Q

8FORMAT never attempts to detect what were the previous data contents of the disk inside the drive, including the previous format. With /Q, 8FORMAT only writes the new DOS boot sector, file allocation tables and the root directory using the TYPE specified in the command line. If this TYPE differs from what the 8 inch disk was originally formatted to, the Quick Format will fail on the write operations, as the sectors will be mismatching.

  • Quirk #7: Bad sectors and disk errors:

8FORMAT will defaultly only perform a format operation through the floppy controller. This usually fails only when grave chunks of magnetic material are corrupted, or if there is some other major disk problem (e.g. sudden disk absence during format 🙂 ). So, to format with verify – useful to determine the capabilities of the FDC, or to check for media integrity – specify /V as an optional argument.
Note that 8FORMAT does not keep a “bad sector table” of any sort. If there is a drive, disk or data problem during format, write or verify, there are 3 attempts before resigning to the command prompt for good. However, if FAT12 ought to be written to the disk with a sector size of 512 bytes (types EXT1 or EXT3), and the track 0 is at least known to be good, call 8FORMAT with /FAT12, but without /V, to just format the drive and write the filesystem. Then after that’s done, apply the 8-inch geometry and use DOS SCANDISK to go through the drive and map the bad sectors.

  • Quirk #8: Side/density mismatch:

A double-sided 8-inch drive configured to run with a PC the way as described above, does not give a hoot in hell about how many sides the disk has, or what density it is. Single-sided floppies also have magnetic material on the other side, but recording on it is not guaranteed to work properly. Same goes for single-density disks: 8FORMAT can attempt to format them double-density, but the reliability of it leaves a lot to be desired, considering the fact that most eight-inch floppies are a good couple of decades old now.
Note that double-sided disks won’t work in a single-side-only drive, i.e. an 8-inch drive that only has the bottom head, due to the index hole being in a different location. Also, attempting to format 2 sides of a single-sided disk in a single-sided drive will cause trouble the very first moment you decide to write any sensible data on it. This is because, instead of advancing to the other side after the first one /of a given track/ is done writing, the same side will be rewritten all over again – with the rest of the data, while the former is now lost.

  • Quirk #9: Making the 8-inch disk bootable:

Possible with types EXT1 and EXT3 when /FAT12 or /Q is specified. Truth be told, 8FORMAT will also create a bootsector for the 128-, 256- and 1024-byte sector variants. On a side note though, a PC will defaultly just load the first 512byte sector of track 0 during bootstrap, so any other TYPE except the 512 byte ones will fail.
Use classic SYS A: (with ENTER after the format, or appropriate 8FORMAT /USE) to create the bootable disk. You do want to include 8FORMAT.EXE, 8TSR.EXE and an AUTOEXEC.BAT on the drive that launches 8FORMAT /USE (disk type) upon boot, to work properly. Either way, it will throw a warning that 8FORMAT was launched from a floppy drive, and that all the other standard floppy drives won’t be accessible until reboot.
On an 8″ drive faked as a 5,25″ 1,2MB drive, SYS A: is enough.

  • Quirk #10: Undocumented commands:

8FORMAT, being a hacky experimental thang, also has its own undocumented commands that went along the way during the experimentation; some of them were finally documented (e.g. the /USE switch). Yet, a few remain undocumented:
8FORMAT (drive:) /UNFUCK – guess why it is undocumented? This causes the drive to seek back and forth from track 0 to 76, using the slow stepper motor rate, and performs a recalibration of the controller, sending the head back to track 0 again. Essentially, it “unfucks” the head stepper mechanism after it has been “fucked” during the fast BIOS POST seek quirk mentioned above. Otherwise, you get “general failure reading” or seek errors. Like the /USE switch, this command does not touch the disk.
/512PH – a switch that requires /FAT12 or /Q combined with TYPE DSSD, DSDD or EXT2. This recalculates the given geometry to use 512 byte physical sectors, however, the chosen TYPE is treated as a logical geometry of the FAT file system, and this is then written accordingly into the BIOS Parameter Block (BPB) of the media. /Yes, DOS supports 128 byte logical sectors./ This is highly experimental, expect it won’t work straight out of the box.
Type CRAM – similar to EXT1, but it formats 78 tracks and crams 17 512-byte sectors into each, with reduced R/W and format gap lengths. This yields a disk capacity of 1.3MB that can be shared between different drives /on pristine-quality double-density media/, surpassing 5 1/4″ drives by a notch.
I have also tried to go with 18 sectors per track with hair-thin write and format gaps; and although this went past the Verify stage, the sectors were overlapping during random-access writes, and the disk was unreadable in the other drives.

The CDC BR8A8-drive booting a 286 system

Leave a Reply

Your email address will not be published.