Prev: EB56 Up: Map Next: EB98
EB64: 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
01 00000001 Right
02 00000010 Left
04 00000100 Down
08 00001000 Up
10 00010000 Fire
InputHandler_Keyboard EB64 LD A,$DF Read from the keyboard;
Port Number Bit
0 1 2 3 4
DF P O I U Y
EB66 IN A,($FE)
If "right" has been pressed, add 01 to *HL.
EB68 RRA Jump to Keyboard_CheckLeft if "P" (right) is not being pressed.
EB69 JR C,Keyboard_CheckLeft
EB6B INC (HL) Increment *HL by one.
If "left" has been pressed, add 02 to *HL.
Keyboard_CheckLeft EB6C RRA Jump to Keyboard_CheckUp if "O" (left) is not being pressed.
EB6D JR C,Keyboard_CheckUp
EB6F INC (HL) Increment *HL by two.
EB70 INC (HL)
Keyboard_CheckUp EB71 LD A,$FB Read from the keyboard;
Port Number Bit
0 1 2 3 4
FB Q W E R T
EB73 IN A,($FE)
EB75 RRA Jump to Keyboard_CheckDown if "Q" (up) is not being pressed.
EB76 JR C,Keyboard_CheckDown
EB78 LD A,$08 Add 08 to *HL and write it back.
EB7A ADD A,(HL)
EB7B LD (HL),A
If "down" has been pressed, add 04 to *HL.
Keyboard_CheckDown EB7C LD A,$FD Read from the keyboard;
Port Number Bit
0 1 2 3 4
FD A S D F G
EB7E IN A,($FE)
EB80 RRA Jump to Keyboard_CheckFire if "A" (down) is not being pressed.
EB81 JR C,Keyboard_CheckFire
EB83 LD A,$04 Add 04 to *HL and write it back.
EB85 ADD A,(HL)
EB86 LD (HL),A
If "fire" has been pressed, add 10 to *HL.
Note; ALL these keys are fire button keys.
Keyboard_CheckFire EB87 LD A,$7E Read from the keyboard;
Port Number Bit
0 1 2 3 4
7E SPACE FULL-STOP M N B
Shift Z X C V
EB89 IN A,($FE)
EB8B CPL Invert the bits in A.
EB8C AND %00011111 Keep only the key bits 0-4.
EB8E JP Z,InputHandler_Common Jump to InputHandler_Common if none of the fire keys are being pressed.
EB91 LD A,$10 Add 10 to *HL and write it back.
EB93 ADD A,(HL)
EB94 LD (HL),A
EB95 JP InputHandler_Common Jump to InputHandler_Common.
Prev: EB56 Up: Map Next: EB98