Prev: 26995 Up: Map Next: 27046
27013: Scan Menu Keys
Used by the routines at Read_Menu_Key and Highlight_Menu_Item.
Returns 0-3 for keys "0"-"3", 2 for Kempston fire, or 255 if nothing is pressed.
Output
A Menu option, or 255 if no key is pressed
Scan_Menu_Keys 27013 LD BC,61438 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
27016 IN A,(C)
27018 OR %11100000 Set bits 5-7.
27020 ADD A,2 Add 2 to the key bits.
27022 RET Z Return if "0" is pressed.
27023 RR B Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
27025 IN A,(C)
27027 LD C,A Store the key bits in C.
27028 LD B,3 Set the key counter to 3 in B.
27030 XOR A Set the option index to 0.
Count which of keys "1"-"3" is pressed.
Scan_Menu_Keys_0 27031 INC A Increment the option index by one.
27032 RR C Return if this key is pressed.
27034 RET NC
27035 DJNZ Scan_Menu_Keys_0 Decrease the key counter by one and loop back to Scan_Menu_Keys_0 until all three keys have been tested.
27037 CALL Read_Kempston Call Read_Kempston.
27040 LD A,255 Set the result to 255.
27042 RET NC Return if fire was not pressed.
27043 LD A,2 Set the result to 2.
27045 RET Return.
Prev: 26995 Up: Map Next: 27046