Wednesday, March 12, 2014

Cromemco UNIX V.2 Rescue and Recovery Mission


This is a tale of recovery and perhaps finally redemption ....

The Preamble
I have to admit that back in 1986 I could only dream of owning a Cromemco UNIX system.  Some of the more expensive ones were sold to the US Government at prices greater than 50,000 Dollars.

To rich for me in 1986

I did however always wonder about Cromemco UNIX, because the company's initial claim to fame was not UNIX but their UNIX-like CROMIX operating system.

Cromix was first produced for the 8bit Zilog Z80A processor, running at 4Mhz.


The versions of Z80 Cromix went from 10.90  (my first) up until 11.27 which was dated 1984.

Now in the early 19-eighties the money was on the Motorola 68000 series of processors to succeed the then dominant Zilog.  [Obviously IBM had other ideas, but that is another story entirely]

Accordingly, Cromemco produced an ingenious Dual Processor Z80 and Motorola 68000 processor card.

Here is the Z80 and 68000 assembler to setup and switch:


The XPU board automatically starts up in the Z80 mode of operation. When a
1 is output to port FFh, control switches to the MC68000/68010.

When the MC68000/68010 is first used, after power-up or system reset, it obtains
its stack pointer (sp) from location 0 and its program counter (pc) from location
4. 

Subsequently, when control switches from the Z80 to the MC68000/68010,
the program continues execution as though it had not been interrupted.

ld hl,intdat    ; init stack to 0x6000
ld de,0         ; init prog counter 0x7000
ld bc,8
ldir


ld a,l           ; switch control to
out Offh,a       ; Motorola 68000

intdat: 
 db 0, 0, 60h, 0 ; location of stack
 db 0, 0, 70h, 0 ; starting address


To switch from the MC68000/68010 to the Z80, output a 0 to port FFh. This may
be done by writing to the top 64K of memory as follows.


move.b #O,Offffffh


I bought a Cromemco UNIX.
Only 20 years later, but then Marcus is an extremely patient man: I found a Cromemco UNIX system at a price I could afford.

In fact I bought 2 systems and had them expensively freighted over from America.   Finally, I found a third system and actually flew to America to salvage it for parts.

Can I get a medal for dedication?

I wasted another 7 years
So, I was really busy.  And so after doing over 2000 hours of Z80 and 68000 Cromix restoration I had really no time for the UNIX work, except of course to make some UNIX backups of the then running systems  (but see below!)

Only 1 system left in 2014


I tested each of the 3, start of the Art  (in 198x) Maxtor Hard disks:

1 Dead as a dodo
1 Spins up, but loud clicking and unreadable

1 Seems to work but the UNIX filesystem contains errors

A sick System
So I am down to 1 bootable system :-(

On the positive side it does boot up.

On the negative side there are both low level errors printed to the console from the STDC disk controller, and I am not aware of any other working system on the planet.  Screw this system up and well, it could be the end for Cromemco UNIX V.2 as we know it.

But wait, I did make some backups 7 years ago.


Desperate Backup Times
I found that my existing system backups of 7 years ago were flawed! Surprisingly, using the -cuv  (Create UNIX verbose) option of the ftar backup program results in NOT saving the DEVICE files.

And without the DEVICE directory the system cannot start!

Had I used the -cv option  (i.e the Cromix standard, on the UNIX system !!) then a restore would have worked.

SO, before this last one and only remaining system died I had to make a emergency backup

Each time I started the machine I lived in fear that this the remaining hard disk would fail catastrophically. All I needed to do is make a good backup (well and test it!)


But New Backups kept failing!
As the ftar program tried to access the program /bin/tee it crashed!

So after some soul searching I deleted /bin/tee and some other directories that were also causing (minor) errors.  Result:  I successfully ran the ftar -cv backup first of only the device files to a floppy disk, and then of the entire system to tape thus:

ftar -cv /dev/rqic/0  /

All useful files are thus backed up, well except for one!


Restoring the system to a Fresh Hard disk
I did not have trouble restoring the system though it is a multiple step process.  I will document it in detail.  But the overview is:


a) place a new hard disk in system, noting disk geometry

b) low level initialise the disk and make a UNIX filesystem
c) restore the tape to hard disk



d) boot UNIX  from special XDOS floppy and write a special boot loader, I think to track 0

The restore process used the standalone operating system XDOS (XXU Disk Operating System) and specially compiled standalone utilities.

Where is /bin/tee?
I had to delete this program on the system because I got a bizarre low level STDC disk controller error when this file was accessed.   I could not make the backup with tee present.

So how to get the friggin file back?

Tape restore failed
In principle I had some 7 year old tapes written in ftar format. Initially however all restores either failed or produced a zero byte file restore.  Hmmm.


# #
# ftar -xuv /dev/rqic/0 ./bin/tee
End of file

# tar -xvf /tmp/bin.tar ./tee
x ./tee, 13356 bytes, 27 tape blocks
Tar: tape read error

But finally worked!
I tried multiple different tapes from the backups of now defective hard disks.  Eventually


#  ftar -xuv /dev/rqic/0 ./bin/tee

Extracting "./bin/tee"

# ls -l

total 1
drwxr-xr-x   2 root     root          48 Mar  9 21:42 bin
# cd bin
# ls -ltr
total 28
--wx-wx-wx   1 bin      bin        13356 Feb  1  1990 tee
cp ./tee /bin/tee

Now I need to make a correct and full backup



And So to close
It is now 27 years later than I had planned, but I am now investigating Cromemco UNIX V.2 on my newly working perfectly Cromemco 250 system.

To be continued.

Goodnight.