-- SPDX-License-Identifier: MIT -- Print every CPU's address maps as MAME 0.285 builds them (a closed-box observation: -- the running binary's map entries, not its source). Used by docs/memory-map.md. -- Adapted from konami68k-python's (handler names added where the binary gives them). for tag, dev in pairs(manager.machine.devices) do if dev.spaces ~= nil then for sname, space in pairs(dev.spaces) do local ok, map = pcall(function() return space.map end) if ok and map ~= nil then 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 rt = e.read and ((e.read.tag or "") .. "/" .. (e.read.name or "")) or "" local wt = e.write and ((e.write.tag or "") .. "/" .. (e.write.name or "")) or "" print(string.format("MAP %s %s %08X-%08X mirror=%X mask=%X r=%s:%s w=%s:%s share=%s region=%s", tag, sname, e.address_start, e.address_end, e.address_mirror, e.address_mask, r, rt, w, wt, e.share or "", e.region or "")) end end end end end manager.machine:exit()