Galaxian
Galaxian (Namco, 1979) is the game that answered Space Invaders and defined the fixed shooter, and it led directly to its sequel Galaga: your fighter holds the bottom of the screen while a formation of colourful aliens peels off in swooping dive-bomb runs. This build runs the original arcade board in the browser, a single Zilog Z80 driving the Galaxian tilemap, sprite, bullet and starfield 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 Z80, read and write its registers and the full 64K memory, and set execution breakpoints and write watchpoints.
Runs on: Web browser
Galaxian Online Emulator
Play Galaxian using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| Galaxian | Galaxian | Galaxian | grey | Open ⛶ |
Machine emulated
The Galaxian arcade board (Namco, 1979) - a single Zilog Z80 at 3.072 MHz with 16 KB of program+graphics ROM, 1 KB of work RAM, a 32×32 tile map, eight hardware sprites, eight bullet generators and a pseudo-random starfield, scanned as a 256×224 raster rotated 90° in the upright cabinet. A vertical-blank NMI drives the game logic. It answered Space Invaders, introduced multi-coloured sprites and a scrolling starfield to the genre, and led directly to its sequel Galaga.
Chips
Notes
Embedding
Galaxian is the 1979 Namco arcade machine — the game that answered Space Invaders with a colourful, swooping alien attack and became the template for the fixed shooter, including its own sequel Galaga. The board is a single Zilog Z80 at 3.072 MHz driving a 256×224 raster rotated 90° in the upright cabinet. This build pairs the vendored DrGoldfire Z80.js CPU core with a plain-JavaScript model of the Galaxian board (a hand port of the 8bitworkshop GalaxianMachine) and drives the whole thing from a host-owned loop.
Boot. Constructing the machine loads the combined program/graphics/palette ROM image and resets the Z80, which starts at 0x0000 (XOR A; LD (0x7001),A; JP 0x1a55) and drops into attract mode:
var gx = new GalaxianMachine(window.GALAXIAN_ROM); // program + gfx + colour PROM
function loop(){ // ~one 60Hz field per rAF
var budget = 264 * 192; // scanlines x cycles/line
while(spent < budget) spent += gx.runInstruction(); // draws scanlines, fires vblank NMI
draw(); // rotate the 264x264 buffer to portrait
}
The machine object. GalaxianMachine exposes the board as ordinary fields and methods, so the host page can render, step and inject input:
| Member | Kind | What it does |
|---|---|---|
runInstruction() | method | Run one Z80 instruction, advance the scanline renderer, and at end of field fire the vblank NMI and tick the watchdog. Returns the cycle count. |
cpu | field | The Z80 core — run_instruction(), getState()/setState(), interrupt(), reset() and the added get_pc(). |
readSafe(a) / writeSafe(a,v) | method | Side-effect-free access to the 64 KB map — what the debugger's memory views read and poke (never touches the watchdog or the output latches). |
inputs | field | The three input latches IN0/IN1/IN2; the on-screen pad and the keyboard set and clear their active-high bits. |
pixels | field | The raw 264×264 ABGR framebuffer the scanline renderer fills; the loop rotates it 90° onto the canvas. |
reset() | method | Power-cycle: clear RAM/VRAM/ORAM and reset the Z80. |
Video. Each field the renderer walks 264 scanlines, drawing the 32-column tilemap, the eight hardware sprites, the shell/missile bullets and the twinkling starfield into an off-screen 264×264 buffer; the loop then rotates the visible 224×256 window into the upright cabinet's portrait orientation.
Debugger integration
Because the Z80 interpreter runs one instruction at a time in JavaScript and the host owns the loop, the debugger's single-step, breakpoints and watchpoints fall out naturally — the loop can stop, step and inspect between any two instructions.
window.EMU_BOOT.transport exposes the controls the shared debugger calls:
- pause / resume / isPaused — stop or restart the
requestAnimationFrameloop. Resume steps off a breakpoint first, so it always makes progress. - stepInsn(n) — call
GalaxianMachine.runInstruction()exactly n times and redraw, so a single step advances the PC by one instruction (and still lets a field boundary fire its NMI). - step(n) — advance n whole 60 Hz fields.
- breakpoints — a
Setof PC values. When it is empty the loop runs a whole field at speed; when it is non-empty the loop checkscpu.get_pc()before each instruction and pauses before executing a watched address. An idle debugger costs nothing. - watchpoints — the board's
writeHookis called with the address of every CPU memory write; a write to a watched address pauses the loop.
The Z80 core needed one small addition for the debugger: get_pc(), a side-effect-free read of the program counter, so the run-loop can test PC against breakpoints every instruction without allocating a full getState() snapshot. Registers are read and written live through getState()/setState() — A F B C D E H L, the BC/DE/HL pairs, IX IY SP PC I R and the S Z H P/V N C flags derived from the flag object. Memory views read through readSafe, which returns ROM, RAM, video RAM and object RAM but never kicks the watchdog or trips an output latch, so inspecting memory never disturbs the machine. The plug-in (galaxian-debug.js) feeds all of this to EmuKit.defineMachine and reuses the shared z80 disassembler at /debugger/src/cpus/z80.js.
Architecture
The Galaxian board (Namco, 1979) is a single-CPU design, much simpler than the three-Z80 Galaga that followed it:
- CPU — one Zilog Z80 at 3.072 MHz. 16 KB of program+graphics ROM at
0x0000, 1 KB of work RAM at0x4000. - Video RAM — a 32×32 tile map at
0x5000(only the visible 32×28 is shown), with per-column scroll and colour attributes in the 256-byte object RAM at0x5800. - Sprites & bullets — object RAM also holds eight 16×16 hardware sprites and eight one-pixel bullet generators (seven white player/enemy shells and one yellow missile).
- Starfield — a hardware pseudo-random star generator scrolls a twinkling background, enabled by a bit of the addressed output latch at
0x7004. - Interrupt — a non-maskable interrupt is raised once per field at vertical blank, gated by the output latch at
0x7001; the game enables it after its power-on setup and runs its logic from the NMI handler at0x0066. - Inputs — three latches read at
0x6000/0x6800/0x7000: coin and player-one joystick/fire, the start buttons and player-two controls, and the dip switches (lives, bonus, coinage). All active-high. - Watchdog — a counter that reboots the board unless the game keeps reading
0x7800; the model reproduces the kick and the reboot.
Sound (two AY-3-8910 PSGs on the Galaxian daughter board) is not emulated in this build; the PSG register writes are accepted and ignored.