Prev: 44068 Up: Map Next: 44139
44072: Pause Game
Used by the routines at UpdateCounters, GameComplete and HandlerPoems.
Pauses the game if SPACE (or CAPS SHIFT) is being pressed on its own. While the game is paused the border flashes. Pressing SPACE (or CAPS SHIFT) again carries on with the game, and the border is set back to black.
PauseGame 44072 EI Enable interrupts.
44073 LD A,126 Read from the keyboard (126 is also written to port 253);
Port Number Bit
0 1 2 3 4
126 SPACE FULL-STOP M N B
Shift Z X C V
44075 OUT (253),A
44077 IN A,(254)
44079 BIT 0,A Return if neither SPACE nor CAPS SHIFT is being pressed.
44081 RET NZ
44082 CPL Flip the bits so that the keys being pressed are set.
44083 AND %00011110 Keep only the other keys on this row (bits 1-4).
44085 RET NZ Return if any other key is being pressed.
Wait for the key to be released.
PauseGame_Release 44086 LD A,126 Read from the keyboard (126 is also written to port 253);
Port Number Bit
0 1 2 3 4
126 SPACE FULL-STOP M N B
Shift Z X C V
44088 OUT (253),A
44090 IN A,(254)
44092 BIT 0,A Jump back to PauseGame_Release until SPACE and CAPS SHIFT have been released.
44094 JR Z,PauseGame_Release
Flash the border every frame until the key is pressed again.
PauseGame_Loop 44096 LD HL,23672 Point HL at FRAMES.
44099 LD A,(HL) Fetch the frame counter.
PauseGame_Frame 44100 CP (HL) Jump back to PauseGame_Frame until the frame counter changes.
44101 JR Z,PauseGame_Frame
44103 LD A,D Fetch the border flash counter from D.
44104 ADD A,4 Add 4 to the border flash counter.
44106 LD D,A Store the border flash counter in D.
44107 RLCA Rotate left twice, so bit 7 is now in bit 1.
44108 RLCA
44109 AND %00000010 Keep only bit 1.
44111 OR %00000001 Set bit 0, so the border alternates between blue and magenta.
44113 OUT (254),A Set the border colour.
44115 LD A,126 Read from the keyboard (126 is also written to port 253);
Port Number Bit
0 1 2 3 4
126 SPACE FULL-STOP M N B
Shift Z X C V
44117 OUT (253),A
44119 IN A,(254)
44121 BIT 0,A Jump back to PauseGame_Loop until SPACE or CAPS SHIFT is pressed to unpause.
44123 JR NZ,PauseGame_Loop
Wait for the key to be released again.
PauseGame_Release_Again 44125 LD A,126 Read from the keyboard (126 is also written to port 253);
Port Number Bit
0 1 2 3 4
126 SPACE FULL-STOP M N B
Shift Z X C V
44127 OUT (253),A
44129 IN A,(254)
44131 BIT 0,A Jump back to PauseGame_Release_Again until SPACE and CAPS SHIFT have been released.
44133 JR Z,PauseGame_Release_Again
44135 XOR A Select black for the border.
44136 OUT (254),A Set the border colour.
44138 RET Return.
Prev: 44068 Up: Map Next: 44139