Prev: B479 Up: Map Next: B513
B4E0: Pause Game
Used by the routine at RunGame.
Pauses the game while CAPS SHIFT or SPACE is held down on its own. A click is made to say that the game has been paused, and the game then waits for the key to be released, pressed and released again before another click and returning.
Interrupts are enabled while the game is paused, and the system variable pointer in IY is set up to what the ROM interrupt routine expects.
Return unless CAPS SHIFT or SPACE is the only key being pressed.
PauseGame B4E0 LD A,$7E Read from the keyboard, with a call to ReadKeyboardPort that returns the pressed keys as set bits;
Port Number Bit
0 1 2 3 4
7E CAPS SHIFT or SPACE Z or SYMBOL SHIFT X or M C or N V or B
B4E2 CALL ReadKeyboardPort
B4E5 BIT 0,A Return if neither CAPS SHIFT nor SPACE is pressed.
B4E7 RET Z
B4E8 AND %00011110 Keep only the keys other than CAPS SHIFT and SPACE.
B4EA RET NZ Return if another key is pressed.
B4EB CALL PlayClick Call PlayClick to make a click.
Wait for the key to be released.
PauseGame_WaitRelease B4EE LD A,$7E Read the keyboard rows that hold CAPS SHIFT and SPACE.
B4F0 CALL ReadKeyboardPort
B4F3 BIT 0,A Jump to PauseGame_WaitRelease if CAPS SHIFT or SPACE is still pressed.
B4F5 JR NZ,PauseGame_WaitRelease
B4F7 LD IY,$5C3A Set up the system variables for the ROM interrupt routine.
B4FB EI Enable interrupts.
The game is paused: wait for the key to be pressed.
PauseGame_WaitPress B4FC LD A,$7E Read the keyboard rows that hold CAPS SHIFT and SPACE.
B4FE CALL ReadKeyboardPort
B501 BIT 0,A Jump to PauseGame_WaitPress if neither is pressed.
B503 JR Z,PauseGame_WaitPress
Wait for the key to be released again.
PauseGame_WaitResume B505 LD A,$7E Read the keyboard rows that hold CAPS SHIFT and SPACE.
B507 CALL ReadKeyboardPort
B50A BIT 0,A Jump to PauseGame_WaitResume if CAPS SHIFT or SPACE is still pressed.
B50C JR NZ,PauseGame_WaitResume
B50E DI Disable interrupts.
B50F CALL PlayClick Call PlayClick to make a click.
B512 RET Return.
Prev: B479 Up: Map Next: B513