Prev: F300 Up: Map Next: F345
F30A: Check all keys and return the first one found pressed
Used by the routine at F300.
Input
D Returns the key value, or FF if nothing pressed
F30A LD DE,$FF2F Start with no key pressed and checking key 2F.
F30D LD BC,$FEFE Start by checking SHIFT-V.
F310 IN A,(C) Read the keyboard.
F312 CPL Invert the bits so keys pressed have bits set.
F313 AND $1F Keep only bits 1-5 as the others aren't used.
F315 JR Z,$F323 Jump forward if no keys were pressed.
A key was pressed.
F317 INC D
F318 RET NZ
F319 LD H,A
F31A LD A,E
F31B SUB $08
F31D SRL H
F31F JR NC,$F31B
F321 RET NZ
F322 LD D,A
Scan another part of the keyboard.
F323 DEC E Move to the next key.
F324 RLC B Move to the next section of keyboard, so it cyles from FE - FD - FB - F7 - EF - DF - BF - 7F
F326 JR C,$F310 Loop round for another read if we didn't scan anything. This stops once port 7FFE is checked, as that the only one that doesn't carry when shifting left.
F328 CP A
F329 RET Z
Check that a particular key in A was pressed. This entry point is used by the routine at F271.
F32A LD C,A
F32B AND $07
F32D INC A
F32E LD B,A
F32F SRL C
F331 SRL C
F333 SRL C
F335 LD A,$05
F337 SUB C
F338 LD C,A
F339 LD A,$FE
F33B RRCA
F33C DJNZ $F33B
F33E IN A,($FE) Read the keyboard.
F340 RRA Put the bit in the carry flag.
F341 DEC C
F342 JR NZ,$F340
F344 RET
Prev: F300 Up: Map Next: F345