All this one does is look at a few addresses to figure out when stages begin or end, as an assist to figuring out when we completed them.
local r1u_= memory.read_u8
local r1u= function(a) return r1u_(a,"System Bus") end
local OldState= 0
local StartFrame= 0
--*****************************************************************************
local function ProgressChecker()
--*****************************************************************************
local State= r1u(0x00DA)
if (OldState == 0) and (State ~= OldState) then
StartFrame= emu.framecount()
print(string.format("%05d - Stage %d begin",StartFrame,r1u(0x0051)))
elseif (State == 50) and (OldState ~= State) then
local fc= emu.framecount()
print(string.format("%05d == Done in %d frames ==",fc,fc - StartFrame))
end
OldState= State
end
while true do ProgressChecker(); emu.frameadvance() end