SearchA-ZP › DEC PDP-1

DEC PDP-1

1959 Freeware Online

The DEC PDP-1 was Digital Equipment Corporation's first computer, and the machine on which Spacewar!, widely called the first video game, was written at MIT in 1961 and 1962. This build runs Norbert Landsteiner's PDP-1 emulation, itself based on the Silverman and Gerasimov core, and boots straight into the original Spacewar! 3.1 tape on an emulated Type 30 point-plotting CRT with its glowing dual-phosphor trails. It plugs into the shared debugger, where you can single-step the 18-bit, one's-complement processor, watch AC / IO / PC / OV change in octal, set breakpoints on the program counter, and read core memory as octal disassembly.

Visit the official site ↗

Runs on: Web browser

DEC PDP-1 Online Emulator

Play DEC PDP-1 using JavaScript directly in your browser.

Configurations

ConfigurationEmulatorMachineOSLegal
Spacewar! 3.1DEC PDP-1DEC PDP-1greyOpen ⛶

Notes

Embedding

masswerk's Spacewar! is one big self-contained engine (spacewar_pdp1_engine_ng.js) plus a code module - the Spacewar! 3.1 paper tape, base64-embedded in modules/spacewar_3_1.js. Give it a canvas called pdp1_canvas and a small preset object, and it boots the game on its own:

var PDP1Presets = { canvasId: 'pdp1_canvas', showSplashScreen: false, CRTWidth: 512 };
// <script src="spacewar_pdp1_engine_ng.js"> then the module <script> ...
// the engine auto-starts on window.onload - no start() call needed.

The engine owns its own setTimeout game loop, which a debugger can neither pause nor single-step. So this build vendors the engine with a small, clearly-marked _dbg hook that exposes the live PDP-1 and a breakpoint-aware, one-video-frame stepper. The boot shim waits for the game to start, calls PDP1Engine.stop() to silence the engine's timer, and drives everything from its own requestAnimationFrame loop instead:

MemberKindWhat it does
PDP1Engine._dbg.pdp1objectThe live PDP-1 CPU: step() (one instruction), getPC/getAC/getIO/getOV, getMemAddress(a) / patchMemory(a,v) for one 18-bit word.
PDP1Engine._dbg.frame(probe?)methodRuns one CRT frame. With no probe it defers to the engine's fast native frame; with a probe(pc) callback it steps one instruction at a time and stops when the probe fires (breakpoint / watchpoint).
PDP1Engine.stop() / resume()methodStart / stop the engine's own loop; the shim uses stop() once, then owns the loop.
PDP1Engine.setControlBits(v) / clearControlBits(v)methodSet / clear the PDP-1 control switches the game reads for the two players' controls.

Because the CPU and core store are ordinary JavaScript, breakpoints and watchpoints are host-side checks passed into _dbg.frame(), with no change to the emulation logic.

Debugger integration

The boot shim publishes window.EMU_BOOT with a full transport: pause / resume / isPaused, stepInsn(n) (one instruction), step(n) (whole frames), reset, plus breakpoints (program-counter values the frame stepper checks before each instruction) and watchpoints (core addresses, checked for change each instruction). A dedicated CPU decoder, /debugger/src/cpus/pdp1.js, disassembles each 18-bit word into native octal mnemonics: the memory-reference set (LAC DAC ADD SUB JMP JSP and friends) with the indirect flag, the augmented groups SKP / SFT / LAW, the IOT devices (DPY RPA RPB CKS), and the microcoded OPR operate word (CLA CLI CMA HLT, flag and PDP-1D register moves).

The core store is 4096 eighteen-bit words. The pdp1 decoder reads each word as three bytes, little-endian, so the plug-in exposes the store as a 12288-byte chip: byte 3n is bits 0–7 of word n, 3n+1 bits 8–15, and 3n+2 bits 16–17. Every instruction is therefore length three, and the register plug-in returns a byte-scaled pc() so the disassembly gutter, the program-counter highlight and breakpoints all land on word boundaries.

Architecture

The DEC PDP-1, delivered in 1959, was Digital's first computer and the machine on which Spacewar!, widely called the first video game, was written at MIT in 1961–62. It is an 18-bit, one's-complement machine with 4096 words of core, a single accumulator (AC) and in-out register (IO), and a Type 30 point-plotting CRT.

  • Word and registers: 18-bit words, one's-complement arithmetic with an overflow flag (OV). The visible state is just AC, IO, PC and OV; the whole game runs in that.
  • Instructions: the top six bits are the opcode (its low bit selecting indirect addressing) and the low twelve bits the address. Memory-reference orders (LAC, DAC, ADD, JMP…) sit alongside augmented orders whose address field is a function mask: SKP (conditional skips), SFT (shifts and rotates), OPR (the operate microcode) and IOT (in-out transfer).
  • Display: the DPY IOT plots one point from AC (x) and IO (y). Spacewar! draws its stars and ships point by point, and masswerk's engine models the Type 30's dual-phosphor persistence so the trails glow and fade like the real tube.

The bundled program is the genuine Spacewar! 3.1 tape from 24 September 1962, loaded from its RIM paper-tape image, so the two ships, the gravity star, the torpedoes and hyperspace all behave exactly as they did at MIT.