Prev: 60318 Up: Map Next: 60405
60365: 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
1 00000001 Right
2 00000010 Left
4 00000100 Down
8 00001000 Up
16 00010000 Fire
InputHandler_Sinclair 60365 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
60367 IN A,(254)
If "fire" has been pressed, add 16 to *HL.
60369 RRA Jump to Sinclair_CheckUp if "0" (fire) is not being pressed.
60370 JR C,Sinclair_CheckUp
60372 PUSH AF Stash the inputs on the stack.
60373 LD A,16 Add 16 to *HL and write it back.
60375 ADD A,(HL)
60376 LD (HL),A
60377 POP AF Restore the inputs from the stack.
If "up" has been pressed, add 8 to *HL.
Sinclair_CheckUp 60378 RRA Jump to Sinclair_CheckDown if "9" (up) is not being pressed.
60379 JR C,Sinclair_CheckDown
60381 PUSH AF Stash the inputs on the stack.
60382 LD A,8 Add 8 to *HL and write it back.
60384 ADD A,(HL)
60385 LD (HL),A
60386 POP AF Restore the inputs from the stack.
If "down" has been pressed, add 4 to *HL.
Sinclair_CheckDown 60387 RRA Jump to Sinclair_CheckRight if "8" (down) is not being pressed.
60388 JR C,Sinclair_CheckRight
60390 PUSH AF Stash the inputs on the stack.
60391 LD A,4 Add 4 to *HL and write it back.
60393 ADD A,(HL)
60394 LD (HL),A
60395 POP AF Restore the inputs from the stack.
If "right" has been pressed, add 1 to *HL.
Sinclair_CheckRight 60396 RRA Jump to Sinclair_CheckLeft if "7" (right) is not being pressed.
60397 JR C,Sinclair_CheckLeft
60399 INC (HL) Increment *HL by one.
If "left" has been pressed, add 2 to *HL.
Sinclair_CheckLeft 60400 RRA Jump to InputHandler_Common if "6" (left) is not being pressed.
60401 JR C,InputHandler_Common
60403 INC (HL) Increment *HL by two.
60404 INC (HL)
Continue on to InputHandler_Common.
Prev: 60318 Up: Map Next: 60405