cpu = manager.machine.devices[":maincpu"] log = io.open("io.log", "w") local function now() return manager.machine.time:as_double() end wtap = cpu.spaces["io"]:install_write_tap(0x0000, 0xffff, "outs", function(offset, data, mask) log:write(string.format("O %04X %02X %.9f\n", offset, data, now())) end) rtap = cpu.spaces["io"]:install_read_tap(0x0000, 0xffff, "ins", function(offset, data, mask) log:write(string.format("I %04X %02X %.9f\n", offset, data, now())) end) dbg = manager.machine.debugger dbg.visible_cpu = cpu dbg:command('trace T.trace,:maincpu,noloop,{logerror "T %X %d\\n",pc,totalcycles}') dbg:command("go") tracing = true notifier = emu.add_machine_frame_notifier(function() local t = now() if tracing and t >= 0.04 then manager.machine.debugger:command('trace off') tracing = false end if t >= 2.0 then manager.machine.video:snapshot() log:close() manager.machine:exit() end end)