Transferring data into CP/M with SIMH

This has been an exersize in insnaity..

So for some strange reason I wanted to load up Zork into SIMH‘s less featured (and much simpler) altair 8080 emulator.  The catch is the disk format which for the life of me I couldn’t get to work in any of the CP/M disk access tools.

The Altair z80 emulator as part of the same SIMH package includes a far more complicated setup, but out of the box it CANNOT read the disk image from the 8080 emulator.  After digging around it seems that one of the ‘approved’ methods of getting stuff into CP/M was to load it into memory, and just save the block (provided it fits in the 64k, more on that later).  The syntax really is quite simple:

load zork1.com 100

And that’ll load it up at the normal program entry point (just like an MS-DOS COM file!)..

Except it doesn’t want to work.

What?

but of course it works on the z80.

No problems here!

Which is great but the z80 can’t read the 8080’s disks..!  So after digging through the source code, I find this small gem that the z8080 has been changed to use a much larger disk size!

#define MAX_TRACKS 254 /* number of tracks,
original Altair has 77 tracks only */

So yes, by changing that to 77 I can now boot off the 8080’s boot disk on the z80!  Of course it also means that I’m unable to ‘see’ the hardisk in the z80, or any of the other great peripherals as no doubt the altair CP/M disk hasn’t been configured for all of these fine things.  I also tried only altering one of the disks on the z80 for 77 tracks, but once more again it seems that CP/M has an everything/nothing type idea for a disk controller.

But the load command works on the monitor, and the Altair CP/M can handle two disks, so its enough for me to format the B: drive ( a copy of the CP/M disks) and work with that.

Once you’ve loaded a program into memory, you toggle back to CP/M and run the ‘save’ command which then dumps how many pages back to disk.

For example, the program STAT is 5,248 bytes in size. 5248/256 = 20.5. Thus, the save command would be:

A>SAVE 21 STAT.COM

Pretty simple, right?  But what happens if you have a file greater than memory?  Well first I thought I could compress it, and I’d forgotten just how many old compression programs there were for CP/M, crunch, arc, zoo, zip … Finding MS-DOS equivalents wasn’t too bad (thanks for dosbox!) but I couldn’t get the 84kb data file into the memory limit, so I figure’d I’d just split the file into something on  a 256 byte boundary.  Loading them into RAM wasn’t too hard, as saving them out.. but how do you join them together on CP/M?  I found PLENTY of utils to split files, but nothing on putting them back together!

On MS-DOS you can just do a copy /B file1+file2 bigfile

But I couldn’t find out how to do this on CP/M until I looked further into the PIP command, CP/M’s answer to copy.

To join a binary file it goes something like this:

>PIP sd.com=sd.001[OV],sd.002[OV],sd.003[OV]

So with all that work, I was now able to create a zork1.dsk that the 8080 emulator is capable of playing!

Zork1 finally loaded on the SIMH Altair 8080

And for the curious, here is Zork1, in the old Altair 77 track format.

 

 

Leave a Reply