-- SPDX-License-Identifier: MIT -- Print each CPU's address map as MAME 0.285 describes it to Lua (a closed-box view of -- the running driver: ranges and handler names, no source), then the device list. local function dump() for tag, dev in pairs(manager.machine.devices) do if dev.spaces then for sname, space in pairs(dev.spaces) do local ok, map = pcall(function() return space.map end) if ok and map then print(string.format("== %s %s (data width %d, shift %d)", tag, sname, space.data_width, space.shift)) for _, e in ipairs(map.entries) do local r = e.read and e.read.handlertype or "-" local w = e.write and e.write.handlertype or "-" local rn = e.read and e.read.name or "" local wn = e.write and e.write.name or "" print(string.format(" %08x-%08x mirror %08x R %s %s W %s %s share %s region %s", e.address_start, e.address_end, e.address_mirror, r, rn or "", w, wn or "", e.share or "", e.region or "")) end end end end end for tag, dev in pairs(manager.machine.devices) do print(string.format("dev %-40s %-30s clock %d", tag, dev.shortname or "?", dev.clock or 0)) end end local done = false _G.map_notifier = emu.add_machine_frame_notifier(function() if done then return end done = true local ok, err = pcall(dump) if not ok then print("map.lua error: " .. tostring(err)) end io.stdout:flush() manager.machine:exit() end)