Skip to content

Tools for console work ​

GameFrame's playbook works for consoles, but some tools change. The tables on this page cover both home consoles and handhelds. The Handhelds pages add the handheld CPUs and tools. Ghidra needs the right processor module and a loader for the console's file format. Take most ground truth from emulators with debuggers. GameFrame's Unicorn emulator runs some console CPUs.

Disassembly and decompilation ​

CPUConsolesIn Ghidra
6502 and 65C02Atari 2600, 5200 and 7800, NES, Lynx, PC Engine (HuC6280 is close)Built in (6502, 65C02). Extensions add NES ROM loaders and mappers. The ADC p-code is not exact (see below)
HuC6280PC Engine, PC Engine CD65C02 is close; Ghidra_HuC6280 fixes the block-transfer and MMU instructions
CP1600IntellivisionBuilt in
6809VectrexBuilt in under MC6800
65C816SNESThrough community extensions; IDA and dedicated disassemblers are alternatives
Z80 and SM83Master System, Game Boy, sound CPUsZ80 built in; the Game Boy's SM83 through extensions
68000Mega Drive, Neo Geo, arcade boardsBuilt in (68000). Extensions add Mega Drive ROM loaders
MIPS (R3000, R4300, R5900)PlayStation, Nintendo 64, PlayStation 2MIPS built in; extensions add PS-X EXE and N64 ROM loaders, and the R5900's extra instructions
SuperH (SH-2, SH-4)Saturn, DreamcastBuilt in (SuperH with SH-1, SH-2 and SH-2A; SuperH4)
PowerPC (Gekko, Broadway)GameCube, WiiPowerPC built in; extensions add paired-single instructions and DOL and REL loaders
ARM7 (ARM and Thumb)Game Boy Advance, Nintendo DSBuilt in
x86Xbox, PS4 onwardBuilt in; an extension adds the XBE loader
V30MZWonderSwanx86 real mode, plus ghidra-wonderswan
V810Virtual BoyThe built-in V850 differs; Ghidra_v810_v830 adds it
TLCS-900/HNeo Geo PocketNone; NGDis disassembles
AllegrexPSPghidra-allegrex
Cell SPUPlayStation 3GhidraSPU
Jaguar RISC (Tom and Jerry)Atari JaguarNone known
ARMv3 (ARM60)3DOARM languages start at v4, so no exact match

Set the memory map before analysis: ROM, RAM and hardware registers at their addresses, and name the hardware registers. Most console communities publish register lists; load them as labels so the decompiled code reads PPUCTRL instead of 0x2000.

For 8-bit and 16-bit games written in assembly, the decompiler's C output is of limited use. Work from the disassembly and write your findings as tables and prose.

Ghidra's 6502 ADC p-code is not exact. It has no decimal path. It leaves the incoming carry out of the carry-out test. It copies V from C instead of computing signed overflow (6502.slaspec lines 127–138). Do not use p-code emulation as ground truth for 6502 games. Take 6502 ground truth from a tested core: py65, mre/mos6502, floooh/chips or MAME.

Capstone's next branch has MOS65XX modes (6502, 65C02, W65C02, 65816) and M680X modes (6809, 6309 and others). It has no Z80, R5900 or Allegrex mode (capstone.h). For 65816 code, the Capstone width mode must follow the M and X flag state in each function.

Ghidra loaders ​

LoaderPlatformFormat
ghidra-vectrex-loaderVectrexCartridge
NTRGhidraNintendo DSARM9 and ARM7 binaries
Ghidra-GameCube-LoaderGameCube, WiiDOL and REL
XEXLoaderWVXbox 360XEX2
ghidra-3dsNintendo 3DS3DS files; analysis described as "pretty broken"
ghidra-3dsx-loaderNintendo 3DS3DSX homebrew
GhidraVitaLoader, VitaLoaderReduxPS VitaSELF wrapping ARM ELF
GhidraRPXLoaderWii URPX and RPL
GhidraPS4Loader, GhidraOrbisPlayStation 4Decrypted ELF without the Sony header
Ghidra-Switch-LoaderNintendo SwitchNSO

Check each extension's recent activity before relying on it. Archived modules need a pinned version that matches the Ghidra release, or an active fork. Test an extension with few users on a known binary.

Emulators with debuggers ​

ConsoleEmulators with good debuggers
NES, SNES, Game Boy, PC EngineMesen (NES; Mesen 2 adds SNES, Game Boy, PC Engine), bsnes-plus (SNES), BGB and SameBoy (Game Boy)
Mega DriveBlastEm, Exodus, Gens KMod
Game Boy AdvancemGBA, no$gba
PlayStationPCSX-Redux, DuckStation, no$psx
Nintendo 64ares, Project64 with its debugger
SaturnMednafen, Kronos
DreamcastFlycast, Redream (limited debugging)
PlayStation 2PCSX2 with its debugger
GameCube and WiiDolphin
Xboxxemu
Atari 2600Stella
IntellivisionjzIntv
LynxHandy, Mednafen
JaguarBigPEmu (closed; debugger unknown), Virtual Jaguar
3DOOpera (not confirmed)
Virtual Boy, WonderSwan, Neo Geo Pocket, PC Engine CDMednafen
PlayStation 3RPCS3
Xbox 360Xenia Canary
Nintendo DSmelonDS, DeSmuME, no$gba
Nintendo 3DSAzahar
PSPPPSSPP
PS VitaVita3K
Wii UCemu
PlayStation 4shadPS4
Nintendo SwitchRyubing, Eden, Citron
ArcadeMAME
Several systems, scriptedBizHawk (Lua scripting, input movies, RAM watch, many cores)

Debugger support in the newer emulators varies. Some entries above are not confirmed. The Seventh generation onward page gives the dated status of the home console emulators. The Handhelds pages give the handheld emulators, from SameBoy and PokeMini to the Switch forks. The family pages give the rest (Early consoles, Jaguar and 3DO, CD add-ons).

What to use them for:

  • RAM search and watch to find variables: search for a value that changes when the player's lives change, then name the address.
  • Breakpoints on reads and writes to find the code that changes a variable.
  • Trace logs of every instruction for a frame, to compare with your port's behaviour.
  • Input movies (BizHawk, FCEUX, Mesen) as recorded per-frame input. They are the console equivalent of demos. Tool-assisted speedrun movies cover whole games.
  • Scripting (Lua in Mesen, BizHawk, FCEUX) to dump RAM every frame and to drive the game. This is the console equivalent of GameFrame's headless runs.

GameFrame's Unicorn emulator ​

Unicorn 2 emulates ARM, ARM64, M68K, MIPS (32 and 64-bit), PowerPC, RISC-V, s390x, SPARC, TriCore and x86. It has no 6502, 65816, Z80 or SuperH. It has no R5900, no paired singles and no VMX128. Its MIPS likely does not model the R3000A load delay slot; this is untested. For the CPUs it supports, you can run one original function headless, as pe_emu.py does for Windows code:

  1. Load the ROM or the executable's code segments at their addresses.
  2. Map RAM, and fill it from a RAM dump taken in an emulator at the right moment.
  3. Set the registers, call the function, read the results.
  4. Stub hardware registers the function touches.

This gives bit-exact ground truth in tests, as for PC games. Unicorn does not emulate coprocessors such as the PlayStation's GTE or the PS2's vector units; take ground truth for those from a full emulator.

For CPUs Unicorn lacks, MAME's m6809, g65816, tms9900, cp1610, jaguar and m68000 core files carry license:BSD-3-Clause headers, though MAME as a whole is GPL-2.0. For the Z80, iz80 (BSD-3) passes ZEXALL. Otherwise use a small emulator core in Python or Rust for that CPU (6502 and Z80 cores are short), or script a full emulator to run the function and dump the result.

Splitting and building tools ​

Projects that decompile console games built tools that also help a reimplementation:

ToolWhat it does
splatSplits a ROM or executable (N64, PlayStation, PS2) into code, data and assets by a configuration file, and disassembles the code
asm-differCompares the assembly of two builds function by function
decomp-toolkit (dtk) and objdiffSplit and compare GameCube and Wii programs
decomp.meA website for comparing the output of the original compilers with candidate C code
m2cTurns MIPS and PowerPC assembly into first-draft C

See Matching decompilation for how they fit together.

Code: Apache 2.0. Content: CC0 1.0. No game material: bring your own copy.