local prog = manager.machine.devices[":maincpu"].spaces["program"] local start = manager.machine.ioport.ports[":ctrl1:joypad:JOYPAD"].fields["P1 Start"] local n = 0 local log = io.open("ac.txt", "w") frame_sub = emu.add_machine_frame_notifier(function() n = n + 1 if n == 120 then start:set_value(1) end if n == 126 then start:clear_value() end if n % 600 == 0 then local p, f, o = 0, 0, 0 for a = 0x400, 0x4FF do local v = prog:read_u8(a) & 3; if v == 1 then p = p + 1 elseif v == 2 then f = f + 1 elseif v ~= 0 then o = o + 1 end end log:write(string.format("F%d pass=%d fail=%d other=%d\n", n, p, f, o)); log:flush() end if n == 7200 then for a = 0x400, 0x4FF do log:write(string.format("%02X ", prog:read_u8(a))); if a % 16 == 15 then log:write("\n") end end manager.machine.video:snapshot() end end)