A modern PL/M-80 compiler targeting Zilog Z80 assembly language.
PL/M-80 was the primary systems programming language for CP/M and other 8080/Z80 operating systems. This compiler can rebuild original CP/M utilities from their PL/M source code.
Repository: https://github.com/avwohl/uplm80
- Full PL/M-80 language support
- Targets Z80 instruction
- Multi-file compilation with cross-module optimization
- Multiple optimization passes (AST optimizer, upeepz80 peephole optimizer)
- Generates relocatable object files compatible with standard CP/M linkers
- Calls procedures the way Intel's PL/M-80 does, so its code links with assembly and objects written for PL/M-80
- Produces code competitive with the original Digital Research compiler
Compiled output is comparable to the original Digital Research PL/M-80 compiler:
| Program | DR PL/M-80 | uplm80 | Difference |
|---|---|---|---|
| PIP.COM | 7424 bytes | 7127 bytes | -4.0% |
pip install uplm80 um80 upeepz80From source: git clone https://github.com/avwohl/uplm80.git && cd uplm80 && pip install -e .
See INSTALL.md and README_RASPBERRY_PI.md for more.
uplm80 input.plm -o output.mac # compile (or: python -m uplm80.compiler)
uplm80 main.plm helper.plm lib.plm -o out.mac # multi-file, cross-module optimization
um80 output.mac # assemble to .rel
um80 x0100.asm # MON1 equ 5 and the rest
ul80 -o program.com output.rel x0100.rel # link to CP/M .comOptions:
-m cpm|bare|mpm- runtime mode (defaultcpm);barerebuilds DRI's utilities,mpmmakes MP/M II.PRL/.RSP/.SPRmodules-O 0|1|2|3- optimization level (default 2)-D SYMBOL- define a conditional compilation symbol (repeatable)-g- debug markers forudb80and GDB (0.5.0 and later); see docs/debug_info.md
Each module carries the runtime routines it uses; link with it only what defines its EXTERNALs. See examples/hellocpm.plm and the drop-in docs/example.Makefile (contributed by Martin Homuth-Rosemann, @Ho-Ro).
- docs/language.md - rules the compiler checks, as Intel's V3.1 does;
$IF/$SETconditional compilation - docs/calling_convention.md - calling convention, writing assembly PL/M calls, runtime routines, names in the output
- docs/runtime_modes.md - CP/M, bare and MP/M modes, memory layout, how procedure locals share
??AUTO - docs/multi_file_compilation.md - compiling several modules together
- docs/intel_oracle.md - differential testing against Intel's PL/M-80 V3.1, and the known differences
- docs/debug_info.md -
-g(0.5.0 and later): source-line and variable markers for a debugger (udb80, GDB); the code does not change - docs/BDOS_REFERENCE.md - calling CP/M BDOS from PL/M-80
- docs/project_structure.md - source files and what each does
- docs/PLM80_FEATURE_INDEX.md - language features and their tests
- CHANGELOG.md - releases and known issues
The front end is generated from plox grammars; peephole optimization is upeepz80.
GPL v3.0 or later - see LICENSE. Issues and pull requests are welcome.
- 80un - Unpacker for the CP/M archive and compression formats LBR, ARC, squeeze, crunch, and CrLZH.
- cpmdroid - Z80/CP/M emulator for Android phones and tablets. It emulates the RomWBW HBIOS interface and a VT100 terminal.
- cpmemu - Z80/CP/M emulator for Linux and Windows, with Z80 and 8080 CPU cores. It translates the BDOS and BIOS calls of CP/M 2.2 programs to the host file system.
- ioscpm - Z80/CP/M emulator for iOS and macOS. It emulates the RomWBW HBIOS interface and runs CP/M 2.2 and CP/M 3.
- learn-ada-z80 - Collection of more than 90 Ada example programs for uada80, the Ada compiler for the Z80 processor and CP/M.
- mbasic - Python interpreter for MBASIC 5.21, the Microsoft BASIC-80 for CP/M. Two compiler backends compile the programs to CP/M .COM files or to JavaScript.
- mbasic2025 - Reconstruction of the lost source code of MBASIC 5.21, the Microsoft BASIC-80 for CP/M. The MACRO-80 source code assembles to a binary that matches mbasic.com byte for byte.
- mbasicc - C++17 interpreter for MBASIC 5.21, the Microsoft BASIC-80 for CP/M. It runs on Linux and macOS.
- mbasicc_web - Web browser interpreter for MBASIC 5.21, the Microsoft BASIC-80 for CP/M. Emscripten compiles the mbasicc interpreter to WebAssembly.
- mpm2 - Z80 emulator for MP/M II, the multi-user CP/M operating system. Users connect over SSH, and SFTP clients transfer files.
- romwbw_emu - Hardware-level Z80/CP/M emulator for Linux and macOS. It emulates the RomWBW HBIOS interface and switches banks in 512 KB of ROM and 512 KB of RAM.
- scelbal - Floating-point BASIC interpreter for the 8080 processor and CP/M. A translator converts the original 8008 source code to 8080 source code.
- uada80 - Ada compiler for the Z80 processor and CP/M 2.2. It compiles a subset of Ada 2012 to CP/M .COM files.
- uc80 - C compiler for the Z80 processor and CP/M. It optimizes for small code size.
- ucow - Cowgol compiler for the Z80 processor and CP/M. It runs on Linux in Python.
- um80_and_friends - Linux toolchain that is compatible with Microsoft MACRO-80. It has an assembler, a linker, a librarian, and a disassembler.
- upeepz80 - Peephole optimizer for Z80 compilers that write lowercase Z80 assembly language. It shortens jumps to jr, builds djnz loops, and removes dead stores.
- uplox - LR(1) and GLR parser generator. It writes a lexer DFA, an LR parser, and a typed automatic AST, and uplm80 uses it to parse PL/M-80.
- z80cpmw - Z80/CP/M emulator for Windows. It emulates the RomWBW HBIOS interface and boots CP/M from disk images.