summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2018-05-02 08:42:56 -0500
committer cracyc <cracyc@users.noreply.github.com>2018-05-02 08:42:56 -0500
commit6efb37250fde2ff84629841149098f54642c5c7b (patch)
tree1dd869dab43afdd95e5ce386a7f1ace8a8a5fdaa
parent72cfcbd39eba25b1ea51499a1770215288f36b75 (diff)
plugins/cheat: translate debugger expressions by space index as the debugger does (nw)
pc9801: use correct video clock, fixes policenauts video speed (nw)
-rw-r--r--plugins/cheat/cheat_xml.lua29
-rw-r--r--src/frontend/mame/luaengine.cpp3
-rw-r--r--src/frontend/mame/luaengine.h1
-rw-r--r--src/mame/drivers/pc9801.cpp4
4 files changed, 28 insertions, 9 deletions
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<uint32_t>,
"write_direct_i64", &addr_space::direct_mem_write<int64_t>,
"write_direct_u64", &addr_space::direct_mem_write<uint64_t>,
- "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<typename T> void log_mem_write(offs_t address, T val);
template<typename T> T direct_mem_read(offs_t address);
template<typename T> 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)