Stage 3, Installing CP/M

A project log for Building a 22MHz Z80 Computer in 4 Stages

Step-by-step instruction on building a high-performance, CP/M-ready, expandable Z80 computer

plasmodePlasmode 03/03/2019 at 13:180 Comments

To support CF disk and CP/M, the ZMon64 monitor has several additional commands.  The monitor is tailored for a particular CP/M configuration which is four 8-meg disks as drive A/B/C/D.  The following is the disk parameter of each drive:
Drive A:
1024 sectors per track,
4096 bytes per block ,
track offset of 1,
512 directory entries

Drive B/C/D:
1024 sectors per track,
4096 bytes per block,
track offset of 0x40 from previous drive,
512 directory entries.

To format a new CF disk for CP/M, the directory area of each drive must be filled with 0xE5.  The 'x' command of ZMon64 formats the specified drive.  The command to format drive A, B, C, D are retrospectively:
Please note the drive letter must be in upper case.

ZMon64 also has a command to read a CF sector.  The command is 'r' followed by track number and sector number in hexadecimal.  Based on the disk parameters, drive A's directory starts from track 01, sector 00, drive B's directories starts from track 0x40, sector 0x00, drive C's directories starts from track 0x80, sector 0x00 and drive D directories starts from track 0xC0, sector 0x00.  Each drive has 512 directory entries, so that takes 32 sectors.  Picture below is a screen shot of a console session where directory of drive B is displayed with 'r 40 00' command.  Drive B is formatted with 'xB' command, and directory displayed again which show all '0xE5'

ZMon64 has two more commands related to CP/M: 'c' command to copy files into CF or RAM; and 'b' command to boot up a file.  For CP/M 2, the copy command is 'c2' and the boot CP/M 2 command is 'b2'.  Before executing the 'c2' command, the CP/M2 CCP/BDOS/BIOS must be first loaded in memory so 'c2' command can save it to designated location on a CF drive.  Both 'b2' command and CP/M2 warm boot access the designated location for CCP/BDOS/BIOS.

I'm not going to describe the process of creating BIOS for CP/M2.  Having a working CCP/BDOS/BIOS that is installed in a formatted CF disk with 'c2' command, the next step is to transfer CP/M executable files into the newly formatted CF disk.  The file transfer program is XMODEM, so load XMODEM.HEX first then boot up CP/M2 with 'b2' command, then type:

save 17

This will save the XMODEM.HEX image in RAM as a CP/M file called ''.  The first CP/M file is now created on the CF disk.  Use xmodem to transfer the rest of files to the CF disk with the command:

xmodem filename /r/c/z1

Instead of xmodem each individual files, it is easier to compress a collection of files, transfer it over, and decompress in CP/M.  There are many such compress/decompress programs, the one I used is arj.exe/  CP/M2 executable are compressed with arj.exe; I first xmodem the and compressed CP/M2 executable; then decompress it with

unarj e cpm2

Here is a screen shot of the series of operation to create CP/M files on a new CF disk.

WIth CP/M2 installed, one quick benchmark to run is ASCIIART.TXT which should take 52 seconds to execute on a 22MHz Z80.  At the CP/M prompt, type:

mbasic80 asciiart.txt

The following should be displayed.