cpu = manager.machine.devices[":maincpu"] space = cpu.spaces["io"] log = io.open("io.log", "w") n = 0 function rec(dir, offset, data) n = n + 1 if n <= 500000 then log:write(string.format("%.9f %04X:%04X %s %03X %02X\n", manager.machine.time:as_double(), cpu.state["CS"].value, cpu.state["IP"].value, dir, offset, data & 0xff)) end end wtap = space:install_write_tap(0x000, 0x3ff, "w", function(offset, data, mask) rec("W", offset, data) end) rtap = space:install_read_tap(0x000, 0x3ff, "r", function(offset, data, mask) rec("R", offset, data) end) frames = 0 sub = emu.add_machine_frame_notifier(function() frames = frames + 1 if frames == 3000 then log:close() manager.machine.video:snapshot() print("ACCESSES " .. n .. " TIME " .. manager.machine.time:as_double()) manager.machine:exit() end end)