Prev: B47D Up: Map Next: B513
B4E0: Pause, when SPACE or CAPS SHIFT is pressed on its own
Used by the routine at OBJECT_DONE.
Called once a turn by the main loop (OBJECT_DONE). Half-rows $7F and $FE are read together, so bit 0 is SPACE or CAPS SHIFT and bits 1-4 are the other eight keys of the two rows; the pause needs bit 0 and none of the others, so no key that plays the game can start one. The game beeps (PAUSE_BEEP), waits for the key to be let go, then for a press and a release, and beeps again.
While it waits, interrupts are on: IY is set to the ROM's system variables and EI lets the ROM's frame interrupt run, the only place the game allows it. DI turns them off again before the game goes on. IY is left pointing at the system variables; nothing that follows expects it to hold anything else.
PAUSE B4E0 LD A,$7E not SPACE or CAPS SHIFT: no pause
B4E2 CALL READ_KEYS
B4E5 BIT 0,A
B4E7 RET Z
B4E8 AND $1E another key with it: no pause
B4EA RET NZ
B4EB CALL PAUSE_BEEP a beep
PAUSE_0 B4EE LD A,$7E wait for it to be let go
B4F0 CALL READ_KEYS
B4F3 BIT 0,A
B4F5 JR NZ,PAUSE_0
B4F7 LD IY,$5C3A the ROM's interrupt routine may run while the game waits
B4FB EI
PAUSE_1 B4FC LD A,$7E wait for a press
B4FE CALL READ_KEYS
B501 BIT 0,A
B503 JR Z,PAUSE_1
PAUSE_2 B505 LD A,$7E and for it to be let go
B507 CALL READ_KEYS
B50A BIT 0,A
B50C JR NZ,PAUSE_2
B50E DI interrupts off again; a beep
B50F CALL PAUSE_BEEP
B512 RET
Prev: B47D Up: Map Next: B513