diff --git a/plugins/cheat/cheat_xml.lua b/plugins/cheat/cheat_xml.lua index ac63bb76c7c..cb849fe0b07 100644 --- a/plugins/cheat/cheat_xml.lua +++ b/plugins/cheat/cheat_xml.lua @@ -54,27 +54,46 @@ local function xml_parse(data) return xml_table end +local cpu_spaces = {} + +for tag, device in pairs(manager:machine().devices) do + local sp + for name, space in pairs(device.spaces) do + if not sp then + sp = {} + cpu_spaces[tag] = sp + end + sp[space.index] = space.name + end +end + function xml.conv_cheat(data) local spaces, regions, output data = xml_parse(data) + local function convert_expr(data) local write = false local function convert_memref(cpu, phys, space, width, addr, rw) + -- debug expressions address spaces by index not by name + local function get_space_name(index) + return cpu_spaces[":" .. cpu][index] + end + local mod = "" local count if space == "p" then - fullspace = "program" + fullspace = get_space_name(0) elseif space == "d" then - fullspace = "data" + fullspace = get_space_name(1) elseif space == "i" then - fullspace = "io" + fullspace = get_space_name(2) elseif space == "r" then - fullspace = "program" + fullspace = get_space_name(0) mod = "direct_" space = "p" elseif space == "o" then - fullspace = "decrypted_opcodes" + fullspace = get_space_name(3) mod = "direct_" space = "o" end diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index e8e45bbf2fd..846d24dbbd0 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -1441,8 +1441,9 @@ void lua_engine::initialize() "write_direct_u32", &addr_space::direct_mem_write, "write_direct_i64", &addr_space::direct_mem_write, "write_direct_u64", &addr_space::direct_mem_write, - "name", sol::property(&addr_space::name), + "name", sol::property([](addr_space &sp) { return sp.space.name(); }), "shift", sol::property([](addr_space &sp) { return sp.space.addr_shift(); }), + "index", sol::property([](addr_space &sp) { return sp.space.spacenum(); }), "map", sol::property([this](addr_space &sp) { address_space &space = sp.space; sol::table map = sol().create_table(); diff --git a/src/frontend/mame/luaengine.h b/src/frontend/mame/luaengine.h index d346abe2857..205c84f2e36 100644 --- a/src/frontend/mame/luaengine.h +++ b/src/frontend/mame/luaengine.h @@ -138,7 +138,6 @@ private: template void log_mem_write(offs_t address, T val); template T direct_mem_read(offs_t address); template void direct_mem_write(offs_t address, T val); - const char *name() const { return space.name(); } address_space &space; device_memory_interface &dev; diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 55076ea8d7e..b52c78d5689 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -2333,12 +2333,12 @@ MACHINE_CONFIG_START(pc9801_state::pc9801_common) MCFG_SCREEN_UPDATE_DRIVER(pc9801_state, screen_update) MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(pc9801_state, vrtc_irq)) - MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2) + MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 21.0526_MHz_XTAL / 8) MCFG_DEVICE_ADDRESS_MAP(0, upd7220_1_map) MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text) MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w)) - MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2) + MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 21.0526_MHz_XTAL / 8) MCFG_DEVICE_ADDRESS_MAP(0, upd7220_2_map) MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)