S100-Manuals - Disks and Disk Drives

Here I will discuss Disks and Disk Drives, some of the information applies strictly to CP/M some will be generic.  Definitions of many terms can be found in the technical manuals.  I will post documentation as needed for a generic overview.  If you need information on a specific drive and can not find it feel free to email me and I will try to help you find it, my email address is randy at s100-manuals dot com.  This page is dedicated to a group of drive types defined by Shugart and Associates (SA400 and SA800 standards).

First and foremost FM is single density and MFM is double density.  Most drives don't care but there are some drives that do not work reliably in double density.  I have never seen a drive that didn't work double density.  Any drive that works double density will work single density with one caveat:  Some drives have an optional data separator needed by some controllers to read FM.

Care and maintenance:

Disks should be kept in sleeves and away from magnets and motors which can erase them.  Only handle the disk by the covering, touching the media exposed through the window can leave oil that will destroy the disk and gum up the drive heads.

Look at the diskettes often, especially 8 inch.  If you see they are scratched STOP!  It is time to clean the heads, when the diskette gets scratched the missing material gets deposited on the head.  This built up material is made of a material called ferrous oxide.  Ferrous oxide is the material used to store the magnetic pulses, ferrous oxide is also known as rust.  On the diskette it is polished and smooth, once it starts to build up on the head it is no longer smooth and polished.  The ferrous oxide that builds up on the head is very abrasive and will scratch every disk inserted into the drive destroying the disks.  Cleaning the heads is not difficult but does require taking apart the enclosure holding the drive(s).  If you have more than one floppy drive you might as well clean all of them at the same time.

As for disk drives the first thing to know is that WD40 is NOT your friend.  WD40 is a solvent and can melt plastics.  WD40 is so light that it can wash away all lubrication then dry completely leaving you with no lubrication.

I use Q-tips on long wooden sticks:  First I take the drive out and blow it clean with compressed air.  Next I place it on the bench and take a Q-tip dipped in rubbing alcohol and clean the head(s), using the same Q-tip I clean anything dirty including the metal rails the head assembly rides on.  I use cotton Q-tips and look to make sure I don't leave lint when I'm finished.

On single sided drives I flip open the head assembly and check the felt pad.  If it is worn out it must be replaced.  I have not used single sided drives in years.  A leather punch can make a perfect cut-out of felt, another method is to try using a razor and cutting a new pad.  Felt can be found at hardware stores as well as fabric stores.  Use either rubber or contact cement to glue it on, some felt comes with adhesive already applied.

For lubrication I use a Q-tip dipped in a light oil (3 in 1 is OK, heavier oils such as motor oil works also) I rub the Q-tip along the rails I cleaned not using much oil.

I move the heads back and forth by hand checking to be sure it moves easily.  I give a visual check for problems.  I look carefully at the logic board for problems.  Any tarnish build-up I use Tarn-X to clean and rinse with water.  For the record water does not hurt electronics, using electronics when wet is bad or letting anything rust is bad.

Restore drive to system and test it out.

Most all problems with disk drives turn out to be mechanical.  Cleaning and lubrication alone will fix many problems.  Alignment and other mechanical adjustments will fix almost all other problems.  Electronics fail but at a much lower rate than mechanical problems.

Alignments and other mechanical adjustments can be "played with" if known to be out of adjustment and you do not have proper tools, the idea being it's broken so you can't hurt it anyway.  I will see about giving specific examples when I get a chance.  Before trying this make sure you understand what you are trying to do.  Alignment can be done by writing a disk on a known good disk and trying to read it with the target disk.  Slowly make the adjustments until the disk reads OK.  Once you are able to read it OK find the upper and lower limits that read OK and try to lock it in the middle.  This method is not recommended it is just a last chance method, I recommend doing it right: get an AAD disk appropriate for your drive and an oscilloscope.

Formatting:

Disks are formatted two ways:  Disks have both a physical formatting and a logical formatting.

Physical formatting is not necessarily homogenous throughout the entire disk.  One example is the Cromemco CDOS system, Cromemco requires that the system tracks be formatted in FM while the rest of the disk can be MFM.  Other CP/M systems require that the system tracks be formatted MFM but allowing the rest of the disk to be written in FM format.

Logical formatting describes where and how data is read/written on the disk and includes the directory structure, block size, number of blocks, interleave, etc.

Tracks:

Diskettes are physically divided into tracks and sectors.  Tracks are concentric circles, the first track is called track 00.  The disk has two points of reference to "know" where to start:  Track 00 is detected by one optical sensor and a second optical sensor shines through a hole punched in the media (index hole).

Going from one track to another is accomplished with a stepper motor.  Different drives can step at different rates ranging from 3ms to 30ms.  If a drive is sent a stepping signals come too fast it will not step at all (but should make noise).  If the stepping signals come too slowly then the drive will be noisy and it will take longer for data transfers.  It is better to step too slowly than too fast since it will work if a slower stepping rate is used.

Sectors:

Disks can be either soft-sectored or hard-sectored.  Soft-sectored means that tracks can be formatted in a variety of sector sizes and numbers.  Hard-sectored disks have the number of sectors defined by the media: 8 inch hard-sectored disks have 32 sectors, 5.25 inch hard sectored disks come in either 10 or 16 sector disks.  If you have a NorthStar system you need 10 sector disks.  3.5" only comes soft-sectored.

Common sector sizes range from 128 bytes to 1024 bytes.  The number of sectors are limited by the rotational speed of the drive and the transfer rate.  The calculations are generally already done and defacto standards exist for different media.  A few examples of different "standards" are:  PC 5.25" 8 512 byte sector format (PC DOS v1), PC 5.25" 9 512 byte sector format (PC DOS v2 or better), and the Kaypro 5.25" 10 512 byte sector format.  All three of these formats are used on the same media the PC-DOS v2 formatting gives 12.5% more data on the same disk, the Kaypro formatting gives 25% more storage over the PC-DOS v1 format (11% over v2).  The problem with pushing the limits is that it is possible to have trouble especially if the drive is running a little fast.

Interleave:

Interleaving allows for the fact that after reading a sector a program needs time to process the data before reading the next sector.  If the sectors were accessed sequentially then a sector would be read and while the program was getting ready to read the next sector it would have already passed by the head, the computer would have to wait until it came around again before it could read the second sector.  Without interleaving it would take twenty-six revolutions to read a single 8 inch SSSD track, with interleaving it can be done in 6. Doing the math 26 revolutions * 77 tracks / 360 RPM takes 5.5 minutes to read a disk, with interleave you can do it with 6 revolutions * 77 tracks / 360 RPM or 1.5 minutes.

There are two ways to interleave:  One is to use a translation table that maps the CP/M sector to the physical sector.  Another method is to format the disk using non-sequential sector numbers.

Using a floppy based system without interleaving makes the system very slooow!

Multi-Heads:

Floppy drives may have either one or two heads per disk.  To move from one track to another it takes time, time measured in milli-seconds.  This may sound fast but switching the data from one head to another is done electronically in nano-seconds (1000 times faster).  Obviously it is best to step from one track to another the least number of times.  Some systems count the second side as the same track and the track as twice as many sectors as a single sided disk similarly formatted.  Some systems count even numbered tracks as side 0 and odd numbered tracks as side one.  Some systems do all of side 0 then start over on the second side.  And some do all of side 0 then do the second side backwards.

I prefer to number sectors from 1 up on each side.  Others put a bias on sectors on the second side.  This adds to the complexity of the BIOS without giving anything back.  If you are unsure of the side or track you can have the controller read the track, side, and sector for verification.

If you are creating your own BIOS I recommend thinking first.  I like to use even numbered tracks as side 0 odd numbered tracks as side 1.  This allows for the side select signal to come from a simple and instruction and the real cylinder number come from a simple shift instruction.  These instructions are executed very quickly.  Comparison instructions generally take significantly more time.

This information also applies to hard disks that may have multiple heads.  Switching heads is always faster than seeking to a different cylinder.

There are several things that can be done to speed a system up.  Most everything is in how you read data off the disk.  If you have enough memory you can cache data.  On 8 bit systems you can use separate RAM memory banks to hold data already read, it is likely to be re-read.  On 16 bit systems reserving a few K of RAM really helps.  The best thing is track buffering.  If you have the memory to hold just two or three whole tracks in an LRU cache a floppy system can run as fast as a hard disk based system.  This is not reasonable in a system with 64K or less of RAM.  Optimizing the interleave is the easiest thing you can do to dramatically increase speed.

Encoding:

Data is encoded on most disks in one of two formats:  FM (single density) and MFM (double density).  FM has a simple elongated square wave written out called a clock.  In the middle of each clock pulse is the data window a pulse represents a 1.  With MFM the "window" is one half the size, the data pulse still goes in the middle of the window, if there is no data pulse in either the preceding or following window then a clock pulse is written.  MFM uses the same flux density as FM but puts twice as much data in the same space.  The timing for FM is less critical than MFM examples of FM & MFM diagrams are in the manuals.  A FM example is found on the 14th page (page number 9) of the SA800 OEM manual.  An MFM example is found on the 24th page (page number 21) of the FD235 manual.  There are other encoding methods used by some computers such as Commodore & Apple II.

CP/M standard disk formats:

For CP/M there is one and only one standard disk storage - 8" SSSD, that is to say 8 inch Single-Sided Single-Density Soft sectored disk formatted as 26 128 byte FM encoded sectors per track totaling 77 tracks.  The sectors are formatted sequentially as sector numbers 1 through 26, the tracks are formatted as track numbers 0 through 76.  The first two tracks are reserved and normally contains the boot program.  The next 75 tracks contain the directory and data, the sectors are not accessed sequentially but are in fact accessed in an interleaved fashion.  The interleave was optimized for an 8080 running at 2mhz.  The interleave factor is 6, this means that the sectors accessed in this order:  1,7,13,19,25,5,11,17,23,3,9,15,21,2,8,14,20,26,6,12,18,24,4,10,16,22.

Now that I have stated the one and only standard CP/M format I will just say there are hundreds of other "non-standard" formats.

Common drive characteristics:

8 inch 5.25 inch HD 5.25 inch QD 5.25 inch DD 3.5 inch HD 3.5 inch DD
77 tracks 80 tracks 80 tracks 40 tracks* 80 tracks 80 tracks
250K bits per second FM 250K bits per second FM 125K bits per second FM 125K bits per second FM 250K bits per second FM 125K bits per second FM
500K bits per second MFM 500K bits per second MFM 250K bits per second MFM 250K bits per second MFM 500K bits per second MFM 250K bits per second MFM
360 RPM 360/300 RPM** 300 RPM 300 RPM 300 RPM 300 RPM

*One early drive only had 35 tracks, the SA400 gave it's name to the standard for 34 pin cabling and was limited to 35 tracks.

There are other size drives but I do not plan to discuss any other sizes.

Please note that 8 inch and 5.25 inch HD are very similar and in most cases an 8 inch drive can be replaced with a 5.25 inch HD drive.  5.25 inch DD and 5.25 inch QD drives can usually be replaced by a 3.5 inch DD drive.  The 3.5 inch HD drive uses the same transfer rate as an 8 inch drive (and 5.25 inch HD) but the RPM is different.  This difference means that in most cases a 3.5 inch HD drive can not replace an 8 inch drive without modifying the software.

Disk drive data cabling:

There are two standards for disk drive data cabling named after two Shugart drives:  SA400 (34 pin) and SA800 (50 pin).  The odd numbered pins are ground pins, the even numbered pins contain the data lines:

  SA400 / 34 pin SA800 / 50 pin
TG43/LOW CURRENT/DENSITY SELECT 2 2
DS3* 6 32
INDEX 8 20
DS0* / Motor on for PC drive A 10 / 16   PC's 26
DS1* / Drive select for PC drive A 12 / 14           twist 28
DS2* / Drive select for PC drive B 14 / 12                   these 30
MOTOR ON / Motor on for PC drive B 16 / 10                            lines  
DIRECTION SELECT 18 34
STEP 20 36
WRITE DATA 22 38
WRITE GATE 24 40
TRACK 00 26 42
WRITE PROTECT 28 44
READ DATA 30 46
SIDE SELECT 32 14
DISK CHANGE/READY 34 12
TWO SIDED STATUS   10
HEAD LOAD   18
READY   22
SEPARATED READ DATA (FM)   48
SEPARATED READ CLOCK (FM)   50

*DSx lines are sometimes listed as DS0-DS3 and other times listed as DS1-DS4 either way is fine.

The lines are active low, a +5v means inactive, 0v (ground) means active.

On PC's the 34 pin cable has a twist in it.  The twist changes the lines 10 through 16.  On a PC this allows each drive to have their own motor on line.  Many new drives have no way to change their DS selection, they are hard-wired to the second drive select.  To use these drives on classic systems it is often easier to use a modified cable.  If you take a cable and put a twist in the cable similar to a PC cable twist then the drive select is determined by the cable plug (just like a PC).  Instead of using seven wires (10-16) you only need to twist three wires (10-12), classic systems need to leave the MOTOR ON line alone (pin 16).

On some classic systems the read data line must be pre-processed.  This only applies to FM data, the clock signal must be separated from the actual data bits.  This is often done via optional components on the disk drive.  The raw data is sent to pin 46 on the SA800 bus while the separated data is sent to pin 48, the clock signal is sent to pin 50.

Pin 2 definitions:

Being a stickler for details I have researched the uses of pin two on the drives.  Pin 2 was originally used to reduce the write current of the disk head on an 8" drive.  The reduced write current is needed when writing data on tracks 44-77, these higher tracks are closer to the hub than the lower track numbers.  Being closer to the hub the bit density is greater and so the need for reduced write current.  When pin 2 was grounded it would reduce the write current.

5.25" HD drives use pin 2 for two different but complimentary uses for pin 2.  Originally the 5.25" HD drives used pin 2 as both a speed control and to control reduced write current.  When pin 2 is high the speed of the drive is 360 RPM if the drive is configured for two speed lowering pin 2 slows the drive to 300 RPM.  Pin 2 also affects the head write current.  On 5.25" drives the bit density is fairly uniform and only needs reduced write current when the data transfer rate is very high (500kbs).  At low data rates (250kbs) the bits are further apart and reduced write current is not needed.  Normally the drives are jumpered to have the opposite affect for reduced write current compared to 8" drives where a high on pin 2 reduces the write current.

3.5" drives normally ignore pin 2 with a few exceptions:  2.88mb and some PS2 1.44mb drives use pin 2 to select the disk density.

Attaching an 8 inch drive to a PC:

Here is the pin-out of the cable I use (please note odd - ground pins are paired with even - data pins):

Signal line 34 pin connector 50 pin connector
TG43/LOW CURRENT (NOT USED) 1&2 1&2
IN USE/OPEN 3&4 15&16
DS3 5&6 31&32
INDEX 7&8 19&20
DS0 9&10 25&26
DS1 - DRIVE A SELECT 11&12 27&28
DS2 13&14 29&30
MOTOR ON/HEAD LOAD 15&16 17&18
DIRECTION 17&18 33&34
STEP 19&20 35&36
WRITE DATA 21&22 37&38
WRITE GATE 23&24 39&40
TRACK 00 25&26 41&42
WRITE PROTECT 27&28 43&44
READ DATA 29&30 45&46
HEAD SELECT 31&32 13&14
READY 33&34 11&12

The above table came from Don Maslin, some pins seem to be connected when not needed.  That's OK with me, it works!  This is no guarantee it will work for you.  If you need help send me an email.  The biggest "problem" with this cable is pin 2 (see long discussion above).  On NEC 765 (Intel 8272) disk controller chips used on early PC's the TG43 signal shares the same pin as DIRECTION (pin 18 on 34 pin connector), when the drive is doing a seek function this pin is used to specify direction durring read/write operations it is the TG43 signal.  On some (hopefully most) controllers it should be possible to tie the DIRECTION signal to TG43 (pin 2 on 50 pin connector) to give true TG43 support since all PC's use derivatives of the NEC 765 for a controller.

Replacing classic disk drives with newer devices:

If your classic computer uses hard sectored media it will be difficult to replace an existing drive with anything.  8" hard-sectored disks have 33 holes punched that pass the drives index sensor, 1 hole for the index and 32 defining the sectors.  For 5.25" there are two types of hard-sectored media:  10 & 16 (11 & 17 holes), I know of no other media that can be used as a replacement.

There are two reasonable ways to use newer devices for hard-sectored disks:  One is to emulate sector pulses by having an electronic device between the index line and the host controller, a soft sectored disk could then be used.  Another method is to completely replace a mechanical drive with a solid state drive that totally emulates the drive and media, this works for both soft and hard sectored media.

For soft sectored systems there are some relatively easy choices.  Most 8 inch soft sectored systems can use 5.25" HD drives by simply creating a new cable.  Most 5.25 inch drives can simply be replaced with 3.5 inch drives using DD media.

Replacing 8" drives with 3.5" drives:

Replacing 8 inch drives with 3.5 inch drives is not as easy as using a 5.25 inch HD drives.  The problem is that the 3.5 inch drive rotates at a slower rate.  The slower rotational rate of the 3.5 inch drive allows for more data to be stored but causes many formatting programs to fail.  To use 3.5 inch drives requires changing the software.

Recommended physical formatting for 3.5" diskettes (Teac):

3.5" DD media FM (125 kbs) 3.5" DD media MFM (250 kbs) 3.5" HD media FM (250 kbs) 3.5" HD media MFM (500 kbs)
16 128 byte sectors per track 16 256 byte sectors per track 32 128 byte sectors per track 32 256 byte sectors per track
9 256 byte sectors per track 9 512 byte sectors per track 18 256 byte sectors per track 18 512 byte sectors per track
5 512 byte sectors per track 5 1024 byte sectors per track 10 512 byte sectors per track 10 1024 byte sectors per track

As previously stated other than 8" SSSD there is no standard for CP/M systems, there is also no consensus for a defacto standard.  Personally I recommend the following:

For FM use only 128 byte sectors (16 @ 125 kbs, 32 @ 250 kbs), since this is the closest to the CP/M standard.  For MFM use only 512 byte sectors (9 @ 250 kbs, 18 @ 500 kbs), since this is what the PC uses.  Other people who's opinions I respect suggest larger sector sizes but as stated there are not enough people willing to give their opinions to make a quorum.

DOS programs of use for CP/M systems:

Anadisk is a program written by Sydex.  It allows a disk to be analyzed.  It looks at the tracks and determines what the format is.  It also displays the data in the sectors and allows editing the disk.  It can also extract the sectors to a DOS file.

22Disk is a program written by Sydex.  It allows PC-DOS based machines to read/write files on CP/M disks, it also has other utilities like a disk formatter.  Several versions were written, I keep two versions: v1.42 & v1.44.  V1.44 runs from a Windows 95/98 DOS window but can not handle 8 inch disks.  V1.42 only runs from a real DOS but will handle 8 inch disks.

Teledisk is a program written by Sydex.  It allows PC-DOS based machines to read/write whole disks to/from disk image files including formatting.

Hardware to support classic disks:

No matter what software you use it can only do whatever the hardware can handle. Early PC's could not handle the data rate required for 8 inch drives.  Most PC's can not handle FM, if you have more than one DOS system you can do trial and error to see if you have one that handles FM.

To get around the problem of PC limitations on handling disks there are several solutions.  All of the solutions require adding hardware to your PC.  Some additions are as simple as a serial cable.

Some add on cards have compatible disk controllers.  Catweasel is a programmable disk controller that can be setup to handle any SA400/SA800 format.  The Catweasel requires programming but can handle FM, MFM, other encoding along with hard or soft sectoring.  Other PC controllers handle FM (some Adaptec ISA controllers for example).

Dave Dunfield has written some software to transfer the disk images to/from the classic system over a serial port.  It requires that the classic system meets certain criteria.  The Classic system must be running a program that communicates with the program running on the PC.  This creates the old chicken or egg problem, which came first.  To get the program over you need: A working system to load the transfer program on.  A ROM based monitor to enter the program with.  A front panel to enter a bootstrap to load the program.

SVD is an external "black box" that is a "Semi-Virtual Diskette".  Eric J. Rothfus developed a micro-controller based device that emulates a disk drive.  It plugs into the classic systems disk cable and into the serial port of a PC.  The PC can download a disk image to the SVD.  The classic system uses the SVD as a real disk drive.  When done the updated disk image can be saved on the PC.

Links and Downloads:

Herb Johnson's disk drive webpage

SA400 OEM manual

SA800 OEM manual

Teac FD235HF

How to connect 5.25" disks to 8" controllers

Don Maslin's notes on connecting 5.25" <-> 8"

Eric J. Rothfus' SVD page