-- logs writes to the period counter $FFC466 with value >= 3 and to the state flags $FFC2EA local cpu=manager.machine.devices[":maincpu"]; local sp=cpu.spaces["program"]; local dbg=manager.machine.debugger; local fr=0; local seen=0 local lf=io.open(os.getenv("POUT") or "endwatch.txt","w") emu.register_frame_done(function() fr=fr+1 if fr==60000 then cpu.debug:wpset(sp,"w",0xffc466,2,"wpdata>=3",'printf "C466 pc=%x val=%x h=%d a=%d hs=%d as=%d",pc,wpdata,b@ffc331,b@ffc333,w@ffc6da,w@ffca3e ; go') cpu.debug:wpset(sp,"w",0xffc2ea,1,"1",'printf "C2EA pc=%x val=%x",pc,wpdata ; go') end if fr>60000 and dbg.execution_state~="run" then dbg.execution_state="run" end local log=dbg.consolelog; for k=seen+1,#log do local l=log[k]; if l:match("^C4") or l:match("^C2") then lf:write(fr," ",l,"\n"); lf:flush() end end; seen=#log end)