"G=C800:5"
Only a few of you will understand that title, but that's OK
In the dark days of the early 1980's hard drives were mysterious, largely analogue devices If you look at image above the connections are very different to recent technologies, and the cables carried a mixture of analogue data and digital control signals.
It's not super clear in the image, but the white label towards the back of the drive was a list of "bad sectors". Literally, these were manufacturing defects on the surface of the drive where data could not be read or written reliably.
Much earlier in my career, I had to guide customers through the process of installing very expensive ten and twenty megabyte hard disks into PC-XT and PC-AT style machines. The XT style machines didn't actually understand hard disks, and relied on a BIOS extension on the controller card to do the work. BIOS extensions were one of the most brilliant aspects of the IBM PC architecture in my opinion, but that's a story for another day.
Anyway, back to the disk controller. We first had to set jumper positions or switches to define the physical characteristics of the disk drive because the drive essentially had no on-board intelligence that you could query. On the DTC controllers, I told so many customers "Switch 2 and 4 on, everything else off" that it's burned into my mind after forty years!
After that, we used to boot DOS from a floppy and then run the "debug" program to launch a routine contained in the controller BIOS. Early Western Digital and DTC controllers had this at address "C800:5", and the firmware-based formatter would start. We called this a "low-level" format, and it's purpose was to prepare the drive for whatever operating system you were going to install later.
But why was this even necessary?
In the good old days, hard disk drives were not the intelligent devices they are today. They were not much more than precision mechanical components, a lot of analogue circuitry to read and write from the spinning metal platters (coated with iron oxide) and most likely a stepper motor or linear actuator to position the heads.
They also had the aforementioned bad blocks. The operating systems of the day just blindly assumed the media was perfect and the controller had to protect it. I wanted to understand, simply out of curiosity how this really worked, so I reverse-engineered the firmware from some controllers stored in the shed.
Please note that I am not going to show any of the code I extracted out of respect for the manufacturer's copyrights, but what I found out revealed a complete hidden world that most of us need never know existed. Read on if you dare:
The mystery deepens
The disk arrives from the manufacturer and it is quite literally blank. Neither it, nor the controller had any understanding of what the operating system was going to need, and there was no memory on-board to store the defect information. What I wanted to understand was how and more importantly where was this data recorded?
When is 512 bytes not 512 bytes?
The majority of disk controllers presented a block of 512 bytes in response to a command to read a sector at a specific disk/cylinder/head/sector location; but there is actually considerably more data written to the disk. It is almost a miniature file system below the filesystem we see.
The little documentation which exists on this stuff (for the PC world, anyway) refers to three types of blocks on the disk:- An inter-sector gap
- A sector header
- A sector data block


Comments
Post a Comment