-- SPDX-License-Identifier: MIT -- Dump every CPU's address maps as MAME 0.285 builds them (a closed-box observation). local out = io.open(os.getenv("IREM_MAP_OUT") or "maps.txt", "w") for tag, dev in pairs(manager.machine.devices) do local ok, spaces = pcall(function() return dev.spaces end) if ok and spaces then for name, space in pairs(spaces) do out:write(string.format("== %s %s data_width=%d addr_width=%d shift=%d\n", tag, name, space.data_width, space.address_bus_width or 0, space.shift or 0)) local ok2, map = pcall(function() return space.map end) if ok2 and map then for _, e in ipairs(map.entries) do local r, w = e.read, e.write out:write(string.format(" %08X-%08X mirror=%X mask=%X R:%s %s W:%s %s share=%s region=%s\n", e.address_start, e.address_end, e.address_mirror, e.address_mask, r.handlertype, r.tag or "", w.handlertype, w.tag or "", e.share or "", e.region or "")) end end end end end out:close() manager.machine:exit()