# Galaga Hardware Documentation Technical reference for building `emu-galaga`, the 1981 Namco Galaga board in the browser. This directory exists so that a coding agent building the board has source-backed hardware facts to work from instead of guessed ones. A coder cannot reliably invent the 06xx bus protocol, the 51xx credit-mode response bytes, the Namco tilemap scan, or the 05xx starfield generator from general knowledge; they are captured here, each with its source named. The verified reference set is MAME's `galaga` parent set, "Galaga (Namco rev. B)", 16 files including the two MCU programs. Every fact here is specific to that board. No ROM, PROM, or graphics contents appear in this directory or anywhere in the repository; hashes only. See [rom-manifest.md](rom-manifest.md). ## Read in this order | File | Contents | |---|---| | [build-approach.md](build-approach.md) | **Read this before writing any code.** Decisions taken, decisions still open, the staged plan with acceptance tests, the risks | | [site-plan.md](site-plan.md) | What the page does for a visitor, what it deliberately does not show, hosting at emu.supertux.com | | [rom-manifest.md](rom-manifest.md) | Every member of `galaga.zip`: size, CRC32, SHA-1, MAME region and offset, purpose; the loader rule | | [memory-map.md](memory-map.md) | The one address map all three Z80s share: per-CPU ROM windows, RAM banks, the two LS259 latches bit by bit, DIP slicing, WSG and 06xx windows, sprite byte locations | | [cpu-and-timing.md](cpu-and-timing.md) | Clocks with derivations, 50,688 T-states per frame, vblank at 43,008, every interrupt source with its target, period and gate, boot order, watchdog, a scheduling recipe | | [custom-io.md](custom-io.md) | The 06xx bus controller, the 51xx I/O MCU protocol (both modes, every command and response bit), cabinet wiring, the 54xx bus side, MB88xx sizing, HLE versus LLE stated without deciding | | [video-hardware.md](video-hardware.md) | Resolution and timing, the 36x28 tilemap scan, attributes, the 64 sprites across three RAM banks, palette and lookup PROM decode with resistor weights, the 05xx starfield algorithm, flip, a rendering recipe | | [gfx-bitplane-spec.md](gfx-bitplane-spec.md) | Exact byte and bit layout of 8x8 characters and 16x16 sprites, quadrant order, pixel to PROM to palette | | [sound-hardware.md](sound-hardware.md) | The 3-voice WSG register map and wave PROM format, the synthesis algorithm at 96 kHz, the 54xx command set and its three-stage filter network with component values | | [gameplay-reference.md](gameplay-reference.md) | Controls, DIP switches with defaults (source-verified), scoring, formation, stages, the fighter capture, attract sequence (community-sourced, marked) | | [mame-oracle.md](mame-oracle.md) | MAME 0.285 driven headless by `oracle/mame_dump.lua`: proven deterministic on this machine, the dump format, the 0.285 Lua gotchas, the oracle's limits | | [build-record.md](build-record.md) | What happened when the plan ran: each stage's result, the detours, the numbers, what is left open | | [STYLE.md](STYLE.md) | How these documents are written | ## Sourcing, confidence, and license Hardware facts come from MAME's source for this exact board, restated in original wording with the file and function named beside each. The files consulted and their license headers, checked 2026-09-11 on `mamedev/mame` master: | File | License | |---|---| | `src/mame/namco/galaga.cpp`, `galaga.h`, `galaga_v.cpp`, `galaga_a.cpp` | BSD-3-Clause | | `src/mame/namco/namco06.cpp`, `namco51.cpp`, `namco54.cpp` | BSD-3-Clause | | `src/mame/namco/starfield_05xx.cpp` | BSD-3-Clause | | `src/devices/sound/namco.cpp` | BSD-3-Clause | | `src/devices/cpu/mb88xx/mb88xx.cpp` | BSD-3-Clause | The 51xx protocol was taken from the older high-level model MAME shipped through release 0.200, since the current file runs the MCU program and no longer describes the protocol in words; [custom-io.md](custom-io.md) says where each part came from. Gameplay facts beyond the input and DIP definitions are community-sourced and marked as such with their URLs. Statements that could not be confirmed are marked `[unverified]` in place. Two findings worth knowing before building: the two LS259 latches clear to 0 at power-on, so the sub CPUs are *not* held in reset until the main program says so, and the sub2 NMI gate is active when its latch bit is 0 ([memory-map.md](memory-map.md), [cpu-and-timing.md](cpu-and-timing.md)). ## Where the evidence sits - The CPU: z80-rust-fast, certified against hardware-captured and hardware-corrected oracles through the z80-python conformance ladder. Not re-argued here. - The board: MAME, emulator-derived. It is the only board oracle available and it is treated as one: the browser board must reproduce its frame-boundary dumps, and where the two disagree the README records it rather than loosening the comparison. MAME's own MCU cores and its 05xx reconstruction are the ceiling of what can be proven.