Prev: F670 Up: Map Next: F6D8
F6C3: Read Control Input
Used by the routine at Main_Game_Loop.
Reads the active control input for the current control mode stored in *C4FF. Scales the mode index to a word offset, loads the handler address from the table at Control_Handler_Table, pushes Read_Control_Input_Return as the return address, and jumps to the handler. Each handler reads one or more hardware ports and returns the direction and fire bits in A. The common landing pad at Read_Control_Input_Return masks the result to five bits and stores it in B and C.
Output
A Active-low direction and fire bits in the lower five bits
B Copy of A; the F7FE row result in split keyboard mode
C Copy of A; the EFFE row result in split keyboard mode
Read_Control_Input F6C3 LD HL,$F6DD Point to the handler table at Control_Handler_Table and zero D.
F6C6 LD D,$00
F6C8 LD A,($C4FF) Scale *C4FF to a zero-based word table offset in E.
F6CB DEC A
F6CC ADD A,A
F6CD LD E,A
F6CE ADD HL,DE Load the handler address from the table.
F6CF LD E,(HL)
F6D0 INC HL
F6D1 LD D,(HL)
F6D2 EX DE,HL
F6D3 LD DE,$F6D8 Push the return address.
F6D6 PUSH DE
F6D7 JP (HL) Dispatch to the control handler.
Prev: F670 Up: Map Next: F6D8