Creating your own CP/M disks

bbc/electron apps, languages, utils, educational progs, demos + more
Post Reply
User avatar
haerfest
Posts: 37
Joined: Fri Dec 17, 2021 10:28 am
Location: Assen, NL
Contact:

Creating your own CP/M disks

Post by haerfest »

My Electron has Dave Hitchin's ATI and a PiZero attached, happily running CP/M. But getting CP/M software from the web onto it was a bit of a puzzle. For others in the same boat (or myself in the future :lol:) I thought I'd do a little writeup.

What we're dealing with:
  • A single 400 Kb Acorn CP/M disc is stored in a container file across two 200 Kb .SSD discs, one containing the data for the top side, the other for the bottom side.
  • These go, top and bottom, respectively in drives :0 and :2 (for A:) or :1 and :3 (for B:).
  • The top disc must be a valid .SSD (DFS, 80 tracks, single sided); the bottom one can be garbage as CP/M overwrites it in its entirety.
  • The top disc must contain one file called CPMDISC, filling up the entire disc.
  • As described in J.G. Harston's AcornCPM, CP/M tracks are numbered 0-79 on the top disc, but 79-0 on the bottom one, so we'll need to do some reversing along the way.
I'm on a Mac and this is the software I used:
To get e.g. Zork 1 onto the Electron:
  1. Create an empty CPMDISC file of the right size:

    Code: Select all

    $ dd if=/dev/zero of=CPMDISC bs=1 count=204288
    
  2. Use MMB_Utils to create a new .SSD image named zork1.cpm, add the file to it and lock it if desired:

    Code: Select all

    $ beeb blank_ssd zork1.cpm
    $ beeb putfile zork1.cpm CPMDISC
    $ beeb access zork1.cpm CPMDISC L
    
  3. Extend it by the size of another .SSD image (for the bottom side), creating a single Acorn CP/M volume zork1.cpm:

    Code: Select all

    $ dd if=/dev/zero bs=1 count=204800 >> zork1.cpm
    
  4. With Cpmtools installed, edit /opt/local/share/diskdefs and add the acornsd format to the end, as described in AcornCPM:

    Code: Select all

    diskdef acornsd
      seclen 512
      tracks 160
      sectrk 5
      blocksize 2048
      maxdir 128
      skewtab 0,2,4,1,3
      boottrk 3
      os 2.2 
    end
    
  5. Format the disc for CP/M and copy the Zork 1 files for user zero:

    Code: Select all

    $ mkfs.cpm -f acornsd zork1.cpm
    $ cpmcp -f acornsd zork1.cpm zork1.com 0:
    $ cpmcp -f acornsd zork1.cpm zork1.dat 0:
    
  6. Split the file in two halves again and rename the split parts zork1-top.ssd and zork1-bottom.ssd respectively:

    Code: Select all

    $ split -b 204800 zork1.cpm 
    $ mv xaa zork1-top.ssd
    $ mv xab zork1-bottom.ssd
    
  7. Now the tricky part: we have to reverse the order of the tracks on the bottom disc from 0-79 to 79-0. A track is 2,560 bytes in size (10 sectors of 256 bytes), so we split the bottom .SSD in blocks of that size and concatenate them in reverse order, creating zork1-bottom-reversed.ssd:

    Code: Select all

    $ split -b 2560 zork1-bottom.ssd
    $ cat `ls -1 x* | sort -r` > zork1-bottom-reversed.ssd
    
You now have two .SSD-like discs, zork1-top.ssd and zork1-bottom-reversed.ssd, that together make up one Acorn CP/M disc.

To use these with a working CP/M second processor setup, insert these in drives :1 and :3 respectively, making up a single CP/M drive B. For example, when using MMFS v1 with the discs in respectively slots 498 and 499:

Code: Select all

A>STAR DIN 1 498
A>STAR DIN 3 499
A>STAT B:*.*

 Recs  Bytes  Ext Acc
   68    10k    1 R/W B:ZORK1.COM
  664    84k    3 R/W B:ZORK1.DAT
Bytes Remaining On B: 294k
Getting data off of Acorn CP/M discs is essentially the process above in reverse:
  1. Get the two .SSDs that make up one Acorn CP/M volume onto your modern computer, say zork1-top.ssd and zork1-bottom.ssd.
  2. Realize that the bottom .SSD is reversed, so reverse its track order once again in exactly the same way as above, producing zork1-bottom-unreversed.ssd:

    Code: Select all

    $ split -b 2560 zork1-bottom.ssd
    $ cat `ls -1 x* | sort -r` > zork1-bottom-unreversed.ssd
    
  3. Combine both .SSDs together to create a single Acorn CP/M volume zork1.cpm:

    Code: Select all

    $ cat zork1-top.ssd zork1-bottom-unreversed.ssd > zork1.cpm
    
  4. Copy any files for user zero (for example) off of it:

    Code: Select all

    $ cpmcp -f acornsd 0:zork1.sav zork1.sav
    
Enjoy some Zork or Turbo Pascal :-)

- Wouter
User avatar
dominicbeesley
Posts: 2210
Joined: Tue Apr 30, 2013 12:16 pm
Contact:

Re: Creating your own CP/M disks

Post by dominicbeesley »

Thanks for the write up. I remember struggling with this in the past

D
User avatar
danielj
Posts: 9900
Joined: Thu Oct 02, 2008 5:51 pm
Location: Manchester
Contact:

Re: Creating your own CP/M disks

Post by danielj »

Top guide! Thank you :)
shifters74
Posts: 433
Joined: Mon Mar 04, 2019 9:44 am
Contact:

Re: Creating your own CP/M disks

Post by shifters74 »

Yup booked marked this post for future reference!

Thanks

Shifters
Post Reply

Return to “8-bit acorn software: other”