Prev: EB9E Up: Map Next: EBF5
EBCD: Input Handler: Sinclair
Input
HL Points to Data_Control
IX Points to this routine
Output
A The control byte
All the handlers match the outputs of the Kempston Joystick:
Byte Bits Action
01 00000001 Right
02 00000010 Left
04 00000100 Down
08 00001000 Up
10 00010000 Fire
InputHandler_Sinclair EBCD LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
EBCF IN A,($FE)
If "fire" has been pressed, add 10 to *HL.
EBD1 RRA Jump to Sinclair_CheckUp if "0" (fire) is not being pressed.
EBD2 JR C,Sinclair_CheckUp
EBD4 PUSH AF Stash the inputs on the stack.
EBD5 LD A,$10 Add 10 to *HL and write it back.
EBD7 ADD A,(HL)
EBD8 LD (HL),A
EBD9 POP AF Restore the inputs from the stack.
If "up" has been pressed, add 08 to *HL.
Sinclair_CheckUp EBDA RRA Jump to Sinclair_CheckDown if "9" (up) is not being pressed.
EBDB JR C,Sinclair_CheckDown
EBDD PUSH AF Stash the inputs on the stack.
EBDE LD A,$08 Add 08 to *HL and write it back.
EBE0 ADD A,(HL)
EBE1 LD (HL),A
EBE2 POP AF Restore the inputs from the stack.
If "down" has been pressed, add 04 to *HL.
Sinclair_CheckDown EBE3 RRA Jump to Sinclair_CheckRight if "8" (down) is not being pressed.
EBE4 JR C,Sinclair_CheckRight
EBE6 PUSH AF Stash the inputs on the stack.
EBE7 LD A,$04 Add 04 to *HL and write it back.
EBE9 ADD A,(HL)
EBEA LD (HL),A
EBEB POP AF Restore the inputs from the stack.
If "right" has been pressed, add 01 to *HL.
Sinclair_CheckRight EBEC RRA Jump to Sinclair_CheckLeft if "7" (right) is not being pressed.
EBED JR C,Sinclair_CheckLeft
EBEF INC (HL) Increment *HL by one.
If "left" has been pressed, add 02 to *HL.
Sinclair_CheckLeft EBF0 RRA Jump to InputHandler_Common if "6" (left) is not being pressed.
EBF1 JR C,InputHandler_Common
EBF3 INC (HL) Increment *HL by two.
EBF4 INC (HL)
Continue on to InputHandler_Common.
Prev: EB9E Up: Map Next: EBF5