Skip to navigation


Utility routines: DELAY

[Commodore 64 version]

Name: DELAY [Show more] Type: Subroutine Category: Utility routines Summary: Wait for a specified time, in either 1/50s of a second (on PAL systems) or 1/60s of a second (on NTSC systems)
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * BRIS calls DELAY * DKS3 calls DELAY * dn2 calls DELAY * DOENTRY calls DELAY * HYPNOISE calls DELAY * Main game loop (Part 5 of 6) calls DELAY * MT26 calls DELAY * TT217 calls DELAY

Wait for the number of vertical syncs given in Y, so this effectively waits for Y/50 of a second on PAL systems (as the PAL vertical sync occurs 50 times a second) or Y/60 of a second on NTSC systems (as the NTSC vertical sync occurs 60 times a second).
Arguments: Y The number of vertical sync events to wait for
.DELAY JSR WSCAN ; Call WSCAN to wait for the vertical sync, so the whole ; screen gets drawn DEY ; Decrement the counter in Y BNE DELAY ; If Y isn't yet at zero, jump back to DELAY to wait ; for another vertical sync RTS ; Return from the subroutine