Sunday, April 30, 2023

Forty Years of Personal Computing - MC6809 Meets Floppy Disks

The massive ICOM "Frugal Floppy" FD360
By August 1983, I had a working MC6809 computer with no storage. My BBUG monitor eschewed audio cassette tape. Floppy disk drives were expected -- BBUG included a Disk Boot command. Any disk controller needed to be compatible with that code. 

In 1983, a friend of mine gave me an Icom Peripherals FD360 Dual Floppy drive box. A client of his had purchased the Icom, but opted to use another disk system instead. His client couldn't use the Icom box, but perhaps I could.

Icom was one of the first floppy disk suppliers with their "frugal floppy" system. The FD360 contained two Pertec FD400 8" disk drives, a couple of interface boards, and a large power supply. It is huge and heavy, larger than the SWTPc 6800 Computer System, and weighed about 70 lbs.

Pertec FD400

The Pertec drives differ from the popular Shugart SA800/801 of the same era. They have a 44-pin edge connector, as opposed to Shugart's 50-pin edge connector. The signals and power supply requirements are different. Icom's interface boards translated those connections into a 34-pin IDE connection, quite similar to what was later used with 5 1/4" floppy disks. There were a few important differences:
Data plate from the Icom FD360

- Step In and Step Out signals, instead of Step and Direction.
- Erase Enable in addition to Write Enable.
- 8" media data rates (250 kHz), instead of 5 1/4" data rates (128 kHz)
- Head Load signal (not present on 5 1/4" disks)

The FD400 has a single metal head, designed for single-density recording. 

Western Digital FD1771

The FD1771 was the first in a series of LSI floppy disk controllers from Western Digital. It simplified the interface and operation of floppy disk drives. Designed for Shugart-style drive signals, it could accommodate the signals from the Icom with a bit of logic.

I had schematics for the SWTPc DC-2 controller, and borrowed from that design. The FC1771 data sheet convinced me that the data bus hold times meant data bus latching was required, so I had an extra layer of buffering on the data bus using a 74LS373 matched with a 74LS244 (for reads). These were on top of the pair of 74LS242s that buffered the data bus to the card.

Following the FD1771 data sheet recommendations, I used an external hardware clock/data separator. (The SWTPc DC-1,-2 and -3 all used the inadequate internal clock/data separator) I used the circuit from Figure 6 of the FD1771 application note. It has a 4 MHz clock, 74LS175, 74LS161 and a few other gates. Dividing the clock oscillator by two fed the FD1771 with 2 MHz necessary for 8" drives. A 74LS221 one-shot multivibrator supplied the head-load timing (HLT) signal after about 40 ms. A 74LS175 captures data bus D0 and D1 to a two-to-four decoder to allow drive selection -- up to four drives, but I only have two.

I built this controller using wire-wrap techniques on a piece of perfboard, with 30 pin Molex connectors glued to the edge. The same construction as I had used on the MC6809E V1 board. A 34-pin dual pin connector provided the connection to the Icom drives.

In my schematics, I included a 74LS221 one-shot to trigger the M.RDY line on the SS-50 bus when accessing the FD1771. But this pin is not available on the SS-30 bus. So I omitted the circuit during construction. The FD1771 did not need this additional delay. 

The I/O slot memory map is simple:

01xx - Drive select latch (bits D0 and D1)
1000 - Command / Status Register (FD1771)
1001 - Track Register (FD1771)
1010 - Sector Register (FD1771)
1011 - Data Register (FD1771)

After building, I tested the controller by writing a few commands to the FD1771 by hand using the BBUG monitor. I could select each drive, move and load/unload the head. It seemed to work. Using the drives required a disk operating system.

Disk Operating System

At that time, 6809 systems generally ran TSC's Flex09 or Microware's OS-9. BBUG's disk boot command was designed for Flex09. OS-9 required a completely different set of ROMs. My friend Carl was already using Flex09, so that was my choice.

Upgrading from using cassette tape, a disk operating would seem like a bit step upwards. But Flex09 was very primitive, especially compared to the work I was doing with MS-DOS at the time.

Bootstrapping

SWTPc DC-2 Controller
Carl had Flex09 on 5 1/4" disks. As my disks were 8", bringing up Flex09 took some doing. 

Carl gave me a SWTPc DC-2 disk controller, and loaned me his 5 1/4" drives for a couple of weeks. The DC-2 was surplus to his needs. He'd upgraded to double-sided, double-density controller, and the old controller was useless to him.

With the controller and disk drives, Flex09 booted up easily from the floppies Carl supplied. I just needed to get them on the 8" drive. The motherboard gave each controller a separate address, as they  plugged into different slots. Some configuration changes let Flex09 know about the additional drives. Before anything could be copied to an 8" diskette, it had to be initialized. The 5 1/4" NEWDISK program didn't work for 8" disks as their formats were different.

I wrote my own version of NEWDISK. This required understanding the FD1771 Write Track command. NEWDISK generated all of the data for each track, with the proper address marks, gaps and codes that permitted the FD1771 to properly read and write the disk. Then it would issue a Write Track command to the FD1771 and the track data delivered. This process repeated for each track on the disk.

At the time, there was no defined format for 8" disks. Flex09 required 256 byte sectors. The 5 1/4" format used ten sectors per track in single-density. 8" disks had room for more. With very generous gap sizes, fifteen sectors per track fit easily. 

After track initialization, NEWDISK would write the volume information, and then the boot loader into the first sector. A disk was made bootable simply by copying the Flex09 system files to the disk.

Experimentation

Reaching the point where I could boot Flex09 from my 8" disks, I reconfigured the system and gave 5 1/4" disks back to Carl. The work done on NEWDISK led me to experiment. With 77 tracks of fifteen sectors per track, my 8" drives held a little more than 288 KB each. 

Reducing the gap sizes, seventeen sectors would fit on each track. This increased the storage capacity to 327 KB for a 77 track disk. 

Doing some tests, I found that the Pertec drives were mechanically capable of 78 tracks. Trying to step out to the 79th track resulting in a very alarming klunk as the head reached its mechanical limit.

While I confirmed that diskettes formatted for 78 tracks were valid and reliable, I decided this was not recommended. Such diskettes might be unreadable on other disk drives. My final version of NEWDISK formatted 77 tracks, with either fifteen or seventeen sectors per track.

Success

By the fall of 1983,  I had a working 6809 system, complete with 8" floppy disks drives running Flex09.