Prev: 58030 Up: Map Next: 58140
58074: Read Keyboard
Used by the routine at ReadControls.
Reads the controls from the keyboard. Left is X, V, M or B, right is C or N, forward is any key from A to G or from H to ENTER, fire is any key from Q to T or from Y to P, and down is any key from 1 to 5 or from 6 to 0.
Read left and right from CAPS SHIFT to V.
ReadKeyboard 58074 LD A,254 Read from the keyboard;
Port Number Bit
0 1 2 3 4
254 CAPS SHIFT Z X C V
58076 CALL ReadKeyboardPort
58079 RRCA Move the keys X and C into bits 0 and 1, for left and right.
58080 RRCA
58081 BIT 2,A Set the control for left as well if the key V is pressed.
58083 JR Z,ReadKeyboard_Right
58085 SET 0,A
Keep left and right, and read SPACE to B.
ReadKeyboard_Right 58087 AND %00000011 Keep bits 0 and 1.
58089 LD C,A Put them in C.
58090 LD A,127 Read from the keyboard;
Port Number Bit
0 1 2 3 4
127 SPACE SYMBOL SHIFT M N B
58092 CALL ReadKeyboardPort
58095 BIT 2,A Set the control for left if the key M is pressed.
58097 JR Z,ReadKeyboard_KeyN
58099 SET 0,C
Set the control for right if N is pressed.
ReadKeyboard_KeyN 58101 BIT 3,A Set the control for right if the key N is pressed.
58103 JR Z,ReadKeyboard_KeyB
58105 SET 1,C
Set the control for left if B is pressed.
ReadKeyboard_KeyB 58107 BIT 4,A Set the control for left if the key B is pressed.
58109 JR Z,ReadKeyboard_Forward
58111 SET 0,C
Set the control for forward if any key from A to G or H to ENTER is pressed.
ReadKeyboard_Forward 58113 LD A,189 Read from the keyboard;
Port Number Bit
0 1 2 3 4
189 A / ENTER S / L D / K F / J G / H
58115 CALL ReadKeyboardPort
58118 JR Z,ReadKeyboard_Fire Set the control for forward if any of them are pressed.
58120 SET 2,C
Set the control for fire if any key from Q to T or Y to P is pressed.
ReadKeyboard_Fire 58122 LD A,219 Read from the keyboard;
Port Number Bit
0 1 2 3 4
219 Q / P W / O E / I R / U T / Y
58124 CALL ReadKeyboardPort
58127 JR Z,ReadKeyboard_Down Set the control for fire if any of them are pressed.
58129 SET 3,C
Set the control for down if any key from 1 to 5 or 6 to 0 is pressed.
ReadKeyboard_Down 58131 LD A,231 Read from the keyboard;
Port Number Bit
0 1 2 3 4
231 1 / 0 2 / 9 3 / 8 4 / 7 5 / 6
58133 CALL ReadKeyboardPort
58136 JR Z,ReadViewKey Set the control for down if any of them are pressed.
58138 SET 4,C
Prev: 58030 Up: Map Next: 58140