Prev: 57993 Up: Map Next: 58074
58030: 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 58030 LD C,0 Start with none of the controls.
58032 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
58034 CALL ReadKeyboardPort
58037 BIT 4,A Set the control for left if the key 5 is pressed.
58039 JR Z,ReadCursorJoystick_SecondRow
58041 SET 0,C
Fire, up, right and down from the 0-9 row.
ReadCursorJoystick_SecondRow 58043 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
58045 CALL ReadKeyboardPort
58048 BIT 0,A Set the control for fire if the key 0 is pressed.
58050 JR Z,ReadCursorJoystick_Forward
58052 SET 3,C
ReadCursorJoystick_Forward 58054 BIT 3,A Set the control for forward if the key 7 is pressed.
58056 JR Z,ReadCursorJoystick_Right
58058 SET 2,C
ReadCursorJoystick_Right 58060 BIT 2,A Set the control for right if the key 8 is pressed.
58062 JR Z,ReadCursorJoystick_Down
58064 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 58066 BIT 4,A Jump to ReadViewKey if bit 4 of A is clear.
58068 JR Z,ReadViewKey
58070 SET 4,C Set bit 4 of C.
58072 JR ReadViewKey Jump to ReadViewKey.
View the equivalent code in;
Prev: 57993 Up: Map Next: 58074