Scramble
Scramble (Konami, 1981; licensed to Stern Electronics in the US) is the arcade game that defined the horizontally-scrolling shooter, flying a jet through six distinct terrains against a steadily draining fuel gauge. This build runs the original Zilog Z80 board in the browser - the pure-TypeScript Konami Galaxian/Scramble hardware model from 8bitworkshop, bundled to a browser global - and boots straight into the attract-mode score table. It is wired to the emulators.org in-frame debugger so you can single-step the Z80, read and write the registers and the full 64K memory, and set execution breakpoints and write watchpoints.
Runs on: Web browser
Scramble Online Emulator
Play Scramble using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| Scramble | Scramble | Scramble | grey | Open ⛶ |
Machine emulated
The Scramble arcade board (Konami, 1981) - a Zilog Z80 at 3.072 MHz on Galaxian-derived hardware: a 32-column tilemap with per-column scroll, hardware sprites and missiles, a twinkling star field and a 256×224 raster coloured through a 32-entry PROM, with a second Z80 and twin AY-3-8910 PSGs on a separate sound board. It is the machine that founded the horizontally-scrolling shooter.
Chips
Notes
Embedding
Scramble is the 1981 Konami arcade machine (licensed to Stern in the US): a Zilog Z80 at 3.072 MHz driving a 256×224 raster on Galaxian-derived tilemap-and-sprite hardware, with a second Z80 and twin AY-3-8910 PSGs on a separate sound board. This build vendors the pure-TypeScript GalaxianScrambleMachine from Steven Hugg's 8bitworkshop (MIT), bundled to a browser global with esbuild, and drives it from a host-owned loop so the debugger can control it.
Boot. One combined ROM image (main program at 0x0000–0x3FFF, character/sprite graphics at 0x4000, the colour PROM at 0x5000) is handed to the machine and the Z80 starts at 0x0000, dropping straight into the attract-mode score table:
var machine = new ScrambleCore.GalaxianScrambleMachine();
machine.reset();
machine.loadROM(SCRAMBLE_ROM); // 0x5020-byte combined image
machine.connectVideo(pixels); // 264x264 ARGB frame buffer
The machine object. The core exposes the whole board as ordinary methods and fields, so the host page can render, step and inject input:
| Member | Kind | What it does |
|---|---|---|
advanceFrame(trap) | method | Run one 60 Hz field, calling trap() before every instruction; when trap returns true it stops mid-frame; this is what powers stepping and breakpoints. |
cpu.advanceInsn() | method | Execute exactly one Z80 instruction, a single debugger step. |
cpu.saveState() / cpu.loadState(s) | method | Read or write the full Z80 register file (AF/BC/DE/HL and their primes, IX/IY, SP, PC, I/R, IFF), how the debugger reads and pokes registers. |
readConst(a) | method | Side-effect-free memory read (skips the I/O windows), what the debugger's hex and disassembly views call. |
read(a) / write(a,v) | method | The live CPU bus; write is wrapped here so a store to a watched address pauses the loop. |
inputs | field | The active-low input latches (joystick, fire, bomb, coin, 1P/2P start) that the control panel and keyboard drive. |
Video. Each field the loop runs the machine's 264 scanlines, then copies the 264×264 ARGB frame buffer into an ImageData and blits its visible 256×224 window onto the canvas, rotated 90° (the Konami video RAM is stored sideways).
Debugger integration
The debugger drives a host-owned run loop. The Z80 interpreter runs one instruction at a time, and the machine's advanceFrame(trap) calls a trap callback before every instruction, so the loop can pause, single-step and check breakpoints between any two instructions. No changes to the CPU core were needed.
window.EMU_BOOT.transport exposes the controls the shared debugger calls:
- pause / resume / isPaused - stop or restart the
requestAnimationFrameloop. Resume first single-steps past a breakpoint it is parked on, so it does not re-trigger immediately. - stepInsn(n) - call
cpu.advanceInsn()exactly n times and redraw, so a single step advances the PC by one instruction. - step(n) - advance n whole 60 Hz fields (interrupts and all).
- breakpoints - a
Setof PC values. The frame trap returns true when the Z80's PC is in the set, pausing before that instruction; when the set is empty the trap is a no-op, so an idle debugger costs nothing. - watchpoints -
machine.writeis wrapped so a store to a watched address raises a flag, and the frame trap pauses the loop on the next instruction.
The plug-in (scramble-debug.js) reads these hooks and calls EmuKit.defineMachine with the full Z80 register set (bound to the shared z80 disassembler at /debugger/src/cpus/z80.js), five memory chips (the 64K bus, the 16K program ROM, the 2K work RAM, the 1K character VRAM with a tile view, and the object RAM) and an on-screen control panel. Registers are read and written through the core's saveState()/loadState(), so writing to a register in the debugger updates the running machine.
Architecture
The Konami Scramble board is the Galaxian hardware extended for a horizontally-scrolling shooter, modelled here as plain objects on the GalaxianScrambleMachine:
- CPU - a Zilog Z80 at 3.072 MHz (the 18.432 MHz master crystal ÷6), with the 64 KB address space behind an address-decoder bus: ROM at
0x0000, work RAM at0x4000, character VRAM at0x4800, object (sprite) RAM at0x5000, and the input / watchdog / PPI ports from0x6000up. - Video - a 32-column tilemap with per-column scroll, hardware sprites, missiles and a twinkling star field, coloured through a 32-entry PROM. The display is rotated 90°.
- Protection - Scramble's PPI-based protection challenge/response is emulated, so the main set boots past its start-up check.
- Sound - on real hardware a second Z80 plus two AY-3-8910 PSGs; the PSGs are wired to the main CPU's I/O bus in this core, and this build runs the video silently (no audio sink is attached).
The main CPU takes one NMI per field (enabled through a latch at 0x6801); the host loop reproduces exactly that, running the 264 scanlines of the field between NMIs and feeding the watchdog the game expects.