-- code22_probe.lua -- -- Resolve two mechanics at the level-1 error dispatcher: -- (1) does a bpset fire BEFORE or AFTER its instruction executes? -- (2) what 32-bit value does the dispatcher read from *a13(0xffe0)? -- -- We break at 0x3FDF0630 (the read) and at 0x3FDF0650 (the next instruction, -- jreq) and print a8 / a13 / the dword at the read address. -- -- CP_FRAMES=300 vt1200 ... -autoboot_script harness/mame/code22_probe.lua local machine = manager.machine local cpu = machine.devices[':maincpu'] local dbg = machine.debugger if not dbg then print("ERROR: no debugger"); machine:exit(); return end dbg:command('bpset 3fdf0630,,{ printf "AT-READ pc=%08X a13=%08X a14=%08X a8=%08X d@16F0=%08X\\n", pc, a13, a14, a8, d@16F0 ; g }') dbg:command('bpset 3fdf0650,,{ printf "AT-NEXT pc=%08X a8=%08X d@16F0=%08X\\n", pc, a8, d@16F0 ; g }') print("breakpoints armed") local maxframes = tonumber(os.getenv("CP_FRAMES") or "300") local n = 0 emu.register_frame_done(function() n = n + 1 if n >= maxframes then print("done (" .. n .. " frames)") machine:exit() end end, "vt1200-cp") dbg.visible_cpu = cpu dbg.execution_state = 'run'