User File #51619615831003777

Upload All User Files

#51619615831003777 - NES Donald Land - Timing script

DL_ScoreCard.lua
Game: Donald Land ( NES, see all files )
624 downloads
Uploaded 12/3/2018 4:28 PM by FatRatKnight (see all 245)
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