Prev: 8039 Up: Map Next: 80C1
80A1: Menu 1: Scan keyboard input for control option selection
Used by the routine at 80FD.
Checks if the player has picked a control option on menu 1 (8039).
80A1 LD BC,$F7FE Port input address for keyboard keys 1,2,3,4 and 5
80A4 IN A,(C) Get input from port
80A6 OR %11100000 To maintain keyboard consistency, set bits 5-7 ready for the CP in the next instruction
80A8 CP %11111111 Are any keys currently being pressed?
80AA JR Z,$80B8 If not (value = 255), check if a key press has previously been registered
Key is being pressed - check if it's a valid option (1,2,3 or 4), and if so, jump to 80C1.
80AC LD B,$04 4 port addresses to check
80AE LD HL,$8BB2 Address pointer to where the port addresses are held
Loop through port addresses
80B1 CP (HL) Compare with keyboard input
80B2 JR Z,$80C1 If a valid key has been pressed, jump to 80C1 to play a sound and highlight the choice on screen
80B4 INC HL Otherwise advance to the next (2 byte) port address
80B5 INC HL
80B6 DJNZ $80B1 ...and keep checking until all 4 are done.
Check if a key press has been registered already
80B8 LD A,($8BAA) Has a menu option (1-4) been chosen yet?
80BB CP $00
80BD JR Z,$80A1 If not, go back to checking keys at 80A1
80BF JR $80FD If so, run the routine to see if ENTER is being pressed (to start the game)
Prev: 8039 Up: Map Next: 80C1