Skip to navigation


Utility routines: DELAY

[Apple II version]

Name: DELAY [Show more] Type: Subroutine Category: Utility routines Summary: Wait for a specified time, measured in loop iterations
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 * Main game loop (Part 5 of 6) calls DELAY * MT26 calls DELAY * TT217 calls DELAY

This routine uses the WSCAN routine to implement a pause. In the released version of Apple II Elite, WSCAN waits for 15 * 256 iterations of an empty loop, so the DELAY routine waits for a specified number of loop iterations. The variant on the source disk from Ian Bell's site implements WSCAN by waiting for the vertical sync (like the BBC Micro and Commodore 64 versions), so this behaviour was presumably changed at some stage during development.
Arguments: Y The number of vertical sync events to wait for
.DELAY JSR WSCAN ; Call WSCAN to wait for 15 * 256 loop iterations DEY ; Decrement the counter in Y BNE DELAY ; If Y isn't yet at zero, jump back to DELAY to wait ; for another iteration of the delay loop RTS ; Return from the subroutine