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"),"w") emu.register_frame_done(function() fr=fr+1 if fr==1200 then for a in string.gmatch(os.getenv("WADDRS"),"%x+") do cpu.debug:wpset(sp,"w",tonumber(a,16),2,"1",'printf "W pc=%x addr=%x val=%x",pc,wpaddr,wpdata ; go') end end if fr>1200 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("^W ") then lf:write(fr," ",l,"\n"); lf:flush() end end; seen=#log end)