Prev: 53547 Up: Map Next: 53628
53584: Read Cursor Joystick
Used by the routine at ReadControls.
Reads a cursor joystick. 5 is left, 8 is right, 7 is up, 6 is down and 0 is fire.
Output
C The controls
Start with no controls, and read 5 for left.
ReadCursorJoystick 53584 LD C,0 Clear the controls.
53586 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
53588 CALL ReadKeyboardPort
53591 BIT 4,A Set bit 0 if 5 is pressed.
53593 JR Z,ReadCursorJoystick_SecondRow
53595 SET 0,C
Read 0, 7, 8 and 6.
ReadCursorJoystick_SecondRow 53597 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
53599 CALL ReadKeyboardPort
53602 BIT 0,A Set bit 3 if 0 is pressed.
53604 JR Z,ReadCursorJoystick_TestUp
53606 SET 3,C
Set bit 2 if 7 is pressed.
ReadCursorJoystick_TestUp 53608 BIT 3,A Set bit 2 if 7 is pressed.
53610 JR Z,ReadCursorJoystick_TestRight
53612 SET 2,C
Set bit 1 if 8 is pressed.
ReadCursorJoystick_TestRight 53614 BIT 2,A Set bit 1 if 8 is pressed.
53616 JR Z,ReadCursorJoystick_TestDown
53618 SET 1,C
Set bit 4 if 6 is pressed, and jump to ReadControls_Rotate.
ReadCursorJoystick_TestDown 53620 BIT 4,A Jump to ReadControls_Rotate if 6 is not pressed.
53622 JR Z,ReadControls_Rotate
53624 SET 4,C Set bit 4, and jump to ReadControls_Rotate.
53626 JR ReadControls_Rotate
View the equivalent code in;
Prev: 53547 Up: Map Next: 53628