Prev: 53584 Up: Map Next: 53694
53628: 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, up 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.
Output
C The controls
Read left and right from CAPS SHIFT to V.
ReadKeyboard 53628 LD A,254 Read from the keyboard;
Port Number Bit
0 1 2 3 4
254 CAPS SHIFT Z X C V
53630 CALL ReadKeyboardPort
53633 RRCA Move X to bit 0 and C to bit 1.
53634 RRCA
53635 BIT 2,A Set bit 0 if V is pressed.
53637 JR Z,ReadKeyboard_Movement
53639 SET 0,A
Keep left and right, and read SPACE to B.
ReadKeyboard_Movement 53641 AND %00000011 Keep bits 0 and 1.
53643 LD C,A Put them in C.
53644 LD A,127 Read from the keyboard;
Port Number Bit
0 1 2 3 4
127 SPACE SYMBOL SHIFT M N B
53646 CALL ReadKeyboardPort
53649 BIT 2,A Set bit 0 if M is pressed.
53651 JR Z,ReadKeyboard_TestN
53653 SET 0,C
Set bit 1 if N is pressed.
ReadKeyboard_TestN 53655 BIT 3,A Set bit 1 if N is pressed.
53657 JR Z,ReadKeyboard_TestB
53659 SET 1,C
Set bit 0 if B is pressed.
ReadKeyboard_TestB 53661 BIT 4,A Set bit 0 if B is pressed.
53663 JR Z,ReadKeyboard_MiddleRows
53665 SET 0,C
Set bit 2 if any key from A to G or H to ENTER is pressed.
ReadKeyboard_MiddleRows 53667 LD A,189 Read from the keyboard;
Port Number Bit
0 1 2 3 4
189 A or H S or J D or K F or L G or ENTER
53669 CALL ReadKeyboardPort
53672 JR Z,ReadKeyboard_TopRows Set bit 2 if any key is pressed.
53674 SET 2,C
Set bit 3 if any key from Q to T or Y to P is pressed.
ReadKeyboard_TopRows 53676 LD A,219 Read from the keyboard;
Port Number Bit
0 1 2 3 4
219 Q or Y W or U E or I R or O T or P
53678 CALL ReadKeyboardPort
53681 JR Z,ReadKeyboard_NumberRows Set bit 3 if any key is pressed.
53683 SET 3,C
Set bit 4 if any key from 1 to 5 or 6 to 0 is pressed.
ReadKeyboard_NumberRows 53685 LD A,231 Read from the keyboard;
Port Number Bit
0 1 2 3 4
231 1 or 6 2 or 7 3 or 8 4 or 9 5 or 0
53687 CALL ReadKeyboardPort
53690 JR Z,ReadControls_Rotate Set bit 4 if any key is pressed.
53692 SET 4,C
Continue on to ReadControls_Rotate.
View the equivalent code in;
Prev: 53584 Up: Map Next: 53694