local frames = 0 local last = "" local dbg = manager.machine.debugger local cpu = manager.machine.devices[":maincpu"] dbg:command("bpset 3F53D820,,{ printf \"REGIDSTORE id=%08X obj=%08X\n\", d@(a9+0x40), a11 ; g }") print("XIE-EB4 armed") emu.register_frame_done(function() frames = frames + 1 local f = io.open("/tmp/opencode/eb4.txt", "r") if f then local t = f:read("*l"); f:close() if t and t ~= last then last = t local e = tonumber(t) if e and e ~= 0 then dbg:command(string.format("wpset %08X,8,w,1,{ printf \"EB4WRITE pc=%%08X val=%%08X\n\", pc, wpdata ; g }", e + 0x20)) local sp = cpu.state["SP"].value dbg:command(string.format("wpset %08X,100,w,1,{ printf \"SCTRL\n\" ; g }", (sp - 0x100) & 0x3FFFFFFF)) print(string.format("XIE-EB4 watching %08X (+ctrl)", e + 0x20)) end end end if frames >= 2000000 then machine:exit() end end, "eb4")