Prev: 38366 Up: Map Next: 38409
38387: Wait For Key
Used by the routines at Show_Game_Over and Show_Ending_Screen.
Waits until key 0 is pressed. It gives up after 12 times 65536 passes round the inner loop if no key is pressed.
Wait_For_Key 38387 LD B,12 Set the outer counter to 12.
38389 LD HL,0 Set the inner counter to 0 which makes 65536 passes round the inner loop.
Wait_For_Key_Inner_Loop 38392 DEC HL Decrease the inner counter.
38393 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
38395 OUT (253),A
38397 IN A,(254)
38399 AND %00000001 Keep only the bit for key 0.
38401 RET Z Return if key 0 is pressed.
38402 LD A,H Jump back to Wait_For_Key_Inner_Loop until the inner counter is zero.
38403 OR L
38404 JR NZ,Wait_For_Key_Inner_Loop
38406 DJNZ Wait_For_Key_Inner_Loop Decrease the outer counter and loop back until it is zero.
38408 RET Return.
Prev: 38366 Up: Map Next: 38409