Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Tool:MAME

From ReverseEngineering.wiki
Tool
Developer MAME team
License GPL-2.0-or-later and BSD-3-Clause (per file header)
Website https://www.mamedev.org
On this wiki Facts · Code · Notes · Topics

MAME is the multi-system emulator whose driver source files (src/mame/<maker>/<board>.cpp) double as the most complete public documentation of arcade boards: CPU clocks, memory maps, ROM sets and custom chips.

Using driver files as documentation

Each arcade board is one or a few C++ files under src/mame/<maker>/ (for example snk/neogeo.cpp, capcom/cps1.cpp, sega/segas16b.cpp, namco/namcos1.cpp, namco/namcos2.cpp). Older trees used src/mame/drivers/ and src/mame/video/; newer trees group by manufacturer. The licence is in the first line of each file (// license:BSD-3-Clause or GPL-2.0+), so check it before reusing text.

What a driver contains

  • Header comment: board history, PCB layouts, chip lists, ROM board part numbers, known issues. Often written from real PCB inspection ("verified on pcb" comments next to clocks).
  • Address maps: functions such as void cps_state::main_map(address_map &map) list each CPU's memory map as map(0xstart, 0xend).rom() / .ram() / .rw(handler). These are the hardware-address facts: .mirror() gives address aliases, .umask16(0x00ff) says which byte lane of a 16-bit bus a register uses, .region("name", offset) points to a ROM region, .share("tag") marks RAM shared with another device.
  • Machine config (M68000(config, m_maincpu, XTAL(10'000'000)), Z80(...), YM2151(...)): CPUs, clocks and sound/video chips.
  • ROM definitions (ROM_START(name) ... ROM_END): each ROM_REGION(size, "tag", flags) is a memory space or data set; ROM_LOAD(file, offset, size, CRC(...) SHA1(...)) says which chip file goes where. Variants tell you how a ROM set is interleaved: ROM_LOAD16_BYTE (even/odd byte of a 16-bit word), ROM_LOAD16_WORD_SWAP (byte-swapped words), ROM_LOAD64_WORD (one 16-bit word of every four), ROM_CONTINUE (next part of the same file loaded at another offset), ROM_REGION16_BE (big-endian 16-bit region).
  • Input ports (INPUT_PORTS_START): DIP switch and button bit layouts of the I/O registers.

Reading tips

  • Identify a dump by CRC32/SHA-1 against the ROM_LOAD lines.
  • File names in ROM_LOAD are chip names or silkscreen locations (sf2_9.12a = ROM at location 12A), useful to map a ROM dump back to a PCB socket.
  • Sparse-checkout only the folder you need; the repository is very large.
  • Unverified: the exact semantics of every ROM_LOAD variant are defined in src/emu/romentry.h; I did not read that file.

See Platform:Neo Geo, Platform:Capcom CPS-1, Platform:Sega System 16, Platform:Namco System 1, Platform:Namco System 2.

Sources

Read in mamedev/mame at d404316732fb5970cc0170aefc69ef1a85e14fce (cps1.cpp, neogeo.cpp, segas16b.cpp, namcos1.cpp, namcos2.cpp).

Code & repositories

  • https://github.com/mamedev/mame @ d404316732fb5970cc0170aefc69ef1a85e14fce · license: GPL-2.0-or-later AND BSD-3-Clause (declared by the contributor for the files used; GitHub reports Zlib (read from COPYING; GitHub's detector did not classify it) for the repository)
    MAME emulator; src/mame/<maker>/*.cpp drivers document arcade memory maps and ROM sets
    Tested on: source read, not run: read the driver sources · checked 2026-10-18; last activity 2026-10-18; Note: the latest release ships binaries; the wiki links only the source, never the binaries