-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Hi,
I was trying to learn how GPL works using MAME, however it's hard to follow the execution.
As an experiment, I could find the address of the executing GPL address opcode by setting a breakpoint on 007a,
then I can see the disassembly with putting the a-maze-ing.rpk rom in g.bin and
[MAME]> address=emu.item(manager.machine.devices[":gromport:single:cartridge:grom3"].items["0/m_address"]):read(0)-1 adrhex = string.format("%x",address) offhex = string.format("%x",address&0x1fff) os.execute("python3 xdg99.py g.bin -a "..adrhex.." -f "..adrhex.." -k "..offhex.." ; head -19 g.dis")
xda99, version 3.5.2
Warning: Invalid disassembly: VDP register too large
Warning: Invalid disassembly: address encoding should use 2 bytes instead of 3 bytes
Warning: Incomplete program
grom >6000
aorg >080a
680a 02 rand >0f
680b 0f
680c a2 add >09, @random
680d 78
680e 09
680f 05 b >6820
6810 68
6811 20
6812 02 rand >13
6813 13
6814 a2 add >01, @random
6815 78
6816 01
6817 bc st @random, @>83a9
6818 80
6819 a9
681a 78
then stepping and looking at the disassembly for the next instruction
g
Stopped at breakpoint 2
[MAME]> address=emu.item(manager.machine.devices[":gromport:single:cartridge:grom3"].items["0/m_address"]):read(0)-1 adrhex = string.format("%x",address) offhex = string.format("%x",address&0x1fff) os.execute("python3 xdg99.py g.bin -a "..adrhex.." -f "..adrhex.." -k "..offhex.." ; head -19 g.dis")
: xda99, version 3.5.2
Warning: Invalid disassembly: VDP register too large
Warning: Invalid disassembly: address encoding should use 2 bytes instead of 3 bytes
Warning: Incomplete program
grom >6000
aorg >080c
680c a2 add >09, @random
680d 78
680e 09
680f 05 b >6820
6810 68
6811 20
6812 02 rand >13
6813 13
6814 a2 add >01, @random
6815 78
6816 01
6817 bc st @random, @>83a9
6818 80
6819 a9
681a 78
681b 02 rand >13
681c 13
Just a proof of concept, an idea of using xdg99 with mame.
If I watch accesses at 9800 and 9c02 I could collect the opcodes and parameters and even possibly make a small file for xdg to disassemble.