SearchA-ZT › Tempest

Tempest

1981 Arcade Open source · Public domain Online

Tempest (Atari, 1981), designed by Dave Theurer, is the colour vector-graphics arcade classic in which you ride the rim of a tube, spinning around it to shoot the Flippers, Tankers, Spikers and Fuseballs that climb toward you, sweeping the whole field with the Superzapper when things get desperate. This build runs the original Atari board in the browser: a MOS 6502 driving the Atari Analog Vector Generator, with a bit-slice math box for the tube's projection maths, and the original ROMs. It boots straight into attract mode, the colour tube and demo play on the vector screen, and is wired to the emulators.org in-frame debugger so you can single-step the 6502, read and write the registers and the full 64K memory, watch the vector RAM display list build word by word, and set execution breakpoints and write watchpoints.

Visit the official site ↗

Runs on: Web browser

Tempest Online Emulator

Play Tempest using JavaScript directly in your browser.

Configurations

ConfigurationEmulatorMachineOSLegal
TempestTempestTempestgreyOpen ⛶

Machine emulated

The Tempest arcade board (Atari, 1981) is a single MOS 6502 at 1.512 MHz driving the Atari Analog Vector Generator (AVG), the colour cousin of the Asteroids DVG: there is no framebuffer, so the CPU builds a list of lines in the 4 KB it shares with the AVG and the AVG steers a colour beam to draw them on an X-Y monitor. A bit-slice math box co-processor does the tube's projection maths. It was the first game Atari shipped with its colour vector hardware, and the first to let the player pick a starting level.

Chips

Notes

Embedding

Tempest is a MOS 6502 at 1.512 MHz driving the Atari Analog Vector Generator (AVG) -- the colour cousin of the Asteroids DVG. There is no framebuffer: the AVG reads a display list of lines from the memory it shares with the CPU and steers a colour beam to draw the tube. A bit-slice math box co-processor does the tube's projection maths. This build vendors a self-hosted machine (no CDN): a JavaScript port of Mike Chambers' public-domain Fake6502 core, our AVG + math box + POKEY-pot model, and the original Atari ROMs, driven from a host-owned loop so the debugger can control it.

Boot. The five 4 KB program ROMs load at $9000–$DFFF (the top part mirrored to $F000 so the reset/IRQ vectors resolve) and the 4 KB vector ROM at $3000; the 6502 starts from $FFFC ($D93F) and drops straight into attract mode:

var m = new TempestMachine();   // loads ROMs, builds 6502 + AVG + math box
m.reset();                        // pulls the reset vector at $FFFC
// one field: 4 IRQs across ~25200 cycles, then draw the AVG list
for (var s = 0; s < 4; s++) { irqLine = true; runCycles(6300); }
m.renderTo(ctx, W, H);

The machine is plain objects. Everything the host and debugger need is a field or method on the machine or its CPU:

MemberKindWhat it does
m.cpu.step()methodFetch, decode and run one 6502 instruction; returns its cycle count. The single-step primitive.
m.cpu.irq()methodAssert the maskable interrupt -- the four-per-frame tick that clocks the game.
m.avgGo()methodRun the AVG over vector RAM/ROM and collect the frame's colour line segments. Triggered when the CPU strobes $4800.
m.mathbox.go(cmd,v)methodThe math box: 16 signed-16-bit registers + multiply/project/divide/window commands, read back at $6060/$6070.
m.dbgRead(a) / m.memWrite(a,v)methodSide-effect-free read and the CPU write path -- what the debugger's memory views read and poke.
m.setInput(id,down)methodDrive a control (left/right spinner, fire, zap, coin, start1) into the POKEY pots and IN0.
m.cpu.a/x/y/sp/pc/flagsfieldThe live 6502 registers, read and written directly.

Video. Each field the loop runs one display's worth of 6502 (four IRQ slices), then walks the AVG display list the game left in vector RAM and strokes the colour lines to the canvas, one colour per STAT instruction through the 16-entry colour RAM at $0800.

Debugger integration

The debugger drives a host-owned run loop: because the 6502 interpreter runs one instruction at a time, the loop can pause, single-step and check breakpoints between any two instructions -- no changes to the CPU core are needed. window.EMU_BOOT.transport exposes the controls the shared debugger calls:

  • pause / resume / isPaused -- stop or restart the requestAnimationFrame loop.
  • stepInsn(n) -- call cpu.step() exactly n times and redraw, so a single step advances the PC by one instruction.
  • step(n) -- advance n whole display fields (each with its four IRQs).
  • breakpoints -- a Set of PC values. When non-empty the loop runs instruction-by-instruction and pauses before executing a watched address; when empty it runs a field at speed, so an idle debugger costs nothing.
  • watchpoints -- the machine's memWrite is the single write path; it flags a hit when a watched address is written and the loop pauses on it. Because the 6502's registers and the whole 64 KB map are ordinary JavaScript, registers are read and written directly and memory is exposed side-effect-free.

The plug-in (tempest-debug.js) reads these hooks and calls EmuKit.defineMachine with the 6502 register set bound to the shared mos6502 disassembler, four memory chips (the 64 KB bus, the program ROM, the AVG vector RAM display list and the vector ROM shape library), and the on-screen control panel. A neat trick for a vector machine: point the Vector RAM hex window at $2000 and single-step -- you can watch the game build the frame's line list word by word before it strobes $4800.

Architecture

Tempest has no video RAM in the usual sense. A single MOS 6502 builds a list of vectors in the 4 KB it shares with the AVG, then strobes it; the AVG is a stack machine that reads that list and draws colour lines on an X-Y monitor. Modelled here as plain JavaScript objects:

  • CPU -- a port of Fake6502 (NMOS 6502), reaching memory only through the machine's memRead/memWrite, so the bus and I/O live in one place.
  • AVG -- the Analog Vector Generator: it walks the display list as opcodes -- VCTR long vector, SVEC short vector, STAT colour + brightness (with Tempest's sparkle bit), SCAL scale, CNTR recentre, JSRL/RTSL call/return, JMPL, HALT -- accumulating colour line segments. Colours come through the 16-entry colour RAM at $0800; Tempest swaps X and Y (the monitor is rotated).
  • Math box -- a bit-slice (AM2901) co-processor with 16 signed-16-bit registers doing the tube's multiply / project / divide / distance / window maths, poked at $6080-$609F and read back at $6060/$6070. Ported here as direct arithmetic (Eric Smith's high-level model).
  • I/O -- IN0 (coins, tilt, VG-halt, 3 kHz clock), two DIP banks, and the two POKEYs whose analog "pot" lines carry the spinner (4-bit encoder on POKEY 1) and the fire / superzapper / start buttons (POKEY 2); sound is stubbed. An EAROM latch stands in for the high-score store.
  • ROMs -- 20 KB of 6502 program (five mask ROMs) and 4 KB of vector ROM holding the tube, letters, digits and shapes the display list calls into.

The timing the game truly needs is its four-per-frame IRQ; the host loop reproduces exactly that, four IRQ slices per ~60 Hz field, and renders the AVG list at the end of each field.