|
Trouble understanding reading memory addresses in debugger/lua/cheat system
#372720 - 01/04/18 01:43 PM
|
|
|
hi, I'm working on my lua extensibility plugin still.
I'm testing MKII version 3.1. I used the cheatfinder plugin to create a chat, and the file states:
mk2,:maincpu,20C050,b,9,Test cheat at addr 0020C050
The xml file looks like (modified so it'll show):
mamecheat version=1 cheat desc="Test cheat at addr 0020C050" sript state="run" action>maincpu.ppb@20C050=9 /script /cheat
From what I'm understanding, that's setting 0x0020C050 to a value of 9...I want to read this value to see what it's set at, as I believe it will tell me which character the user has selected.
In the debug/memory window, I select MainCPU from the dropdown, then type in 0x0020c050 and I don't see the value of 9 at all...the values all look to be zeros.
I also tried, via lua, to do: cpu = manager:machine().devices[":maincpu"] mem = cpu.spaces["program"] print(mem:read_u8(0x0020c050))
I did that from the console, and get back 0, which lines up with what I'm seeing in the memory window of the debugger. Yet the 'cheat' seems to imply that 0x0020c050 is the magical address I should be querying.
I'm very much a newb in this area, so asking..am I going about this the right way? Or is there a translation between the cheat memory addesss and what I'm trying to query that I'm just missing? Or something else?
Edited by Jfarro (01/04/18 01:46 PM)
|
|
|
|
Re: Trouble understanding reading memory addresses in debugger/lua/cheat system
[Re: Jfarro]
#372744 - 01/05/18 02:10 AM
|
|
|
There's currently some weirdness with the TMS34010 wrt how it's addressing works. You need to multiply the address 20C050 by 8 to get the same view in the memory window. This should only effect this and a few other cpus.
|
|
|
|
Re: Trouble understanding reading memory addresses in debugger/lua/cheat system
[Re: crazyc]
#372757 - 01/05/18 09:06 AM
|
|
|
CrazyC, once again you've saved me. I spent hours trying to figure out what was wrong, and your answer was dead on. I can see the values now! Thanks a ton
|
|
|