An emulator for Grant Searle's Multicomp — the Z80 build of his multi-CPU FPGA computer — running CP/M 2.2 off an SD card image. Written from the RTL, in about 500 lines of C.
Loading CP/M...
CP/M BIOS 2.0 by G. Searle 2013
CP/M 2.2 (c) 1979 by Digital Research
A>DIR
A: DOWNLOAD COM
A>
There was no software emulator for this machine: virtual-multicomp only runs
.hex files (no SD card, no CP/M), and the MiSTer ports are FPGA cores. So this
one models the hardware straight from the VHDL.
Linux (tested on Ubuntu 22.04, also fine under WSL):
git clone https://github.com/ajfa/multicomp-cpm
cd multicomp-cpm
./run.shThe first run downloads the ROM and CP/M utilities, builds the emulator, creates
a 128MB SD card image, formats its sixteen 8MB drives, installs CP/M and
DOWNLOAD.COM, and verifies the result. It then drops you at A>. Takes a few
seconds.
Keys:ctrl-] quits, ctrl-\ is the board's cold reset button. ctrl-C is
not an exit — it goes through to CP/M as a warm boot.
| Command | What it does |
|---|---|
./run.sh | build if needed, prepare the disk, boot CP/M |
./run.sh --check | headless self-test, prints PASS or FAIL |
./run.sh --rebuild | rebuild the emulator and the disk from scratch |
./run.sh --monitor | stop at the boot ROM monitor (SPACE, then X and Y) |
./run.sh --mc2g | boot the mc-2g-1024 machine instead (see below) |
Modelled on MicrocomputerZ80CPM.vhd, bufferedUART.vhd and
Components/SDCARD/sd_controller.vhd from the MiSTer port of the design:
| CPU | Z80 (superzazu's core, MIT) |
| ROM | 8K at 0000-1FFF, paged out by OUT (38h). While the ROM is selected the internal RAM underneath is deselected, so writes there are discarded — same as the FPGA |
| RAM | 64K internal |
| Console | 6850-compatible UART at $80 (status/control) and $81 (data) |
| Second port | UART at $82/$83 |
| Disk | SD controller at $88-$8F: 0 SDDATA, 1 SDSTATUS/SDCONTROL, 2-4 SDLBA0-2, 512-byte blocks by LBA |
The card is 128MB = 16 CP/M drives of 8MB (A: to P:).
-m mc2g emulates Rienk Koolstra's Multicomp derivative: 2K monitor ROM, OUT $39 switches it back on, 1MB of RAM behind the MMU4 ($F8 selects the page,
$FD sets its 16K frame), a 50Hz interrupt, baud rate generators at $7B/$7E
and a video terminal at $82/$83. Its multiboot monitor runs; note that an SD
image whose volumes have empty system tracks (a RomWBW data disk, for instance)
has nothing to boot, and Snnn will just reset the machine.
Not by forging sectors from outside. run.sh runs Grant's own utilities on the
emulated machine, feeding the Intel-HEX files through the serial port exactly
as you would paste them into a terminal:
FORM128.HEX→G5000— formats the sixteen drives.CPM22.HEX+CBIOS128.HEX+PUTSYS.HEX→G5000— writes the system to the boot track.- Boot CP/M, press cold reset (RAM survives, as on the real board), load
DOWNLOAD2.HEX, run the stub at$FFE8which copies4100→0100and restarts CP/M, thenSAVE 2 DOWNLOAD.COM.
A non-system drive in Searle's CBIOS (DSM=2047, DRM=511, 4096-byte blocks, no
reserved tracks) has exactly the same geometry as the data area of an mc-2g /
RomWBW 8MB volume, so those file systems transfer 1:1:
SRCDISK=disks/yourimage.dat ./run.sh --rebuild # imports volumes 0-4 into B:-F:
./import-slices.sh 5:6 6:7 # or pick volume:drive pairs
./tryvols.sh disks/yourimage.dat 001 002 # try to boot volumes of an imageSource volumes are 16640 sectors apart with 256 reserved; target drives are 16384 sectors apart, drive A: staying with CP/M.
-m NAME machine: 'searle' (default) or 'mc2g'
-r FILE boot ROM, Intel HEX or raw binary
-d FILE SD card image
-f FILE feed FILE into the console as if typed (repeatable);
a 0x1C byte presses cold reset, 0x1E waits for the machine to go quiet
-e exit once the fed input is consumed and the machine goes quiet
-l FILE log all console output
-T SECS stop after SECS
-R open the SD image read-only
-b batch mode, never read the real keyboard
Every SD write is buffered until the 512-byte block is complete, then written and flushed, so killing the emulator cannot tear a sector. Files still open in CP/M when you kill it are lost, exactly like pulling the card out of the real board.
The emulator (src/multicomp.c, the scripts) is under the GNU General
Public License v3.0 — see LICENSE. Parts of this repository are
other people's work and are not covered by it — see NOTICE.md.
Contributions require the agreement in CLA.md; see
CONTRIBUTING.md.
The Z80 core is by Nicolas Allemand, MIT, see src/LICENSE.z80.
The boot ROM, BIOS, formatter and transfer utilities are Grant Searle's work
and are deliberately not redistributed here — his terms ask that they not be
republished elsewhere without permission. fetch-roms.sh downloads them at build
time from the MiSTer ports that already carry them. Original design and
documentation: http://searle.x10host.com/Multicomp/. No disk images with
third-party CP/M software are included either.
RTL used as reference: MiSTer-devel/MultiComp_MiSTer and RW-FPGA-devel-Team/Mister_mc-2g-1024. CP/M 2.2 is Digital Research's.