Prev: 80C1 Up: Map Next: 811B
80FD: Menu 1: Check if ENTER pressed to confirm player controls
This follows the previous routine at 80C1, or a jump from 80BF, 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.
80FD LD BC,$BFFE Keyboard port for keys H, J, K, L, Enter
8100 IN A,(C) Read the port input
8102 OR %11111110 We're only interested in bit 0, but set bits 1-7 for the CP in the next instruction
8104 CP %11111111 Check if ENTER is being pressed (bit 0 will be reset if so)
8106 JR Z,$80A1 If ENTER isn't being pressed, return to checking keys for other menu options
ENTER has been pressed, player controls choice confirmed.
8108 CALL $815B Clear the screen (pixels)
ENTER is still being pressed - wait until the key has been released
810B LD BC,$BFFE Keyboard port for keys H, J, K, L, Enter
810E IN A,(C) Read the port input
8110 OR %11111110 We're only interested in bit 0, but set bits 1-7 for the CP in the next instruction
8112 CP %11111111 Check if ENTER is still being pressed
8114 JR NZ,$810B If so, keep checking until it's been released
ENTER has now been released
8116 LD A,$0F Set the screen attributes to INK 7, PAPER 1
8118 CALL $816A ...and reset screen colours with this colour (mainly to clear the flashing colour marking the player's control selection)
Prev: 80C1 Up: Map Next: 811B