PDP-8
A faithful DEC PDP-8 minicomputer authored for emulators.org and running in the browser. The PDP-8 is the classic 12-bit machine of 1965, with a tiny instruction set: three bits pick one of eight opcodes, and the last of those is a microcoded operate word. This build models the processor, the KL8-E console teletype and a bundled machine-code monitor, so it boots to a READY banner on an ASR-33 glass-teletype and echoes whatever you type. It plugs into the shared debugger, where you can single-step the CPU, watch AC / PC / L / MQ change, set breakpoints on the program counter, and read core memory as octal disassembly.
Runs on: Web browser
PDP-8 Online Emulator
Play PDP-8 using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| Teletype monitor | PDP-8 | open | Open ⛶ |
Notes
Embedding
The emulator is two small, self-contained pieces: a pure DEC PDP-8 processor (pdp8-cpu.js) and a glass-teletype canvas (pdp8-screen.js). Vendor both and drive the machine from your own loop. The core never touches the DOM, so the debugger can pause, step and breakpoint it:
var cpu = new PDP8({ onOutput: function (ch) { screen.putChar(ch); } });
cpu.load(image, 0o200); // image = { addr: word }, start PC = 0200
while (!cpu.halted) cpu.step(); // step() = one PDP-8 instruction
The machine is plain objects. Everything the debugger needs is a live field or method on the core, so there is no wasm heap to reach into:
| Member | Kind | What it does |
|---|---|---|
cpu.step() | method | Execute exactly one PDP-8 instruction (the single-step primitive), including auto-index addressing and the operate microcode. |
cpu.ac / cpu.pc / cpu.l / cpu.mq | field | The accumulator, program counter, link bit and MQ register, as plain writable numbers. |
cpu.sr | field | The front-panel switch register, read back into AC by the OSR operate instruction. |
cpu.rd(a) / cpu.wr(a,v) | method | Side-effect-free read / write of one 12-bit word, what the debugger's memory views and watchpoints call. |
cpu.keyFlag / cpu.keyBuf | field | The KL8-E keyboard flag and character buffer; the host raises the flag when a console key is ready. |
Because the CPU and core store are ordinary JavaScript, breakpoints and watchpoints are host-side checks around cpu.step() and cpu.wr(), with no changes to the core.
Debugger integration
The boot shim publishes window.EMU_BOOT with a full transport: pause / resume / isPaused, stepInsn(n) (one instruction) and step(n) (a burst), reset, plus breakpoints (program-counter values the loop checks before each step) and watchpoints (core addresses, checked inside the write path). A dedicated CPU decoder, /debugger/src/cpus/pdp8.js, disassembles each 12-bit word into native octal mnemonics: the memory-reference set (AND TAD ISZ DCA JMS JMP) with I / current-page flags, the console IOTs (KSF KRB TLS and friends), and the full microcoded operate groups (CLA CLL CMA RAR SMA SZA HLT and the rest).
The core store is 4096 twelve-bit words. The pdp8 decoder reads each word as two bytes, little-endian, so the plug-in exposes the store as an 8192-byte chip: byte 2n is the low eight bits of word n and byte 2n+1 the top four. Every instruction is therefore length two, and the register plug-in returns a byte-scaled pc() so the disassembly gutter, the program-counter highlight and breakpoints all line up on word boundaries.
Architecture
The DEC PDP-8, introduced in 1965, is the classic 12-bit minicomputer and the machine that made computing cheap enough to sit on a bench. Its instruction set is famously small: three bits select one of eight opcodes.
- Memory reference (
AND TAD ISZ DCA JMS JMP): a 7-bit offset reaches the current page or page zero, an indirect bit follows a pointer, and locations 0010 to 0017 auto-increment when used indirectly, giving cheap pointers for string and array walks. - IOT (opcode 6): device pulses. The KL8-E console teletype answers on device 03 (keyboard:
KSF KRB) and device 04 (printer:TSF TLS). - OPR (opcode 7): a microcoded operate word. Group 1 clears, complements, increments and rotates the accumulator and link; group 2 tests them and can skip, read the switch register or halt; group 3 moves the MQ register.
The bundled program is a short teletype monitor in genuine PDP-8 code. It starts at 0200, walks a message string through auto-index register 0010 and prints it with a JMS subroutine, then loops on KSF / KRB to read the keyboard and TLS to echo each key, exactly as an ASR-33 console session would.