Prev: 32961 Up: Map Next: 33051
33021: Menu 1: Check if ENTER pressed to confirm player controls
This follows the previous routine at 32961, or a jump from 32959, after the player has made a choice of controls on the first game menu.
Pressing ENTER confirms the controls choice, and launches the second game menu. Once the choice of controls has been made, the player can't change it without reloading the game.
33021 LD BC,49150 Keyboard port for keys H, J, K, L, Enter
33024 IN A,(C) Read the port input
33026 OR %11111110 We're only interested in bit 0, but set bits 1-7 for the CP in the next instruction
33028 CP %11111111 Check if ENTER is being pressed (bit 0 will be reset if so)
33030 JR Z,32929 If ENTER isn't being pressed, return to checking keys for other menu options
ENTER has been pressed, player controls choice confirmed.
33032 CALL 33115 Clear the screen (pixels)
ENTER is still being pressed - wait until the key has been released
33035 LD BC,49150 Keyboard port for keys H, J, K, L, Enter
33038 IN A,(C) Read the port input
33040 OR %11111110 We're only interested in bit 0, but set bits 1-7 for the CP in the next instruction
33042 CP %11111111 Check if ENTER is still being pressed
33044 JR NZ,33035 If so, keep checking until it's been released
ENTER has now been released
33046 LD A,15 Set the screen attributes to INK 7, PAPER 1
33048 CALL 33130 ...and reset screen colours with this colour (mainly to clear the flashing colour marking the player's control selection)
Prev: 32961 Up: Map Next: 33051