| cpm | ||
| tools | ||
| .gitignore | ||
| README.md | ||
| screenshot.png | ||
WebCPM22
A browser port of PicoCPM22: CP/M 2.2 running on a Z80 interpreter, with RAM disks in the page.
Running it
The page loads its binaries and disk images with XMLHttpRequest, so it has
to be served over HTTP. Opening cpm/index.html with file:// will not work
in most browsers.
cd cpm
python3 -m http.server 8000
Then open http://localhost:8000/.
Drives
| Drive | Image | Contents |
|---|---|---|
| A: | cpm/disk.img |
CP/M utilities (DIR, STAT, PIP, ED, ASM, MBASIC, ZORK1, ...) |
| B: | cpm/diskb.img |
scratch disk |
| C: | cpm/c_disk.img |
HI-TECH Z80 C compiler V3.09 |
All three are RAM disks: changes are lost on reload, just like a RAM disk on
the Pico. If c_disk.img is missing, the page falls back to diskc.img.
Using the C compiler
The compiler lives on C:. A minimal program:
/* HELLO.C */
#include <stdio.h>
main()
{
printf("Hello from HI-TECH C\n");
return 0;
}
C> C HELLO.C
C> HELLO
Hello from HI-TECH C
C HELLO.C runs the preprocessor, parser, code generator, assembler and
linker; it prints nothing while it works, so give it some time (tens of
seconds on a slow machine). The -V option shows each phase:
C> C -V HELLO.C
A ready-to-compile HELLO.C is already on the compiler disk.
How it works
The page uses a microcoded Z80 interpreter:
cpm/zeditty.jsexecutescpm/microcode.bin.cpm/cpm22.binis the CCP + BDOS image.cpm/bios.binis the multi-drive Pico BIOS.cpm/disk.img,diskb.img,c_disk.imgare the RAM disks.
The page mirrors the Pico's warm-boot handling: on every program exit it reloads CCP/BDOS/BIOS from the host images instead of relying on the boot disk's reserved system track, and it regenerates the BIOS disk parameter blocks for the actual disk images (drive count, DSM, and EXM).
Repository layout
cpm/index.html browser UI and hardware glue
cpm/zeditty.js Z80 interpreter
cpm/microcode.bin current microcode table
cpm/cpm22.bin CP/M CCP + BDOS
cpm/bios.bin Pico multi-drive BIOS
cpm/*.img A:, B:, and C: RAM disk images
tools/ microcode regeneration tooling
Regenerating microcode
The canonical microcode source is in the Zeditty project. From a sibling checkout:
cd ../Zeditty/src
node build.js
cp microcode.bin ../../WebCPM22/cpm/microcode.bin
tools/gen_microcode.py is a fallback for rebuilding from PicoCPM22's
generated C implementation.
