-- SPDX-License-Identifier: MIT -- Print the address maps MAME has installed for some CPUs (closed box: what the running -- binary reports, handler names included; no source read). Prepend a line naming the tags: -- printf 'TAGS = {":maincpu", ":audiocpu"}\n' | cat - scripts/mame_map.lua > run.lua -- mame cameltry -rompath "$MAME_ROMPATH" -video none -sound none -nothrottle \ -- -noreadconfig -skip_gameinfo -autoboot_script run.lua -seconds_to_run 5 | grep -E '^(MAP| [0-9A-F])' -- Outputs as run on 2026-11-26: tests/detectors/mame-map-*.txt (docs/mame-oracle.md). TAGS = TAGS or {":maincpu"} done_ = false sub =emu.add_machine_frame_notifier(function() if done_ then return end done_ = true for _, tag in ipairs(TAGS) do local dev = manager.machine.devices[tag] if dev then for name, sp in pairs(dev.spaces) do print("MAP " .. tag .. " " .. name) for _, e in ipairs(sp.map.entries) do local r = e.read and (e.read.handlertype .. ":" .. (e.read.name or "")) or "-" local w = e.write and (e.write.handlertype .. ":" .. (e.write.name or "")) or "-" print(string.format(" %08X-%08X mirror=%X r=%s w=%s share=%s region=%s", e.address_start, e.address_end, e.address_mirror, r, w, e.share or "", e.region or "")) end end end end manager.machine:exit() end)