A terminal-driven emulator for several vintage computer systems, written in Rust.
-
System09 (Motorola 6809): boots the 6809 BASIC ROM to a prompt on the terminal.
-
MITS Altair 680b (Motorola 6800): boots the MITS PROM monitor on the terminal, with VTL-2 in its PROM socket, and
-s altair680-basicloads Altair 680 BASIC off its paper tape through the monitor — and-s altair680-paneldraws the 680b's front panel, its lamps on the live bus. -
MITS Altair 8800 (Intel 8080): no ROM: keys in MITS's bootstrap loader and loads Altair BASIC 4.0 off its paper tape, as an operator at the front panel did — and
-s altair8800-paneldraws that front panel, lamps, toggles, EXAMINE and DEPOSIT and all. It runs in a web page too.-s altair8800-diskadds the 88-DCDD floppy drives and MITS's disk boot loader, and boots CP/M 2.2 off an 8-inch disk; Disk BASIC, Altair DOS and the rest of the Altair disks boot too.On either Altair a
vt100token puts the console on a DEC VT100 in a window of its own instead of the terminal: 80 by 24 on a phosphor screen, with the VT100's escape sequences and keys, so CP/M software installed for a VT100 (SuperCalc, the Altair Clone disks' LADDER and CATCHUM) draws as it would on one. -
RC2014 (Zilog Z80): boots the factory ROM image — Grant Searle's monitor into Microsoft BASIC 4.7b — on the terminal, over an interrupt-driven serial port.
-
Kaypro II (Zilog Z80): boots CP/M 2.2 from a floppy image into an SDL2 window, with a keyboard and its bell, two floppy drives that keep what CP/M saves and format new disks, and a printer port.
-
Raytheon 703 (1967, 16-bit): a machine with no ROM at all, running sixteen levels of real interrupts, an interrupt-driven teletype, a fixed-head disc and a working front panel. Not a port of anything — it is written from the manufacturer's manuals. See below.
- A Rust toolchain (
cargo) - The SDL2 development package (
libsdl2-devon Debian/Ubuntu,sdl2on Homebrew/MacPorts) — the Kaypro window links it dynamically, and it's a build requirement even if you never run the Kaypro pkg-config, which is how the build finds that SDL2: any install prefix works as long aspkg-config sdl2resolves, so MacPorts (/opt/local) and Homebrew (/usr/localor/opt/homebrew) need no configuration. PointPKG_CONFIG_PATHat the directory holdingsdl2.pcif it's installed somewhere unusual- ROM images, which are not in the repo — see ROM and disk images below. Only the 703 runs without any
cargo build # target/debug/emu
cargo build --release # target/release/emu, considerably fasterNone of the images the machines boot are in the repository. They are third-party ROM dumps and a
CP/M floppy, and their licensing does not allow redistribution — most of them are somebody's build
of Microsoft BASIC. tools/rom-manifest.txt records what each one is and what it hashes to, and
tools/fetch-roms.py # into roms/ and disks/, verified against the manifestfetches them: from a local archive if EMU_ROM_ARCHIVE names one, otherwise from the source that
publishes it. An image already there is checked and never overwritten.
The emulator looks for them under roms/ and disks/ relative to the current directory, so
run it from the top of the checkout. -h lists each system with its default ROM and its variants, and -r overrides the ROM.
The Raytheon 703 needs none of this. It has no ROM to fetch, and its guests are built from source in this tree:
make -C test ray703 # assembles every 703 guest into roms/703Show the help: every system with its default ROM and variants, then the options:
./target/debug/emu -hOr let it show you what there is to run:
./target/debug/emu # on a terminal, with no arguments: the launcher
./target/debug/emu -L --fast-io # the launcher, with options to go after its choice (also --launch)The launcher has three columns: the machines; for the one under the cursor, every ROM, tape,
core image and disk image found for it under roms/, disks/ and rex/build/; and its options,
which are the windows, the spare serial ports (the 703's three multiplexer teletypes, each off, a
window, a pty or a TCP port) and the speed switches. Left, right and Tab go between the columns,
up and down move in one, space changes an option, Enter runs, q quits. What it runs is an ordinary command line, shown at
the bottom and printed as it starts, so the same thing can be run again without it. Anything else
on the line is passed on (emu -L --debug /tmp/emu.sock). Run with no arguments and no terminal (a
script, a pipe), emu is the 6809 as it always was. A machine with nothing to run says what
is missing and how to get it — usually tools/fetch-roms.py or a make target.
Run a system:
./target/debug/emu -s 6809 # the default system, which bare emu runs off a terminal
./target/debug/emu -s altair680
./target/debug/emu -s altair680-basic-panel # 680 BASIC, with the front panel in a window
./target/debug/emu -s altair8800 # loads 8K BASIC off paper tape, then MEMORY SIZE?
./target/debug/emu -s altair8800-panel # ...with the front panel: press RUN
./target/debug/emu -s altair8800-panel-vt100 # ...and the console on a VT100
./target/debug/emu -s altair8800-disk # CP/M 2.2 off its floppy; --disk again for drive B
./target/debug/emu -s kaypro # opens a window; also loads disks/mbasic-games.img
./target/debug/emu -s kaypro --disk my.img # a floppy of your own, which keeps what CP/M saves
./target/debug/emu -s kaypro --printer out.txt # a printer: LPRINT and ^P append to out.txt
./target/debug/emu -s rc2014-cpm --serial tcp:2323 # SIO channel B on localhost:2323 (nc localhost 2323)
./target/debug/emu -s 6809 -r roms/6809/BASIC.HEX
./target/debug/emu -s 6809 -l 1000000 # stop after a million instructions
./target/debug/emu -s 6809 -t trace.txt # log one line of CPU state per instruction
./target/debug/emu -s 6809 --no-throttle # flat out instead of at the real 1.8432 MHz
./target/debug/emu -s 6809 --throttle 10000 # slow motion, 10 kHz
./target/debug/emu -s ray703 -r roms/703/basic.bin --debug /tmp/emu.sock # a debug port; tools/emudbg.py talks to it
./target/debug/emu -s kaypro --restore game.snap # start from a save state the port's `snapshot` tookEvery machine runs at the clock rate its real counterpart ran at — the rate -h lists, announced at
startup — so a guest runs at period speed. --no-throttle runs the CPU as fast as the
host can, which is what a scripted run wants; --throttle N names a rate in Hz. The pacing is a knob
on the CPU alone: a device keeps its own timing whatever the CPU is doing, so a 703 held to 10 kHz
still has a teletype printing ten characters a second.
The Kaypro, the RC2014 and the Altair 8800 each have a serial port with nothing on it — the
Kaypro's RS-232 connector, the RC2014's second SIO channel, the Altair's second 2SIO port — and --serial pty or --serial tcp:PORT plugs the
host into it: a new pseudo-terminal for screen or a Kermit, or a localhost socket for nc. The 703
has three more teletypes beside its console, on its Teletype Multiplexer, and takes --serial once for each -- or --serial window,
which gives that teletype a paper window of its own. The
RC2014's monitor takes its console from whichever channel sees a space first, so it can be driven
entirely over the socket.
The Kaypro has a Centronics printer port as well, and --printer FILE plugs a printer into it that
prints into FILE, appending. Without one nothing is plugged in, and a program that prints waits for
a printer, as it would on the machine.
The debug port is a monitor on the running machine: registers, memory, breakpoints and write
watchpoints, a disassembler for each CPU in its assembler's syntax, the last thousand instructions'
addresses, and save states (snapshot PATH, restore PATH, or --restore PATH at startup). A
restore never writes into a disk image you own: a floppy or a 703 platter comes back in memory,
copy-on-write, and savedisk writes one out to a new file; the RC2014's card is checked against
the snapshot and a changed card refuses the restore. tools/emudbg.py is the client, and reads
symbols from the assemblers' listings and maps.
The terminal systems run in raw mode and pass Ctrl-C through to the guest. Ctrl-D exits; so does closing the Kaypro window.
A 16-bit machine from 1967, and the one system here that is not a port of an earlier emulator — it is written from the manufacturer's own documentation. It runs sixteen prioritized interrupt levels for real, and its teletype takes a tenth of a second per character in each direction, as a Model 33 did.
There was nothing in core at power-on: an operator keyed a bootstrap in from the front panel and
fed the machine a paper tape. The subsystems stand in for the operator, so -s ray703 loads a
core image and starts it — or one of Raytheon's absolute paper tapes, which it loads where the
tape says and starts at the tape's start address.
make -C test ray703 # build the guests first
./target/debug/emu -s ray703 # a demo: banner, then echoes what you type
./target/debug/emu -s ray703 -r roms/703/basic.bin # Tiny BASIC, ~1,850 words, written for it
./target/debug/emu -s ray703 -r roms/703/xray.bin # X-RAY EXEC, transcribed from a 1968 listing
./target/debug/emu -s ray703-tty-tape -r roms/703/tapes/PTIOS.bin # the museum's PTIOS, at ASSIGN I-OCtrl-D exits. X-RAY wants Ctrl-J before a command and Return after it — its records open on a line feed and close on a carriage return, and it silently discards anything typed without the leading Ctrl-J.
The front panel from the manual's figure 5-1 opens in a window, and it works: the lamps are switch-indicators, so clicking one keys that bit into a register, and they glow at the duty cycle of the bit behind them rather than flickering. Below the console sits the disc rack — ONLINE, READ and WRITE lamps for the four disc units. A panel machine starts halted, as the real one did at power-on — press RUN.
A tty token moves the teletype off the terminal into a window of its own: 72 columns of the
Model 33's actual typewheel (an OFL-licensed recreation from photographs, in fonts/) on
teletype paper, the mouse wheel rolling the platen back. Letters upcase as the real keyboard
did, shift-Return is the LINE FEED key, Backspace sends RUBOUT, and the host terminal stays
only as a Ctrl-D exit path.
A tape token opens a window of the high speed reader's and punch's paper tapes, each climbing
past its head as the machine reads or punches it: the reader's head near the top with the tape
still to come below it, the punch's near the bottom with what it has punched above. Click the
reader to thread a tape from a file chooser, and the punch to tear off what it has punched into
a new file.
./target/debug/emu -s ray703-panel # at its own 571 kHz, so the lamps move
./target/debug/emu -s ray703-panel-ptb -r roms/703/tape.tape --throttle 10 # a tape, in slow motion
./target/debug/emu -s ray703-tty # the teletype in its own window
./target/debug/emu -s ray703-tape-ptb -r roms/703/tape.tape # the tape through the reader, in a window
./target/debug/emu -s ray703-panel-tty-load -r rex/build/rex.img --fast-io # the whole installation: RUN, and REX boots
./target/debug/emu -s ray703 --fast-io # skip the teletype's real 10 chars/secThe panel and the teletypes also run in a web page, the same emulator built for WebAssembly
(web/): REX off its disc or Tiny BASIC, the panel above the paper, and under REX a tab for each
of the three teletypes on the multiplexer beside the console's. The Altair 8800 has a page of its
own, its panel above its VT100, BASIC off the paper tape. They are static files, served over
http:
rustup target add wasm32-unknown-unknown # once
make -C rex && make -C test ray703-basic # the 703's software
tools/fetch-roms.py # the 8800's BASIC tape
make -C web serve # then open http://127.0.0.1:8703/The disc is a Raytheon 74601 fixed-head unit, and its controller's LOAD button boots from it.
REX, a multitasking executive with a shell on every teletype, is booted that way (rex/README.md):
make -C test ray703-boot-disc
./target/debug/emu -s ray703-load -r disks/ray703-boot.img # a one-sector boot program
make -C rex bootdisc
./target/debug/emu -s ray703-load -r rex/build/rex.img --fast-io # REXAll of it is on bitsavers, at https://bitsavers.org/pdf/raytheon/70x/ — Raytheon703refMan.pdf
is the reference manual the CPU is written from, Raytheon706usersMan_Feb70.pdf documents the disc
in §5-9, and the program listings there are the 1968 software. Two of them,
390779_XRAY_ExecBasic_Feb1968.pdf and 390682C_RelocatingLoaderBasic_Nov1968.pdf, are transcribed
by hand in test/703/listings/ and assembled back into running code; the scans have no text layer,
so every card was read off the page. test/703/README.md is the index and the to-do list, and the
comments in src/cpu/ray703.rs cite the manual's own section numbers.
The rest of the period software is the University of Stuttgart's computer museum's: the paper tapes
it read off its 704 (ftp://ftp.informatik.uni-stuttgart.de/pub/cm/ray704/papertapes/) —
Raytheon's diagnostics, which the core passes, and the Paper Tape I/O System, Conversational FORTRAN,
the math library and the SYM I assembler, which run here. tools/fetch-roms.py fetches them.
Darwin Geiselbrecht, who wrote a lot of assembly for 703s when they were current hardware, has written two: rustheon in Rust and Raytheon in Python. Both were an inspiration for this one and the reference it was checked against — on a machine this obscure, someone who actually used it is worth as much as a manual.
They were a cross-check rather than a base, and where they and the manual disagree the manual wins,
with the disagreement written down at the line it affects. rustheon decodes the register generics
one slot high, for instance — CLR at 0x011 rather than 0x010 — and the 1968 paper-tape
bootstrap, which packs eight distinct instructions into eleven words, sides with the manual.
It goes the other way once. The saved machine status word is the only thing in the core not taken
from the manual, which names the word's contents but never diagrams it, so the bit layout follows
rustheon's. That turned out to be the layout of the front panel's own MS lamps in figure 5-1 —
which is a good sign it was right.
cargo test # the whole suite: no ROMs, no external binaries
make -C test basic6809-test # end-to-end: boots BASIC and runs a language test programcargo test needs nothing outside the repo, except the five tests it skips: the Z80 core against
the SingleStepTests suite, whose data tools/fetch-sst.py fetches (cargo test --release -- --ignored sst), the
8080 core against the CP/M instruction exercisers, which tools/fetch-i8080-tests.py fetches
(cargo test --release -- --ignored i8080_exercisers), and the 6800, Z80 and 8080 disassemblers against
ASxxxx's own assembler tests, which tools/fetch-asxxxx.py fetches (cargo test -- --ignored t6800 tz80 t8080). The end-to-end scripts do: the 6809 one needs
roms/6809/BASIC.HEX and python3, driving the emulator over its debug port as the Raytheon 703
demo test (make -C test ray703-test) does, which needs only python3; and the
three 703 shell scripts (Tiny BASIC, the disc, the LOAD button) need script(1) and python3. Raytheon's
own diagnostics, math library, Conversational FORTRAN and SYM I assembler run off their paper tapes
(tools/fetch-roms.py) under harnesses of their own. AGENTS.md covers them all.
src/cpu/: CPU cores (6800, 6809, Z80, 8080, Raytheon 703), each implementing theCputrait against aBus.src/system/: one file per machine (the bus, address decode, devices, ROM loading) and the registry that describes them.src/dev/: devices — memory banks, MC6850 ACIA, Z80 SIO and CTC, WD1793 and 88-DCDD floppy controllers, the RC2014's compact flash, and the 703's teletype, paper tape, multiplexer, clock and disc.src/console/: the terminal and SDL2 frontends — the Kaypro screen, the 703's front panel and teletype-paper windows, the Altairs' front panels and VT100 — and the channel/handles that connect them to the CPU thread.src/launcher/:--launch, the terminal menu of what there is to run.src/debug/: the debug port.src/snapshot.rs: save states.src/emulator.rs,src/bus.rs,src/rom.rs,src/main.rs.web/: the 703 and the Altair 8800 built for WebAssembly, and the pages that run them.rex/: REX, the 703's executive — its own project, with its own README.tests/: the two integration tests.test/: the end-to-end regression scripts and the guest programs they drive, by machine —test/6809/andtest/703/(the latter including a Tiny BASIC and transcriptions of two 1968 program listings). Seetest/README.md.tools/: development tools — the 703 assembler, disassembler, relocating loader and tape reader, the debug port's client, the listing transcription workflow, the ROM and test-data fetchers, and syntax highlighting for 703 assembly in vim and VS Code (tools/editor/).roms/,disks/: where the images the machines boot and mount go. Untracked; see the README in each.AGENTS.md: the full guide — build, run, test, architecture, and the deliberate quirks.