SearchA-ZG › Golden Axe

Golden Axe

1989 Arcade Source available Online

Golden Axe (Sega, 1989) is a landmark side-scrolling hack-and-slash on the Sega System 16B arcade board: up to two players pick the barbarian Ax Battler, the dwarf Gilius Thunderhead or the amazon Tyris Flare and fight across a fantasy kingdom to reclaim the Golden Axe from the tyrant Death Adder, riding stolen beasts and casting screen-clearing magic. This build runs the original arcade board in the browser - a Motorola 68000 main CPU, a Zilog Z80 sound CPU with a YM2151 and a uPD7759, and an Intel 8751 protection MCU - using a from-source WebAssembly build of the FinalBurn Neo (FBNeo) arcade emulator, 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 68000, read and write its registers and memory, and set execution breakpoints and write watchpoints.

Runs on: Web browser

Golden Axe Online Emulator

Play Golden Axe using JavaScript directly in your browser.

Configurations

ConfigurationEmulatorMachineOSLegal
Golden AxeGolden AxeGolden AxegreyOpen ⛶
Golden Axe (Japan)Golden AxeGolden AxegreyOpen ⛶

Machine emulated

The Sega System 16B board (1989) - a Motorola 68000 main CPU at 10 MHz, a Zilog Z80 sound CPU driving a Yamaha YM2151 FM synthesiser and a NEC uPD7759 ADPCM sample player, an Intel 8751 protection microcontroller, the Sega 315-5195 memory mapper, two scrolling tilemap layers plus a fixed text layer and a hardware sprite list, scanned as a 320×224 raster. It is the hardware behind many of Sega's classic late-1980s arcade games.

Chips

Notes

Embedding

Golden Axe (Sega, 1989) runs on the Sega System 16B arcade board, emulated by FinalBurn Neo (FBNeo) compiled to WebAssembly with Emscripten. FBNeo normally ships as a libretro core or an SDL app; instead of either frontend we wrote a tiny standalone Emscripten frontend, sys16_wasm.cpp, that talks to FBNeo's OWN C++ burn-library API (BurnLibInit / BurnDrvSelect / BurnDrvInit / BurnDrvFrame) and exposes it to JavaScript through a handful of flat functions. The module is built with -s MODULARIZE=1 so goldenaxe.js is a factory you instantiate. Everything is self-hosted (no CDN): the rebuilt goldenaxe.js / goldenaxe.wasm and the game as a standard FBNeo/MAME romset ZIP.

// goldenaxe.js defines a global Module factory; instantiate it, stage the
// driver short-name + romset ZIP, then boot.
var sys16 = await Module({ locateFile: f => SRC + f });  // finds goldenaxe.wasm
var np = sys16._wasm_game_buf(name.length); sys16.HEAPU8.set(name, np); // "goldnaxe"
var rp = sys16._wasm_rom_buf(rom.length);  sys16.HEAPU8.set(rom, rp);  // romset ZIP
sys16._wasm_start();                                    // select driver, load ROMs, BurnDrvInit, reset

Rendering is manual. FBNeo rasters into its own bitmap (pBurnDraw); the frontend converts the visible 320×224 window to RGBA in the WASM heap. Each frame we blit that buffer to an off-screen canvas and draw it scaled to the visible canvas:

var rgba = new Uint8ClampedArray(sys16.HEAPU8.buffer, sys16._wasm_fb_ptr(), 320*224*4);
backImg.data.set(rgba); bctx.putImageData(backImg, 0, 0);
ctx.drawImage(back, 0,0, 320,224, 0,0, canvas.width, canvas.height);

Input is the System 16 player latch: an 8-way stick plus three action buttons (Attack / Jump / Magic), with Start and Coin as separate service bits. We keep the pressed bits in JS and push them once per frame; the frontend maps them onto FBNeo's per-input pVal bytes (found by name through BurnDrvGetInputInfo) that the 68000 reads.

Debugger integration

The FBNeo core runs frame-at-a-time inside WebAssembly. Following the runbook's guidance, the core was extended with a small block of EMSCRIPTEN_KEEPALIVE wasm_dbg_* functions that SAMPLE FBNeo's Musashi 68000 (main CPU 0) on demand — no per-instruction hot-path hook. Because Musashi exposes a genuine register file, a public m68k_get_reg/m68k_set_reg interface and a real one-instruction execute, the debugger gets the real thing rather than a re-implementation.

window.EMU_BOOT.transport maps the shared debugger's controls onto those exports:

  • pause / resume / isPaused — stop or restart the requestAnimationFrame loop that calls _wasm_tick (one BurnDrvFrame).
  • stepInsn(n)_wasm_dbg_step runs exactly one 68000 instruction via SekRun(0, 1) and advances PC by one instruction. Single-step always makes progress, even off a breakpoint.
  • step(n) — advance n whole 60 Hz frames.
  • breakpoints — a host-side set of PC values. When any breakpoint or watchpoint is armed the loop runs instruction-by-instruction (_wasm_dbg_step), checking PC after each; a match pauses before the next instruction. With none armed it runs a whole frame at full speed.
  • watchpoints — the host snapshots each watched byte and compares after each stepped instruction, pausing the loop when a watched address changes.

Registers are read and written live through _wasm_dbg_reg/_wasm_dbg_set_reg (D0-D7, A0-A7), plus PC, the 16-bit SR (with the X N Z V C condition codes and the S supervisor bit), and USP/SSP. Memory reads are side-effect-free: _wasm_dbg_read returns the 68000 program ROM (from $000000) and the 16 KB work RAM at $FFC000 straight out of FBNeo's allocated buffers, never touching an I/O port or acknowledging an interrupt. The plug-in (goldenaxe-debug.js) feeds all of this to EmuKit.defineMachine and reuses the shared m68000 disassembler at /debugger/src/cpus/m68000.js.

Architecture

The Sega System 16B board (1989) is a classic 16-bit arcade platform:

  • Main CPU — a Motorola 68000 at 10 MHz running the game; program ROM from $000000, tilemap/text RAM at $400000, sprite RAM at $440000, palette RAM at $840000 and 16 KB of work RAM at $FFC000. This is the CPU the debugger targets.
  • Sound CPU — a Zilog Z80 driving a Yamaha YM2151 FM synthesiser and a NEC uPD7759 ADPCM sample player for voices and effects.
  • Protection MCU — an Intel 8751 microcontroller (317-0123A) that the main CPU hands work to; FBNeo runs the real MCU program so the game passes its checks.
  • Video — two scrolling tilemap layers plus a fixed text layer and a hardware sprite list, coloured through the palette RAM and scanned as a 320×224 raster.
  • 315-5195 — the Sega memory-mapper / I/O gate array that ties the CPU, inputs and the sound latch together.

Golden Axe is a side-scrolling hack-and-slash for up to two players — a barbarian, a dwarf and an amazon reclaiming the Golden Axe from Death Adder — and one of Sega's signature System 16 titles.