Prev: 60246 Up: Map Next: 60312
60260: Input Handler: Keyboard
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_Keyboard 60260 LD A,223 Read from the keyboard;
Port Number Bit
0 1 2 3 4
223 P O I U Y
60262 IN A,(254)
If "right" has been pressed, add 1 to *HL.
60264 RRA Jump to Keyboard_CheckLeft if "P" (right) is not being pressed.
60265 JR C,Keyboard_CheckLeft
60267 INC (HL) Increment *HL by one.
If "left" has been pressed, add 2 to *HL.
Keyboard_CheckLeft 60268 RRA Jump to Keyboard_CheckUp if "O" (left) is not being pressed.
60269 JR C,Keyboard_CheckUp
60271 INC (HL) Increment *HL by two.
60272 INC (HL)
Keyboard_CheckUp 60273 LD A,251 Read from the keyboard;
Port Number Bit
0 1 2 3 4
251 Q W E R T
60275 IN A,(254)
60277 RRA Jump to Keyboard_CheckDown if "Q" (up) is not being pressed.
60278 JR C,Keyboard_CheckDown
60280 LD A,8 Add 8 to *HL and write it back.
60282 ADD A,(HL)
60283 LD (HL),A
If "down" has been pressed, add 4 to *HL.
Keyboard_CheckDown 60284 LD A,253 Read from the keyboard;
Port Number Bit
0 1 2 3 4
253 A S D F G
60286 IN A,(254)
60288 RRA Jump to Keyboard_CheckFire if "A" (down) is not being pressed.
60289 JR C,Keyboard_CheckFire
60291 LD A,4 Add 4 to *HL and write it back.
60293 ADD A,(HL)
60294 LD (HL),A
If "fire" has been pressed, add 16 to *HL.
Note; ALL these keys are fire button keys.
Keyboard_CheckFire 60295 LD A,126 Read from the keyboard;
Port Number Bit
0 1 2 3 4
126 SPACE FULL-STOP M N B
Shift Z X C V
60297 IN A,(254)
60299 CPL Invert the bits in A.
60300 AND %00011111 Keep only the key bits 0-4.
60302 JP Z,InputHandler_Common Jump to InputHandler_Common if none of the fire keys are being pressed.
60305 LD A,16 Add 16 to *HL and write it back.
60307 ADD A,(HL)
60308 LD (HL),A
60309 JP InputHandler_Common Jump to InputHandler_Common.
Prev: 60246 Up: Map Next: 60312