-- probe_end.lua -- frame clock + PC/SP/ST and hook-state sampler. local machine = manager.machine local cpu = machine.devices[':maincpu'] local prog = cpu.spaces['program'] local clock = os.getenv("FRAME_CLOCK") local stop = tonumber(os.getenv("FRAME_STOP") or "0") local f = 0 local function rw(b) return prog:read_u16(b) end local function rl(b) return prog:read_u32(b) end emu.register_frame_done(function() f = f + 1 if clock then local fh = io.open(clock, "w") if fh then fh:write(f .. "\n"); fh:close() end end if f >= 3480 and f % 10 == 0 then print(string.format( "END f=%d PC=%08X SP=%08X ST=%08X counter=%04X state=%04X orig=%08X box=%04X%04X", f, cpu.state['PC'].value, cpu.state['SP'].value, cpu.state['ST'].value, rw(0x01840E00), rw(0x01840E10), rl(0x01840E20), rw(0x04064100), rw(0x04064110))) end if stop > 0 and f >= stop then machine:exit() end end, "vt1200-probe-end")