| I have decided to try out some old CP/M software, but need something to run it on. I could either do this on my Commodore 128 or through emulation. Unfortunately the 1571 disk drive for my Commodore is currently out of action, so that leaves me with emulation. I was going to use vice to emulate a C128, but have always found it a pain to get CP/M files onto .D64/71 disk images. After looking around for the best emulator to run CP/M on, I came up with either YAZE-AG or z80pack. z80pack seems to be better supported, has more documentation and is being actively developed, so that's the one I have chosen for this article. |
Installing z80pack
- First download the source (z80pack-x.y.tgz, currently z80pack-1.16.tgz) for z80pack from its ftp site. The following installation instructions are taken from the z80pack site. More information can be found there, in particular, information on installing z80pack on non Linux/Unix systems.
- Unpack the source archive in your home directory:
$ tar xzvf z80pack-x.y.tgz - Change the directory it is extracted to, to make this article easier to explain. There is no need for you to do this.
$ mv z80pack-1.16 z80pack - Compile the emulator:
$ cd ~/z80pack/cpmsim/srcsim
$ make
$ make clean - Compile the support programs:
$ cd ~/z80pack/cpmsim/srctools
$ make
$ make clean
Creating disk images
We now needed to create some disk images; to do this I recommend Cpmtools which is a part of many Linux distros. If you don't have this as part of your distro, the source can be downloaded from here. Cpmtools is a great collection of tools used to manipulate CP/M images and file systems in a variety of formats and works well with z80pack.Create a 4Mb Hard Disk Image
It would be useful to create a 4Mb Hard Disk Image, as this may be needed if we want to use any bigger applications such as a C compiler. To create this we can use Cpmtools, but first we need to make sure that it has the correct disk definition by editing /etc/cpmtools/diskdefs and adding the following lines:# 4mb HDD for z80pack
diskdef hd
seclen 128
tracks 255
sectrk 128
blocksize 2048
maxdir 1024
skew 0
boottrk 0
os 3.0
endCP/M has 16 'user areas' which can be used to organize data on a disk. They are effectively like a crude directory system. User area 0 is the default and the only one we will work with in this article.
To create a blank 4Mb Hard Disk image called main.hd4.cpm, run:
$ mkfs.cpm -fhd main.hd4.cpm
Then to copy all the .COM files from the current directory into the image in user area 0, run:
$ cpmcp -fhd hd4.cpm *.COM 0:
Create a Floppy Diskette Image
To create a floppy diskette image called, work.dsk.cpm, run:$ mkfs.cpm work.dsk.cpm
Then to copy all the .DOC files from the current directory into the image in user area 0: run:
$ cpmcp work.dsk.cpm *.DOC 0:
Configuring z80pack
We now have a 4mb disk image and a floppy disk image. We can connect them to the emulator by creating a script in the ~/z80pack/cpmsim/ directory called work. First copy main.hd4.cpm and work.dsk.cpm to the ~z80pack/cpmsim/disks/library/ directory. It is also worth copying them to the backups directory as well: ~/z80pack/cpmsim/disks/backups/Now create a script in ~/z80pack/cpmsim/ called work to start z80pack with our disk image files attached:
#!/bin/sh
rm -f disks/drive[abci].cpm
ln disks/library/cpm3-1.dsk disks/drivea.cpm
ln disks/library/cpm3-2.dsk disks/driveb.cpm
ln disks/library/work.dsk.cpm disks/drivec.cpm
ln disks/library/main.hd4.cpm disks/drivei.cpm
./cpmsim -f4
This attaches the two CP/M disks on drive A and B, our work.dsk.cpm image on drive C, and our main.hd4.cpm image on I:
The line
./cpmsim -f4 tells the emulator to run at 4Mhz, which makes it a bit more realistic.
Starting the emulator
From the ~/z80pack/cpmsim/ directory, run the script we created:$ ./work
The CP/M operating system will now boot up and leave you at the A> prompt.
To leave the emulator type:
A> a:bye

