Prev: E2AE Up: Map Next: E31C
E2DA: 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 E2DA LD A,$FE Read from the keyboard;
Port Number Bit
0 1 2 3 4
FE CAPS SHIFT Z X C V
E2DC CALL ReadKeyboardPort
E2DF RRCA Move the keys X and C into bits 0 and 1, for left and right.
E2E0 RRCA
E2E1 BIT 2,A Set the control for left as well if the key V is pressed.
E2E3 JR Z,ReadKeyboard_Right
E2E5 SET 0,A
Keep left and right, and read SPACE to B.
ReadKeyboard_Right E2E7 AND %00000011 Keep bits 0 and 1.
E2E9 LD C,A Put them in C.
E2EA LD A,$7F Read from the keyboard;
Port Number Bit
0 1 2 3 4
7F SPACE SYMBOL SHIFT M N B
E2EC CALL ReadKeyboardPort
E2EF BIT 2,A Set the control for left if the key M is pressed.
E2F1 JR Z,ReadKeyboard_KeyN
E2F3 SET 0,C
Set the control for right if N is pressed.
ReadKeyboard_KeyN E2F5 BIT 3,A Set the control for right if the key N is pressed.
E2F7 JR Z,ReadKeyboard_KeyB
E2F9 SET 1,C
Set the control for left if B is pressed.
ReadKeyboard_KeyB E2FB BIT 4,A Set the control for left if the key B is pressed.
E2FD JR Z,ReadKeyboard_Forward
E2FF SET 0,C
Set the control for forward if any key from A to G or H to ENTER is pressed.
ReadKeyboard_Forward E301 LD A,$BD Read from the keyboard;
Port Number Bit
0 1 2 3 4
BD A / ENTER S / L D / K F / J G / H
E303 CALL ReadKeyboardPort
E306 JR Z,ReadKeyboard_Fire Set the control for forward if any of them are pressed.
E308 SET 2,C
Set the control for fire if any key from Q to T or Y to P is pressed.
ReadKeyboard_Fire E30A LD A,$DB Read from the keyboard;
Port Number Bit
0 1 2 3 4
DB Q / P W / O E / I R / U T / Y
E30C CALL ReadKeyboardPort
E30F JR Z,ReadKeyboard_Down Set the control for fire if any of them are pressed.
E311 SET 3,C
Set the control for down if any key from 1 to 5 or 6 to 0 is pressed.
ReadKeyboard_Down E313 LD A,$E7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
E7 1 / 0 2 / 9 3 / 8 4 / 7 5 / 6
E315 CALL ReadKeyboardPort
E318 JR Z,ReadViewKey Set the control for down if any of them are pressed.
E31A SET 4,C
Prev: E2AE Up: Map Next: E31C