Prev: E289 Up: Map Next: E2DA
E2AE: Read Cursor Joystick
Used by the routine at ReadControls.
Reads the controls from a cursor joystick, which uses the keys 5 for left, 8 for right, 7 for up, 6 for down and 0 for fire.
Output
C The controls
Left from the 1-5 row.
ReadCursorJoystick E2AE LD C,$00 Start with none of the controls.
E2B0 LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
E2B2 CALL ReadKeyboardPort
E2B5 BIT 4,A Set the control for left if the key 5 is pressed.
E2B7 JR Z,ReadCursorJoystick_SecondRow
E2B9 SET 0,C
Fire, up, right and down from the 0-9 row.
ReadCursorJoystick_SecondRow E2BB LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
E2BD CALL ReadKeyboardPort
E2C0 BIT 0,A Set the control for fire if the key 0 is pressed.
E2C2 JR Z,ReadCursorJoystick_Forward
E2C4 SET 3,C
ReadCursorJoystick_Forward E2C6 BIT 3,A Set the control for forward if the key 7 is pressed.
E2C8 JR Z,ReadCursorJoystick_Right
E2CA SET 2,C
ReadCursorJoystick_Right E2CC BIT 2,A Set the control for right if the key 8 is pressed.
E2CE JR Z,ReadCursorJoystick_Down
E2D0 SET 1,C
Set the control for down if the key 6 is pressed, and jump to ReadViewKey to read the key for turning the view.
ReadCursorJoystick_Down E2D2 BIT 4,A Jump to ReadViewKey if bit 4 of A is clear.
E2D4 JR Z,ReadViewKey
E2D6 SET 4,C Set bit 4 of C.
E2D8 JR ReadViewKey Jump to ReadViewKey.
View the equivalent code in;
Prev: E289 Up: Map Next: E2DA