Prev: CE1C Up: Map Next: CE4E
CE22: Pause, when SPACE is pressed on its own
Used by the routine at OBJECT_DONE.
Called once a turn by the main loop (OBJECT_DONE). READ_KEYS is given $7E, which selects two half-rows at once -- SPACE to B, and CAPS SHIFT to V -- read with a key pressed as a set bit; SPACE and CAPS SHIFT share bit 0, so either on its own pauses. A beep (PAUSE_BEEP), a wait for the key to be let go, then for a press and a release, and a beep again.
The pause is a busy wait with interrupts off: the game has no EI anywhere, so nothing runs while it waits. Pentagram's pause turns interrupts on while it waits; Knight Lore's and this one do not.
HANDLE_PAUSE CE22 LD A,$7E SPACE not pressed: no pause
CE24 CALL READ_KEYS
CE27 BIT 0,A
CE29 RET Z
CE2A AND $1E Another key of the half-row with it: no pause
CE2C RET NZ
HANDLE_PAUSE_0 CE2D LD A,$7E Wait for it to be let go
CE2F CALL READ_KEYS
CE32 BIT 0,A
CE34 JR NZ,HANDLE_PAUSE_0
CE36 CALL PAUSE_BEEP A beep
HANDLE_PAUSE_1 CE39 LD A,$7E Wait for a press
CE3B CALL READ_KEYS
CE3E BIT 0,A
CE40 JR Z,HANDLE_PAUSE_1
HANDLE_PAUSE_2 CE42 LD A,$7E And for it to be let go
CE44 CALL READ_KEYS
CE47 BIT 0,A
CE49 JR NZ,HANDLE_PAUSE_2
CE4B JP PAUSE_BEEP A beep, and back to the game
Prev: CE1C Up: Map Next: CE4E