Prev: 9FB4 Up: Map Next: A139
A0CC: Keyscan
kempston_flag A0CC DEFB $00 Set to 1 if Kempston joystick is chosen, 0 otherwise
keydefs_probably A0CD DEFB $25,$22,$20,$23,$1B,$13,$03,$0B must be keydefs
user_input A0D5 DEFB $00 User input: QPBFUDLR - Quit Pause Boost Fire Up Down Left Right. Note that attract mode is driven through this var.
This entry point is used by the routines at load_stage, attract_mode, main_loop, run_pregame_screen, check_user_input and page_in_stage_128k.
keyscan A0D6 LD A,($A0CC) If not Kempston then goto ks_keyboard
A0D9 AND A
A0DA JR Z,ks_keyboard
A0DC IN A,($1F) Read Kempston joystick port. Returns 000FUDLR active high
A0DE AND $1F
A0E0 PUSH AF
A0E1 LD E,$20
A0E3 LD HL,$A0CD
A0E6 CALL kempston_flag_2
A0E9 RRCA
A0EA RRCA
A0EB RRCA
A0EC AND $E0
A0EE POP DE
A0EF OR D
A0F0 LD E,A
A0F1 JR ks_common
ks_keyboard A0F3 LD E,$01
A0F5 LD HL,$A0CD
A0F8 CALL kempston_flag_2
ks_common A0FB AND $03
A0FD CP $03
A0FF LD A,E
A100 JR NZ,kempston_flag_0
A102 AND $FC
A104 LD E,A
kempston_flag_0 A105 AND $0C
A107 CP $0C
A109 LD A,E
A10A JR NZ,kempston_flag_1
A10C AND $F3
kempston_flag_1 A10E LD ($A0D5),A
A111 RET Return
kempston_flag_2 A112 LD A,(HL) Outer keyboard loop
A113 INC HL
A114 CALL keyscan_inner
A117 CCF invert carry
A118 RL E
A11A JR NC,kempston_flag_2 loop while top bit set?
A11C LD A,E
A11D RET Return
keyscan_inner A11E LD C,A Inner keyboard loop.... what's in A?
A11F AND $07 B=(A&7)+1, C=5-(A>>3)
A121 INC A
A122 LD B,A
A123 SRL C
A125 SRL C
A127 SRL C
A129 LD A,$05
A12B SUB C
A12C LD C,A
A12D LD A,$FE A = $FE ROR B
kempston_flag_3 A12F RRCA
A130 DJNZ kempston_flag_3
A132 IN A,($FE) Port $FE is the AND of all columns/rows? This is the main keyboard access
kempston_flag_4 A134 RRA C = A ROR C
A135 DEC C
A136 JR NZ,kempston_flag_4
A138 RET Return
Prev: 9FB4 Up: Map Next: A139