Skip to navigation


Utility routines: DELAY

[NES version, Bank 7]

Name: DELAY [Show more] Type: Subroutine Category: Utility routines Summary: Wait until a specified number of NMI interrupts have passed (i.e. a specified number of VBlanks)
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * BRIS calls DELAY * BRIS_b0 calls DELAY * ChangeLetter calls DELAY * DOENTRY calls DELAY * eq calls DELAY * EQSHP calls DELAY * LAUN calls DELAY * Main game loop (Part 5 of 6) calls DELAY * PauseGame calls DELAY * SetupDemoUniverse calls DELAY * YESNO calls DELAY


Arguments: Y The number of NMI interrupts to wait for
.DELAY JSR WaitForNMI ; Wait until the next NMI interrupt has passed (i.e. the ; next VBlank) DEY ; Decrement the counter in Y BNE DELAY ; If Y isn't yet at zero, jump back to DELAY to wait ; for another NMI interrupt RTS ; Return from the subroutine