Tuesday, October 22, 2024

"Thou shalt get side tracked by bulls*** every go**am time." - The Ghoul, Fallout

While waiting for a couple of logic chips and a Z8 microprocessor to arrive from everyone's favourite auction site to try in the errant OMTI board, I thought I would spend some of the limited spare time I get to install a gotek in the Cifer.

My thinking on this was that the hard disk is still not working and the floppy drive has been 'pinched' for the Torch (for now). If nothing else, it would be cool to have a gotek loading up CP/M on the Cifer and would give me an excuse to play with my 3D printer to create a black front plate that matches the current floppy drive bezel.

First things first.

It's been a while since I had the Cifer switched on and I have been guilty of pilfering some RAM from its non-functional 68000 expansion board. Well, to be honest, I've nicked all of it. I suspect I may have to do a bit of a bulk buy if I can find any large lots of RAM lurking online. 


Ah. Not only missing the RAM the 68K board is also
missing the err... MC68000. Oops.

It's been spread across various machines (including the Torch) with the result that the Cifer has been left open, sat on its side with the innards hanging out. What could possibly go wrong?


It's like a vintage computer horror film...

So today, I found the various screws I had and, after tidying up the boards and cables, affixed the base plate and turned the Cifer main unit back onto its feet. After plugging it in and switching it on, imagine my slight sadness that it appeared the unit was dead. The fan started up OK but it's an AC fan connected directly across the mains voltage so it's always going to work. But nothing appeared on the CRT. Darnit.

I reached for the reset switch and, fortunately, the CRT sprang into life but showed a garbled screen of incomprehensible garbage. Double darnit. 


Artists impression - this is an old pic but you get the idea..

Side Track 1

Immediately, I suspected the display RAM which just so happens to be on the largest board inside the Cifer, buried deep inside. Off came the base plate, out came the 68K board and the 4010 graphic emulation board, until finally, I got down to the display board. There's a gaggle of eight RAM chips in the bottom right corner and it was one of these that I had replaced the first time I worked on this machine. My RAM tester is in a very different condition now, having been 're-factored' onto a prototype board which is firmly fixed into a 3D printed case, rather than just a bare bread board, but it still works as advertised.


OK, so it's not the most exciting 3D printed
case on the planet


First chip, faulty. 

Oh, no.

Second chip....

Fully working. As was the third, fourth and, in fact, the rest of them. I went back to double check the first chip failure to confirm it wasn't just a dirty contact on the tester's ZIF socket. It still failed and I actually checked it another three or four times just to be certain. I did have one RAM chip left on the 68000 board but, ironically, it's a Sanyo chip which was harvested from an Amiga RAM expansion several years ago. But it tested OK (even it it's technically the wrong RAM size - the pin out is compatible but it won't use the top bit) so I installed it onto the board.

And...success! The display appeared exactly as it should with a line of options at the bottom of the screen and a friendly flashing cursor on the top left.


Phew! Normal service resumed...


At this point I cobbled up the necessary cable to connect the gotek into the system, The current floppy drive and the gotek both use 34 pins but the physical drive uses the edge-connector style connector and the gotek uses 34 pins. After a false start I realised that the floppy cable in the Cifer is quite long and extends deep into the case before appearing at one of the external connectors on the back. This meant it wouldn't be easy to just use any old floppy cable so I decided to put an IDC connector on the existing cable far along enough to reach the rear of the gotek when installed, but far enough away from the existing plug that they can co-exist.

And so, once this was done (which involved two pairs of pliers, at least one piece of pinched skin and several colourful words) I was ready to get the unit back together and plug in the gotek. I also didn't quite get it far away from the existing plug, but that's a problem for another day.


Additional 34 pin connector

And then I realised I hadn't plugged in the keyboard. Obviously, I plugged it in and started the Cifer up again.

Side Track 2

BEEEP BEEEP BEEEEEEP

Oh, dear.


Garbage in, garbage out.
But I've seen this happen before..


The keyboard was spouting tonnes of garbage onto the screen. Disconnecting the keyboard stopped the garbage so, there's something wrong with the keyboard now. 

Triple darnit.

The keyboard has a bunch of standard logic chips and a few other passive components so I did what any enthusiastic amateur would do. Throw parts at it! First, I tried changing the chips that I'd previously replaced which were in sockets. This made no difference. So then I started removing and then testing the remaining chips starting from the end with attached curly cable. And when I reached to CD4040, my tester declared the chip was "BAD". Ah-ha! I had a couple of these in the box 'o bits so, after fitting a socket (actually two small sockets as I'd run out of the actual size required) and pushing a new chip home, I tried again.


The keyboard board. Another earlier pic prior to 
the original repair attempt


CD4040 at IC8 - now socketed

And...


Success!! The keyboard was behaving itself and I could type as previously and, more importantly, I could press 'F6' followed by the 'Disc' key to trigger the OS load function. 


Back on Track

So now I have a gotek, a cable with the right connector and a computer waiting for an operating system disk. This brings us all the way back to getting an appropriate disk image on to the gotek. With the excellent greaseweazle, it's easy to 'rip' an image from an existing disk - assuming you have a working floppy drive of course.

Fortunately, I have one working 5 1/4 floppy drive (from the Cifer itself) and a bucketload of disks to rip. But first, I need to make sure that I can actually get the correct format. The Cifer has a slightly odd disk format which includes Track Skew and Sector Skew attributes. When data on the disk is written or read, once one track has completed writing or reading, the heads then move to the next track. The movement of the heads takes a finite amount of time so the skew ensures that, in the time it takes to reach the end of one track and move the head to the next, the start of the next track (or first sector) arrives under the head at the point the head reaches that track. That is, the data is skewed from one track to the next by the angle the disk would advance in the time the head needed to step from one track to the next. (See here.)

Similarly, the sector skew value does the basically the same but on a sector level rather than a track level. The upshot of all this is (allegedly) more efficient and faster read/write access to the disks.


Photo of a screenshot of a photo (!) of the Cifer disk format


All this is very important when we want to 'rip' a disk and create an image to use on the gotek. 

Back to greaseweazle. The first thing to do is hook up the greaseweazle with the floppy drive and check it works. The large units like the 5 1/4 inch unit I have here, mean that I need to use an external power supply to do the job. They need +12v so a USB cable isn't going to cut it here.

Next, with the greaseweazle software installed and a disk inserted, we issue the command:

gw --drive 2 seek 70

This makes the head move to track 70 (other tracks are available) and is a good verification that the greaseweazle can see the drive and communicate with it.

Next, we capture a raw .scp file which is a single file that captures the actual flux variations in the magnetic coating on the disk itself. They tend to be quite large but are the best way to ensure a good 'master' copy of a disk.

gw --drive 2 read myTestFloppy.scp


Typical greaseweazle output when reading a disk
(This is from a linux powered PC but is the same for Win)


Once it's done, I tend to load the image into the most excellent HxC floppy disk emulator software so that I can see a representation of the actual disk. Example below!


HxC Floppy Emulator - This is when things go well!


Now comes the slightly tricky bit. We need to convert the .scp file into something a bit more friendly for the gotek. This could be done by specifying all of the needed parameters at the gw command line but that would be really cumbersome. Fortunately, gw has several 'built in' disk formats and also allows you to define your own. For the Cifer, the disk format is like this:

# prefix: cifer.

disk dsdd
    cyls = 80
    heads = 2
    tracks * ibm.mfm
        secs = 10
        bps = 512
        rate = 250
        cskew = 2
        hskew = 4
    end
end

So the 'prefix' bit is the name of the format i.e. cifer. Then the 'dsdd' is the format of the disk needed. All of the other bits are the parameters passed to gw so we don't have to enter them ourselves. This includes an 'ibm.mfm' option since it does use that particular encoding. So the conversion line for the file looks something like this:

gw convert --format=cifer.dsdd cifercpm1.scp testimage1.img

Nice and simple. :)

Each disk format has its own defs file that is stored (in Windows at least) in the greaseweazle-1.xx-win64\greaseweazle-1.xx\lib\greaseweazle\data folder. Earlier versions had a single giant diskdefs.cfg file but the version I've been using (1.20) uses the one file per format arrangement.

So, now I have an .img file containing CP/M. The question is, does it actually work? Let's find out.

The gotek was connected to the data cable and a suitably modified power cable (mod is reversible). I powered the Cifer on and could see that the display on the drive lit up. Using the two buttons on the front I made sure that the correct disk image was selected and then pressed 'F6' to select 'CIF' mode, and then the 'Disc' button followed by the enter key. 



All set up and ready to go.



And......


Ah. I think you'll find that it works. :D


That. Is. Freakin'. AWESOME!


Playing with CP/M


That worked an absolute treat! So now I can go and look at taking images of all the Cifer disks that I have in my boxes. And of course I also managed to get the 3D printer out to put it in a proper 5 1/4 in type enclosure. 

I think that I will put the gotek in the Cifer itself using the fancy 3D printed bracket, and extend the cable out so that I can plug in the physical drive unit if I need to. Oh, and I wondered if both drives would work on the one cable. Yes. Yes they do. Setting the gotek to DS0 and the TEAC drive to DS1, they behave impeccably (no pictures sadly) as drive A and drive B. And not a twist of a cable in sight IBM.

Here's the 3D printed bracket in all its glory! 



Naked(ish) gotek


Next time, I lose hours of my life trying to make the Torch TripleX boot..