Search › A-Z › S › Space Invaders
Space Invaders
Space Invaders (Taito, 1978), designed by Tomohiro Nishikado, is the arcade game that launched the shoot-’em-up genre and the golden age of arcade gaming. This build runs the original Intel 8080 board in the browser, a pure-JavaScript 8080 core plus the Taito bit-shift, input and video hardware, and boots straight into the game’s attract mode. It is wired to the emulators.org in-frame debugger so you can single-step the 8080, read and write the registers and the full 64K memory (video RAM sits at 0x2400), and set execution breakpoints.
Runs on: Web browser
Space Invaders Online Emulator
Play Space Invaders using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| Space Invaders | Space Invaders | Space Invaders | grey | Open ⛶ |
Machine emulated
The Space Invaders arcade board (Taito, 1978) - an Intel 8080 at 1.9968 MHz with 8 KB of ROM and 8 KB of RAM, a 16-bit bit-shift chip for sprite positioning, and a 256×224 monochrome raster rotated 90° in the upright cabinet. It is the machine that started the golden age of arcade video games.
Chips
Notes
Embedding
Space Invaders is the original 1978 Taito arcade machine: an Intel 8080 at 2 MHz driving a 256×224 monochrome raster, rotated 90° in the cabinet. This build vendors the pure-JavaScript 8080 core and Taito hardware model from chris-j-akers/i8080-javascript and drives it from a host-owned loop so the debugger can control it.
Boot. The four 2 KB game ROMs are loaded into 0x0000–0x1FFF and the 8080 starts at 0x0000, dropping straight into the game's attract mode:
const computer = new InvadersComputer();
computer.LoadProgram(); // invaders.h/g/f/e -> 0x0000..0x1FFF
computer.InputDevicePortTwo.SetNumberOfLivesDipSwitch(3);
The machine object. InvadersComputer exposes the whole cabinet as ordinary methods and fields, so the host page can render, step and inject input:
| Member | Kind | What it does |
|---|---|---|
ExecuteNextInstruction() | method | Fetch, decode and run one 8080 instruction; returns its address, disassembly, cycle count and the full CPU state. |
GenerateHalfVBlank() / GenerateVBlank() | method | Raise the mid-screen (RST 1) and end-of-frame (RST 2) interrupts the game's display code needs, once each per field. |
GetVideoBuffer() | method | The 7 KB of video RAM (0x2400–0x3FFF): 1 bit per pixel, 32 bytes per column, un-rotated by the renderer. |
Bus.ReadRAM(a) / Bus.WriteRAM(v,a) | method | Side-effect-free access to the 64 KB address space — what the debugger's memory views read and poke. |
InputDevicePortOne | field | The coin slot, 1P/2P start and player-one joystick/fire register (read on port 1). |
Reset() / LoadProgram() | method | Reset the CPU and RAM, then reload the ROMs — the cabinet's power-cycle. |
Video. Each animation frame the loop runs ~33,334 cycles, firing the two interrupts, then walks the video RAM: for every byte, eight vertical pixels are written to a 224×256 canvas with the 90° rotation the upright cabinet used.
Debugger integration
The debugger drives a host-owned run loop: because the 8080 interpreter runs one instruction at a time in JavaScript, 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
requestAnimationFrameloop. - stepInsn(n) — call
ExecuteNextInstruction()exactly n times and redraw, so a single step advances the PC by one instruction. - step(n) — advance n whole 60 Hz fields (with their interrupts).
- breakpoints — a
Setof PC values. When it is non-empty the loop runs instruction-by-instruction and pauses before executing an address in the set; when empty it runs a full frame at speed, so an idle debugger costs nothing. - watchpoints —
Bus.WriteRAMis wrapped so a write to a watched address pauses the loop.
The plug-in (space-invaders-debug.js) reads these hooks and calls EmuKit.defineMachine with the 8080 register set, the 64K bus / ROM / video-RAM chips and the on-screen control panel. It reuses the shared z80 disassembler (/debugger/src/cpus/z80.js): the Z80 is a strict superset of the 8080, so it renders 8080 opcodes correctly, with the 8080 mnemonics' Z80 spellings.
Architecture
The Taito Space Invaders board is a single Intel 8080 at 1.9968 MHz with 8 KB of ROM, 8 KB of RAM and a scattering of discrete hardware, all modelled here as plain JavaScript objects hanging off InvadersComputer:
- CPU — an interpreter of the Intel 8080, with the 64 KB memory map behind a
Bus/MMUpair. - Bit-shift device — the board's signature hardware: a 16-bit shift register (write ports 2 and 4, read port 3) that lets the 8080 position sprites faster than its one-bit shifts allow.
- Input ports — port 1 (coin, 1P/2P start, player-one joystick and fire) and port 2 (dip switches for lives and bonus, player-two controls).
- Sound / watchdog — the port 3/5 sound latches drive synthesised audio (see the Sound notes below) and the port-6 watchdog is a stub.
- Video — 7 KB of 1 bpp video RAM at
0x2400. The 8080 has no video hardware to speak of; the CRT simply scans that memory, and the game splits each field with a mid-screen interrupt so it can update the top and bottom halves in step with the beam.
The two per-field interrupts (RST 1 mid-screen, RST 2 at vertical blank) are the only timing the game truly depends on, so the host loop reproduces exactly those, running roughly a 60th of the 2 MHz clock between them.
Sound
The 1978 board had no sound chip: its sounds came from discrete analog circuits plus an SN76477 for the flying-saucer tone, each gated by a bit of two 8-bit output latches the 8080 wrote with OUT 3 and OUT 5. There is no register file to sample, so this is effect synthesis (the guide's Pattern S) driven directly by those port writes.
Where it hooks. The board already decodes the two sound ports to SoundDevice; the host boot loop installs a SoundDevice.OnWrite(port, val) hook that feeds each latch value to a small synth (space-invaders-sound.js). Every bit is edge-triggered except the UFO tone, which follows the level of port-3 bit 0:
- Port 3 — bit 0 UFO (a continuous frequency-modulated "warble" while set), bit 1 shot (a rapid downward pitch sweep), bit 2 player-die/explosion (a low filtered-noise burst), bit 3 invader-die (a short noise+tone burst).
- Port 5 — bits 0–3 the four-tone invader "walk" (four descending square-tone steps, the classic boom-boom-boom-boom march that speeds up as the aliens thin), bit 4 UFO-hit (a noise burst).
Rate / pitch. The synth is constructed with EmuAudio.sampleRate, so every oscillator and noise-filter step is computed at the output rate directly (no resampling), and the loop pushes exactly Math.round(EmuAudio.sampleRate/60) interleaved-stereo Int16 samples per video frame via EmuAudio.push(). Noise is a 15-bit LFSR through a one-pole low-pass; each effect has an exponential decay envelope.
Mute. transport.setMute/transport.isMuted delegate to the shared sink and it starts muted (browsers block audio before a gesture); the shell's Sound button unmutes from a real click. The board boots into attract mode. Insert a coin and press 1P Start (or the on-screen controls) to play, and the march and shots sound during real play.
Caveat. These are faithful approximations of discrete analog circuitry, not a component-level SPICE model of the board, so the timbre is close to but not bit-exact with an original cabinet.