Prev: 47650 Up: Map Next: 47787
47771: Wait For Key Press
Used by the routines at GameOver and GameCompleted.
Waits until any key is pressed or until a time limit passes. The time is B times the time that it takes to count 65535 down to zero.
Input
B Number of times to count down
Output
F Zero flag clear if a key was pressed
Wait for a key, or count down 65536 times.
WaitForKeyPress 47771 LD HL,0 Set the counter to zero, to count 65536 times.
WaitForKeyPress_Wait 47774 XOR A Select all the half-rows of the keyboard.
47775 CALL ReadKeyboardPort Read the keyboard.
47778 RET NZ Return if a key is pressed.
47779 DEC HL Decrease the counter.
47780 LD A,H Check whether the counter has reached zero.
47781 OR L
47782 JR NZ,WaitForKeyPress_Wait Jump to WaitForKeyPress_Wait until the counter is zero.
47784 DJNZ WaitForKeyPress_Wait Jump to WaitForKeyPress_Wait until the time limit has passed.
47786 RET Return.
View the equivalent code in;
Prev: 47650 Up: Map Next: 47787