Introduction
More by chance than anything else, I stumbled across Udo Munk's Z80 CP/M emulator while researching on the Internet. And so I thought, why not try it out on my iMac with macOS (11.6.1) Big Sur?
At the beginning I was not sure whether I had to install any compilers or assemblers. As the German saying goes: The proof of the pudding is in the eating. And lo and behold, everything is on board. Just use the correct makefile (Makefile.osx) and ... that's all.
It's not quite that simple, of course, but if you follow the instructions (README-cpm), you'll be ready in a few minutes.
And then there is another Z80 emulator called YAZE-AG (Yet Another Z80 Emulator by Andreas Gerlich, University of Ulm, Germany).
Contents
- MAKE(ing) the z80pack
- CPMSIM (handling with disk images, sending and receiving files, examples)
- ALTAIRSIM
- IMSAISIM
- CROMEMCOSIM
- Additional Software Installation (cpmtools, homebrew and others)
- MAKE(ing) the YAZE-AG
MAKEing the z80pack
If you only want to compile the CPMSIM simulator, just follow the instructions in README-cpm.
However, if you also want to MAKE the ALTAIRSIM, IMSAISIM and CROMEMCOSIM simulators, you must first compile the necessary libraries in /FRONTEND and /WEBFRONTEND.
If you do NOT want the frontpanel versions, then you can disable them in:
=> z80pack/“machine“/srcsim/sim.h.
Furthermore, the installation of additional software is mandatory, see below: „Additional Software Installation“. For working with images and files, cpmtools in particular is required.
CPMSIM
To start the CP/M 2.2 emulator, simply call the shell script cpm2. In the following content you can see very well how the disk images are handled. Note: drivea.dsk is hard-linked to cpm2-1.dsk!
In other words, whatever you do to the files/contents in drivea.dsk, you do to the cpm2-1.dsk image! For this reason you should ALWAYS have a backup directory with the original disk images!
I renamed cpm2 to cpm2.sh so that I can easily customise the file with a text editor. For example, I start the simulator with the option -f4 so that the CPU only works at 4 MHz. You can also user the 4 MByte hard disk image with the CP/M 2.2 emulator as drive I:.
#!/bin/sh
# delete all existing disk images in /disks
rm -f disks/drive[abcdi].dsk
# make hard-links for the floppy drives/images A: to D:
# image format: ibm-3740
ln disks/library/cpm2-1.dsk disks/drivea.dsk
ln disks/library/cpm2-2.dsk disks/driveb.dsk
ln disks/library/cpm2-3.dsk disks/drivec.dsk
ln disks/library/cpm2-4.dsk disks/drived.dsk
# make hard-link for the hard disk image I:
# image format: z80pack-hd (4 MByte)
ln disks/library/hd-tools.dsk disks/drivei.dsk
# start emulator with 4 MHz CPU
./cpmsim -f4 $*
Handling with Disk Images
The /DISKS/LIBRARY directory contains the disk images you are „working“ with. Here you create a corresponding image for each of your applications, for example for Wordstar, Turbo-Pascal, Basic and so on.
In the /DISKS directory, the images always have the same file names. Here, the start scripts, e.g. CPM2.SH (see above), create the corresponding hard links for drives A: to D: and I:.
And to make sure that everything is nicely backed up, place all originals in the /DISKS/ORIGINAL directory and your backups in /DISKS/BACKUP(n).
/CPMSIM ................. bin files and start scripts
/CPMSIM/DISKS ........... drivea.dsk to drivei.dsk
/CPMSIM/DISKS/LIBRARY ... working images
/CPMSIM/DISKS/ORIGINAL .. original images (do never change)
/CPMSIM/DISKS/BACKUP1 ... 1st backup
/CPMSIM/DISKS/BACKUP2 ... 2nd backup
...
Sending and Receiving ASCII Files
You do not mandatory need cpmtools to send and receive ASCII files. For this you can use the programs send and receive, which are included in the z80pack.
For sending binary files use the cpmtools or use the combination of bin2hex, send & load.
HOST site:
bin2hex -o 256 file.com file.hex
send d.hex &
CPMSIM site:
pip file.hex=rdr:
load file.hex
... done ...
Do not forget the option „-o 256“ !
Examples
Why not just building a ROM file, for example the 81-149C for the Kaypro II.
Since I have never worked with an assembler and linker under CP/M 2.2, I asked someone who knows: Douglas Miller (durgadas331: Virtual Kaypro Computer). Some time ago I had already contacted him. We are both members of the VCF. No sooner said than done and after one day "time difference" between Minnesota, USA and Lower Saxony, Germany his answer was already there.
Below the result:
The CRC sum is not 100% identical, but the monitor ROM works fine. I have tested it.
And here the commands. The programs M80 and L80 are on drive A. The ROM file KPIIROM.MAC is on drive C.
C>A:M80 KPIIROM,KPIIROM=KPIIROM
No Fatal error(s)
C>A:L80 KPIIROM.REL,KPIIROM.BIN/N/E
Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft
%Overlaying Program area
Data 0000 07FF < 2047>
47163 Bytes Free
[0000 07FF 7]
Origin below loader memory, move anyway(Y or N)?N
C>DIR
C: KPIIROM MAC : KPIIROM PRN : KPIIROM REL : KPIIROM BIN
C>
Thanks again to Doug!
ALTAIRSIM
Besides the CP/M 2.2 Z80 emulator CPMSIM, you can also simulate the Altair 8800 (ALTAIRSIM) with the corresponding front panel.
IMSAISIM
Besides the CP/M 2.2 Z80 emulator CPMSIM, you can also simulate the IMSAI 8080 (IMSAISIM) with the front panel in 2D or 3D. Amazing!
Now switch ON the IMSAI, set (EXAMINE) address to 0000h and RUN.
CROMEMCOSIM
Besides the CP/M 2.2 Z80 emulator CPMSIM, you can also simulate the Cromemco Z-1 (CROMEMCOSIM); with network support! I did not test it.
Additional Software Installation
If you only want use the CP/M simulator (CPMSIM), then you only need the cpmtools. If, however, you also want to use the Altair 8800 simulator (ALTAIRSIM), for example, then you must first install a few more software. On macOS I use Homebrew for this task.
Homebrew
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
% (echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/USERDIR/.zprofile
% eval "$(/usr/local/bin/brew shellenv)"
Dozens of messages and possibly warnings are issued during installation. Read them carefully and pay attention to them! If everything is done, you should find the cpmtools (as symlinks) in /usr/local/bin and the diskdefs in /usr/local/share. Here is my logfile.
cpmtools
In addition to the z80pack, you must also install the so-called cpmtools by Michael Haardt. You need these tools to write or read individual files in a diskette image. These tools are already available for DOS as EXE files. On UNIX or macOS you must install them first.
% brew install cpmtools
Douglas Miller:
Be aware that older versions of cpmtools don't work great with Kaypro [II/IV] disks because Kaypro used part of the directory area for an extension to the boot tracks. You'll need a version that supports the "dirblks" parameter and has the kaypro diskdefs modified to set 'dirblks'.
I have installed cpmtools 2.23 with Homebrew but you can also compile all binaries the classical way with the GCC compiler. I do not recommend this classical way! Use Homebrew instead. You can find the current source files on Michael Haardts homepage.
----------------------------------------------
| examples from DISKDEFS |
----------------------------------------------
# Kaypro II
diskdef kpii
seclen 512
tracks 40
sectrk 10
blocksize 1024
maxdir 64
dirblks 4
skew 0
boottrk 1
os 2.2
end
# Kayro IV
diskdef kpiv
seclen 512
tracks 80
sectrk 10
blocksize 2048
maxdir 64
dirblks 2
skew 0
boottrk 1
os 2.2
end
----------------------------------------------
| list content of image |
----------------------------------------------
cpmls -f kpii image.dsk
----------------------------------------------
| copy file.com from host to image user 0 |
----------------------------------------------
cpmcp -f kpii image.dsk file.com 0:file.com
----------------------------------------------
| copy file.com from image user 0 to host |
----------------------------------------------
cpmcp -f kpii image.dsk 0:file.com file.com
If you want to dig deeper into the CPM-Floppy-Definitions for cpmtools and libdsk then you must read Larry Kraemers HowTo (135 pages).
X11, OpenGL, JPEG
Update 17.12.2021: By chance I found a post by Udo Munk on the internet in which he describes the procedure:
[Udo Munk] You need to install a jpeg development library which Apple won't include because questionable licence issues. On OSX: brew install jpeg. On OSX you install xcode and xquartz, then you have everything to compile and run X applications. Of course Apple provides OpenGL with the X implementation.
My approach: For the Altair 8000 Simulator (ALTAIRSIM) you need three additional software libraries for the frontpanels. The installation on macOS is also done with Homebrew.
- X11
- OpenGL
- JPEG
% brew install xquartz
% brew install jpeg
% brew install flgl
% brew install glew
Whether both OpenGL libraries flgl and glew are eally required I cannot say. I have installed both on the off chance and ALTAIRSIM runs! I did not install xcode.
YAZE-AG - Yet Another Z80 Emulator by AG
Out of curiosity, I installed Andreas Gerlich's YAZE-AG Z80 emulator under macOS. There is no special Makefile for macOS. I used Makefile_solaris_gcc-x86_64 for it. I only had to comment out LIBS = -lrt with the # and that was it. It seems to work.
Simulate, Emulate, Virtual
An explanatory approach to the three terms. These explanations were immediately obvious to me. But, I'm sure there are many more! ¯\_(ツ)_/¯
Simulate
The term "simulate" stands for "to imitate realistically" - with emphasis on "realistically".
One example is the large flight or driving simulators used to train pilots. Elaborate software and hardware are used to try to reproduce a particular scenario as accurately as necessary.https://www.giga.de/ratgeber/specials/was-ist-der-unterschied-zwischen-simulation-emulation-virtualisierung-computertechnik/
Emulate
The term "emulate" only stands for "imitate". In contrast to the simulator, the fidelity to reality is neglected here.
In this case, the emulator is a PC software that displays the game on your screen as you used to see it on the Super Nintendo console. The big difference: it's just software; there's no replica of the console. And even internally - "under the hood" - the software works differently than the actual console did. The end result here is what's important: You can see your old Super Nintendo game on the PC screen and play it just like in the old days.https://www.giga.de/ratgeber/specials/was-ist-der-unterschied-zwischen-simulation-emulation-virtualisierung-computertechnik/
Virtual
The term "virtual" stands for "non-physical". In virtualization, the boundaries between simulation and emulation become blurred.
For example, virtualizer software lets you use other operating systems in a window under your current operating system and exchange files between "host" and "guest" operating systems. The software emulates the missing PC hardware of the virtual operating system and forwards hardware requests to the real hardware of the physically existing PC (CPU, graphics card, hard disk). Ultimately, this "simulates" an operating system, but its hardware is emulated and runs on the real hardware of another system.https://www.giga.de/ratgeber/specials/was-ist-der-unterschied-zwischen-simulation-emulation-virtualisierung-computertechnik/
Downloads
- Testing the z80pack / only CPMSIM (CP/M 2.2 for macOS, compiled on Big Sur, 11.6.1)
Manuals
- README-cpm / Quickstart to run CP/M and MP/M on the Z80-CPU simulation (txt)
- README-aux / The auxiliary device under CP/M emulation (pdf) / SEND and RECEIVE ASCII files.
- README-diskimages / Understanding disk images for the CP/M emulation (pdf) / In this text, the file extension is still CPM. In fact, however, the images have the extension DSK.
External Links
- Udo Munk's Z80 Emulator
- Udo Munk's Z80 Emulator on Github
- YAZE-AG - Yet Another Z80 Emulator by AG (Andreas Gerlich)
- cpmtools by Michael Haardts
- cpmtools by Mike Douglas (durgadas)
- CPM-Floppy-Definitions for cpmtools, libdsk, Flashfloppy/GOTEK by Larry Kraemer
- The Altair 8800 Simulator by Peter Schorn
- Altair Duino Pro - Replica and Simulator by Adwater & Stir / My Altair Duino Pro
- IMSAI 8080 - Replica and Simulator by The High Nibble