Friday, September 09, 2016

Testing the Cromemco MFM ST506 Hard Disk emulator


Subtitle:  Marcus and the Hard Disk Emulator in 2016


Marcus does not normally pre-emptively post the results of his projects, in order to avoid disappointment, but just this once I cannot resist


The Backstory

The first serious computer systems that Marcus used, well in fact built from components, were Cromemco Computers in about 1976.  At the time Cromemco sold construction kits for their then radically state of the art Zilog Z80 based computers.

I was an early customer.


Disk Interfaces
Until about 1979 the only way to start the computer was from Floppy Disk.

The original Cromemco S100 bus Disk Controller was the 4FDC and this then lead to the 16FDC and finally the 64FDC.    The links refer to the technical manuals for these diskette controllers


In late 1979 Cromemco announced an 11MB IMI hard disk connected to a new WDI hard Disk Controller.  I only have the WDI-II manual here   The Z2H computer was a variant on the Z2 computer that Cromemco usually sold with 2  5.25 inch floppy diskette drives

The Seagate ST506 Interface
Whilst the IMI hard disk of 11MB capacity completely transformed the CDOS or Cromix,  Z80 CPU based Operating systems available from Cromemco, they used a "unique" hard disk controller interface.

At the time Seagate pioneered another Hard Disk interface which was to be known as the ST-506 Disk Interface.  As the Wikipedia reference indicates the ST-506 refers to the interface and also the initial 5MB hard disk.

Soon the ST-506 interface was adopted by many Personal computer manufacturers of the time, and rapidly capacities increased from the initial 5MB to 10MB and 20MB etc.  IBM used the 10MB ST-506 interface in its IBM PC-XT

Cromemco used the advanced STDC Hard Disk controller to provide an intelligent ST-506 interface for 2 Hard disk drives.

The controller was intelligent and was actually an entire Z80 computer in itself. In order to increase speed the hard disk was read and written to a track at a time, i.e. not using sectors.  Naturally applications via the Cromemco CDOS or Cromix operating systems would still expect 512 byte sectors, so the mapping was done by the STDC controller itself.

Reading and writing tracks was a special Western Digital Disk controller instruction of the WDC chip on the STDC controller and means of course that any emulator that was only able to receive sector data would fail.  Over the years I found emulators, usually starting at Thousands of dollars (!!) but they would never say if they could accurately emulate all aspects of a ST-506 interface disk i.e. including track and not sector operations.


Existing Hard Disks
Until recently the only way to obtain MFM aka ST-506 interface disks was to study the ebay Vintage Computer auctions or similar for people selling old compatible hardware .  Part of my collection is shown above. The issues are



- These hard disks can be upto 36 years old
- Understandably many disks bought to not work
- The ebay sellers may claim a working disk but often it is not so
- Plus with a (say) 30 year old disk even if it works there may be damaged or defective sectors etc.  Your OS needs to be able to cope with these defects
- Even if the mechanical disk works initially it may fail after only a week or so of usage, understandable since it may have been sleeping in some cases for over 30 years since last powered on.

The Excitement
Until late 2015 buying overpriced and often faulty , 30 year old plus hard disks was the only way to go.  Now however I have found a vendor that can potentially supply an emulator.  I could not quite believe it!

The emulator is principly a BeagleBone Black computer with a daughter card of related electronics.



The Project Scope then is

- Test that that emulator works
- Can it support the Cromemco STDC and track read and write
- Is it easy to configure
- Is it reliable
- Can you swap out multiple disk emulations
- Can you tailor seek and other performance characteristics of the emulated drive
- Can you take a Physical disk and convert it to an emulated hard disk


Examples

At the Emulator Side

Command to create an emulate hard disk for first time


login as: root
Debian GNU/Linux 7

BeagleBoard.org Debian Image 2015-07-17

Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian


roots password:
Last login: Wed Sep  7 18:42:39 2016 
root@beaglebone:~#
mkdir /disk;chmod 777 /disk
cd /root/emu
./setup_emu
./mfm_emu  --initialize --file /disk/D41.C4096.H16.hdd \
   --cylinders 4096 --heads 16 --drive 1




At the Cromemco Side

Boot Computer from floppy Diskette
Address: Memory test by 16K blocks
000000h: ++++++++++++++++++++++++++++++++++++++++++++++++----------------
100000h: ----------------------------------------------------------------
200000h: ----------------------------------------------------------------
300000h: ----------------------------------------------------------------

Floppy = 1, STDC = 6, ESDC = 11
Enter major root device number: 1
 fda =  0,  fdb =  1,  fdc =  2,  fdd =  3
sfda =  4, sfdb =  5, sfdc =  6, sfdd =  7
dfda = 16, dfdb = 17, dfdc = 18, dfdd = 19
Enter minor root device number: 0

68010 XPU 168   Cromix-Plus Operating System
20071120 168 with TAPE STD ESDI OCT


System initialization complete

XPU Cromix-Plus release 168
welcome to mouse house
Login: system

Logged in system Aug-05-1999 23:58:21 on console

Message of the day:  Welcome to the Cromix-Plus Operating System
system[1]


Initialise the emulated hard disk
# inithard will give errors like this if hard disk not available
STDC0  Error: Drive 0, Unit 31, Block 0, Head 0, Cyl 0, Stat e1,Error 07ff
Disk I/O error

Cannot initialize track zero



system[1] inithard -n
68010 XPU 168   Inithard source 2.7

Press:          RETURN to supply default answers
                CTRL-C to abort program
Warning:        INITHARD can destroy all disk data

Device name? std31
Number of surfaces (1 - 16) <32> ? 16
Number of cylinders (1 - 4096) <1283> ? 4096
    Max number of alternate tracks must be
    a multiple of the number of surfaces
Max number of alternate tracks (0 - 112) <0> ? 10
Starting cylinder of disk (0 - 4096) <1> ? 0
Starting cylinder for write precomp (0 - 4096) <4096> ?
Do you want to initialize any tracks (Y/N) <N> ? y
First cylinder (0 - 4095) <0> ?
Last cylinder (0 - 4095) <4095> ?
First head (0 - 15) <0> ?
Last head (0 - 15) <15> ?
Surface Cylinder
     13    2242
     Partition table:
   0  4096 cylinders
Do you want to change partition table (Y/N) <N> ?
Alternate track location (1 - 4095) <1> ? 4090
Alternate track table
  # bad track alt track      # bad track alt track      # bad track alt track
      cyl  hd   cyl  hd          cyl  hd   cyl  hd          cyl  hd   cyl  hd
Do you want to add an alternate track (Y/N) <N> ?
system[2] diskinfo std31
Device /dev/std31 6:31  STDC Hard Disk  Aug-06-1999 02:48:09

Disk parameters
        Number of heads.................. = 16
        Number of cylinders.............. = 4096
        Number of alternate tracks....... = 0
        Location of alternate tracks..... = 4090
        Number of sectors per track...... = 20
        Bytes per sector................. = 512
        Start of write precompensation... = 4096
        Starting cylinder of disk ....... = 0

Partition #      Starting Cylinder  Number of cylinders  Size (Kbytes)
    0                     0                 4096           655,360
   31                     0                 4096           655,360

Alternate track table
  # bad track alt track      # bad track alt track      # bad track alt track
      cyl  hd   cyl  hd          cyl  hd   cyl  hd          cyl  hd   cyl  hd

Some testing Thoughts

In the above test I created the largest possible hard disk.

system[5] makfs std0
system[6] free std0

/dev/std0   1,294,317 blocks  647,158K  662,690,304 bytes

system[15] mode std0

STDC Hard Disk 6:0
 BSTEP          -CDOS            CROMIX          CYLinders 4096
 HARDerr   0     MOUNTed        -READonly        RETRY     10
 RPM       3571  SECSIZ    512   SECtors   20    SIZE 655,360K
 SOFTerr   1     SURfaces  16    VERIFY          VERsion 01.35
-WRITEprotect

This emulated disk is some 600MB in size but there are issues at this size

- It took over 1 hour to format the hard disk
- Then over 1 hour to run the makfs (make filesystem) command. 

That is just ridiculous.

Also there are ways to improve the disk performance by choosing less i-nodes at the makfs command.

Interestingly you can see what the Cromemco System is doing by looking at the Emulator ssh window

 Waiting, seek time 8.0 ms max 19.9 min free buffers 72
  Drive 0 Cyl 0->51 select 1, head 4 dirty 0
  Waiting, seek time 7.9 ms max 19.9 min free buffers 72
  Drive 0 Cyl 51->55 select 1, head 15 dirty 0
  Waiting, seek time 7.9 ms max 19.9 min free buffers 72
  Drive 0 Cyl 55->56 select 1, head 7 dirty 0
  Waiting, seek time 7.8 ms max 19.9 min free buffers 72
  Drive 0 Cyl 56->57 select 1, head 2 dirty 0
  Waiting, seek time 7.9 ms max 19.9 min free buffers 72
  Drive 0 Cyl 57->56 select 1, head 8 dirty 0
  Waiting, seek time 7.8 ms max 19.9 min free buffers 72
  Drive 0 Cyl 56->0 select 1, head 4 dirty 0
  Waiting, seek time 7.9 ms max 19.9 min free buffers 72
  Drive 0 Cyl 0->56 select 1, head 8 dirty 0
  Waiting, seek time 7.9 ms max 19.9 min free buffers 72
  Drive 0 Cyl 56->0 select 1, head 4 dirty 0
  Waiting, seek time 8.0 ms max 19.9 min free buffers 72
select 0 head 4
  Drive 0 Cyl 0->56 select 1, head 8 dirty 10
Free buffers 74,0 delay 0.000
  Waiting, seek time 8.5 ms max 19.9 min free buffers 72
  Drive 0 Cyl 56->0 select 1, head 1 dirty 100
Free buffers 74,0 delay 0.000
  Waiting, seek time 8.7 ms max 19.9 min free buffers 72
select 0 head 2
select 2 head 0
select 0 head 0
select 1 head 0
select 0 head 0
Much more testing to go before I give it the Marcus seal of approval. But I am pretty optimistic. And when validated I'll write full documentation of course, for the Cromemco Community. Imagine being able to package a complete bootable hard disk as a single file, push it up to a Cloud service like Dropbox, and share it with other Cromemco users. Until now we have been talking floppy disks or floppy disk images!


Summary
My Cromemco Z2, which started life in about 1979 is still working. It got an upgrade in about 1984 to use a Motorola 68000 processor (and a Z80), and then in 2014 with a HxC floppy Disk Emulator This 2016 MFM ST-506 upgrade is the ultimate and perhaps final upgrade.