Monday, May 30, 2016

Working with ST-506 Interface MFM Hard Drives

If you have an IBM PC, XT or compatible of similar vintage, historically accurate options for mass storage can be a bit tricky to work with.  No XT-IDE, compact flash or Disk on Modules were available during the first decade after the release of the IBM PC.  Drives were huge but storage capacity was small by today's standards.  Still, if you want to go 100% Oldskool PC, you should use a vintage drive.  Even a vintage hard drive is far superior to being relegated to floppies.

The first hard drive interface in the PC compatible world came with the IBM PC/XT.  The XT included a "fixed disk drive" controller designed by Xebec.  The controller used an interface called the ST-506 after Seagate ST-506 hard drive.  The ST-506 was a 5MB drive and used a two-cable interface.  The IBM original controller only officially supported one type of hard drive in its first two iterations, the ST-412.  The ST-412 functioned like the ST-506 but had a 10MB capacity.

Later, Seagate released the ST-225, a 20MB hard drive that could be found in late model XTs and perhaps the IBM PC XT/286.  IBM released a final revision of its fixed disk controller to support this drive.

MFM drives can take up a full-height 5.25" drive bay.  These bays are seldom found outside the original IBM PC, XT and XT/286.  The ST-412 is a full-height drive, the ST-225 is a half-height drive.




ST-506/MFM Controllers

The Xebec MFM controller was not very fast, it supported a default interleave of 6.  This made the hard drive barely faster than a floppy drive when a sector is non-contiguous to the next sectors by five sectors.  However, given the slow speeds of the XT and the controller, interleaving was necessary.  One of the most common replacements for the Xebec controller was a Western Digital controller.  WD made a line of these controller boards which were well-documented, although much of that documentation is difficult to find online.  Whereas the Xebec controller may be able to support an interleave of 5, the WD controllers are reliable at an interleave of 3.  The performance increase is well worth looking for a WD controller unless you are trying for a 100% IBM system.

When IBM released the IBM PC AT, it included a combination floppy and hard drive controller.  This controller uses a 16-bit slot.  It came in two variations, but their feature set is identical.  The interleave by default is 3, but you should be able to set it to 2 without affecting the drive's reliability.  Some 3rd party controllers can eliminate interleaving entirely on an AT-class speed machine.

The IBM PC and XT BIOSes do not support hard drives and know nothing about them.  Support is added via a BIOS extension found on a hard drive controller card.  The default settings for XT controller cards are I/O 320, IRQ5 and DMA3.  An alternative I/O setting is at 320 and some cards allow the IRQ to be set to 2.  The latter is necessary when using an MFM controller in a Tandy 1000, which uses IRQ5 for video (Ghostbusters will not work properly if IRQ5 is disabled for video, as it can be on the SX and TX).  The controller's BIOS extension also provides hard drive tables for the types of hard drives it supports.

The IBM AT's BIOS does support hard drives.  Its controller uses the standard AT resources, I/O 170 and IRQ 14.  The 286's instruction set contains instructions making data transfers faster with I/O commands than by using DMA.  You use a setup disk to tell the BIOS the type of hard drive you have, assuming your hard drive is on the list of supported drives.  Many AT compatible systems will allow you to input the settings manually for a user-defined hard drive type.  For the IBM AT and XT/286, you had to use a third-party BIOS with the proper settings entered.

Cabling & Termination

MFM drives are rather like floppy drives in their cabling and SCSI drives in their termination.  The MFM drive uses two cables, a 34-wire Control cable and a 20-wire Data cable.  Two MFM drives can share a Control cable but each must use a separate Data cable.

The controller boards for MFM drives almost always have pin headers to connect the cables.  The MFM drives themselves usually use edge connectors to connect their cables.  34-wire cables are almost always found for sale for floppy drives, but you can reuse this cable for the Control cable.  Buy a "universal floppy drive cable".  If you only have one MFM drive, simply connect the card-edge connector before the twist to the drive.  That is the connector that would typically connect to floppy drive B.  Make sure Pin 1 is oriented correctly, Pin 1 is always on the side nearest the keyed edge of the card edge connector.

If you are using two MFM drives, you will need to pay close attention to the cabling.  Like floppy drives, true dual MFM cables have a twist in their cables.  The twist is in a different place.  Floppy drive cables twist wires 10-16.  MFM drive cables twist wires 25-29.  If you are using a universal floppy cable, you must untwist the original twist and make a new twist where indicated.  You may destroy the original connectors on the end of the cable by prying them off, so keep a fresh card edge connector at the ready.

For the 20-wire cable, you may need to make your own.  You do not need any tools for this, just the appropriate connectors, some ribbon cable and a pair of pliers to force the connectors together.  Again, mark where Pin 1 is, it is always on the side nearest the keyed edge.  The controller typically has two headers for the data cable, usually called J2 and J3.  Try J2 or the connector nearest the 34-pin connector first.  Total Hardware '99 has board settings for many MFM controllers.

If you are using only one MFM drive, just make sure the C: drive is terminated and the control cable is connected to the drive using the middle connector, the connector before the twist.  (With a single floppy drive, the cable is connected after the twist) If you are using two MFM drives, only the drive at the end of the cable is to be terminated, remove the termination resistor pack if it is on the drive on the middle of the cable.

Low Level Formatting

MFM drives support low level formatting.  Low level formatting is done by the controller and is distinct from high level formatting done by the DOS FORMAT command.  You can use the low level format to change the interleave of the drive, which will affect performance.  For IBM's controller and supplied drives, you can low level format through the XT or AT Advanced Diagnostics disks.

I am going to go over low level formatting using the WD W1002A-WX1, a common 8-bit MFM controller used back in the day.  Early versions of this controller only supported particular drives by jumpers, but later versions allow you to dynamically low level format the drive in software.  In other words, this effectively allows you to set a user-defined hard drive type.  The controller will store the settings in a portion of the Master Boot Record of the drive.

The latest firmware for this board is labeled 62-0000094-xxx.  This firmware's low level format utility is started by using DEBUG and entering G=C800:5.  Many other drives also start their utilities in this way.  This will start the utility, which will give you helpful command prompts.  It will recognize the drive and note the current interleave.

The utility will ask you "Do you want to dynamically format this drive (y/n)?"  You should enter yes.

Next the utility will give you a list of settings to enter.  Many of these settings can be found on Total Hardware 99.  It will ask for :

The number of Cylinders,
The number of Heads,
The cylinder to start Reduced Write Current,
The cylinder to start Write Pre-Compensation,
The maximum number of error bits to correct, and
The ccb option byte for setting the step rate

For the first four settings, you can usually find them for your drive in Total Hardware 99.  Not all drives use WPC, and it can be indicated when using the cylinder number just after the total number cylinder number.  RWC is usually done about halfway through the drive's cylinders.  The number of error bits should be set to 11, which is a conservative value.  Similarly, the ccb option byte should be set to 05, which gives a conservative step rate time of 24 microseconds.

For the ST-225, you would enter the following values :
615 4 300 616 11 05

Once you enter those values, the utility will ask you "Do you want to virtually format this drive (y/n)?"  You should enter no.  Finally, it will ask if you would like to format for bad sectors.  Early hard drives often had a few unreliable sectors and the drive would put a list of them on a sticker on the drive.  If your drive has such a list, you will need to enter this information so the system will know to mark these sectors as unusable.  If you are lucky enough not to have any known bad sectors, just enter no.

Much of the information for this section originally came from "The Complete PC Upgrade and Maintenance Guide" by Mark Minasi, Sybex Inc., 1991.  Its a really good book when you need to work with vintage hard drives and floppy drives, diagnose memory failures and configure printers and modems.

Once you get through all this, then the low level format will begin.  On my XT with the ST-225, it takes several minutes.  When it is finished it will prompt you to press enter to reboot the system.  Reboot the system, run FDISK then FORMAT /S and you should have a bootable MFM hard drive!

MFM and RLL Drives

MFM stands for Multi-Frequency Modulation and is the earliest encoding format used on hard drives.  MFM is also used on all IBM PC compatible floppy drives, from the single sided, double density 160-180KB drives to the double sided, extra high denisty 2.88MB drives.  RLL is a more efficient encoding format which can pack more bits into the same amount of space.  A typical MFM drive can support 17 sectors per cylinder, but RLL drives can usually manage 26 sectors per cylinder.  (All hard drives store 512 bytes per sector.)  There are RLL drives and RLL controllers.  Ideally you would want to use them together.

You can use an RLL drive with an MFM controller.  The RLL drive is generally more robust than an MFM drive, but is also backwards compatible.  However, you will not be able to use the drive to its full storage capacity.  A 33MB RLL drive will give only 20MB of usable storage space when formatted as an MFM drive.  You can use an RLL controller with an MFM drive, but only if the controller supports the MFM encoding scheme (look for 17 sectors per cylinder).

Some ESDI drives use the 34 & 20-wire cabling, but they are not compatible with MFM or RLL controllers.  ESDI drives are much closer than IDE/ATA drives which include most of their circuitry on the drive instead of the controller.

7 comments:

  1. Great great article! Keep the good information coming! :D

    ReplyDelete
  2. Fun fact I'm in the process of resurrecting an MFM hdd, and putting it on a newerish/olderish system to pull the data off of it and bring it to the future.

    ReplyDelete
  3. Indeed, this short article was well written. I love reading about old hardware like this. Thank you!

    ReplyDelete
  4. Very handy info to know if trying to access data on a very old drive. Thank you, I did not know XTs were so limited, but I guessed they might be. :)

    ReplyDelete
  5. I was there, and I just want to add that one of the neat tricks at the time was buying an RLL controller and using with MFM drives, which were much cheaper. Instant 50% capacity (and speed) increase.
    It worked for two drives I had: an original 20Mb that turned to 30Mb and one 40Mb bought specifically to work as a 60Mb drive. Never had any trouble...

    ReplyDelete
  6. I remember back in the day I was playing with an IBM XT clone PC with a ST-225 MFM drive.
    I wasn't afraid to break it back then, as my main rig was a 386, so I experimented.

    I installed a WDC MFM controller, but accidentally plugged the smaller (data) cable in the wrong way around. When I booted the PC the WDC BIOS said it detected a new "uninitialized" drive and proceeded to enter into it's own low level format utility.

    I new the drive was working, so I checked and saw the cable upside down, and while the machine was powered I changed the cable the right way around...

    I then saw there's a list of drives I can choose from, so I tried a different option than the ST-225. It was a 30MB option (cannot remember what the ST number was), so I chose that option.

    To my surprise the drive formatted to 30MB and worked! I then tried the 35MB option and that didn't work, once it got past a certain cylinder the drive would click and mark all sectors bad after that cylinder, but hey, atleast my 20MB ST-225 was a 30MB drive, and it worked, all 30MB of it worked.

    Those where the days...

    ReplyDelete
    Replies
    1. It was common in those days to underrate or relabel a device either just for marketing purposes or to sell devices where spot testing showed too many errors at higher densities.

      Delete