Prev: B881 Up: Map Next: B8A9
B899: Wait For Key Press
Used by the routines at GameOver and GameCompleted.
Waits until a key is pressed or a time has passed. The time is B counts of HL from 0000 back to 0000.
Input
B Length of the wait
Count down, reading the keyboard each time.
WaitForKeyPress B899 LD HL,$0000 Set HL to 0000.
WaitForKeyPress_Wait B89C XOR A Select all of the keyboard rows.
B89D CALL ReadKeyboardPort Call ReadKeyboardPort.
B8A0 RET NZ Return if a key is pressed.
B8A1 DEC HL Count down.
B8A2 LD A,H Jump to WaitForKeyPress_Wait if HL is not zero.
B8A3 OR L
B8A4 JR NZ,WaitForKeyPress_Wait
B8A6 DJNZ WaitForKeyPress_Wait Jump to WaitForKeyPress_Wait.
B8A8 RET Return.
View the equivalent code in;
Prev: B881 Up: Map Next: B8A9