Prev: 51540 Up: Map Next: 51621
51577: 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 51577 LD C,0 Set C to 0.
51579 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
51581 CALL ReadKeyboardPort
51584 BIT 4,A Set bit 0 of C if bit 4 of A is set.
51586 JR Z,ReadCursorJoystick_SecondRow
51588 SET 0,C
Fire, up, right and down from the 0-9 row.
ReadCursorJoystick_SecondRow 51590 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
51592 CALL ReadKeyboardPort
51595 BIT 0,A Set bit 3 of C if bit 0 of A is set.
51597 JR Z,ReadCursorJoystick_TestUp
51599 SET 3,C
ReadCursorJoystick_TestUp 51601 BIT 3,A Set bit 2 of C if bit 3 of A is set.
51603 JR Z,ReadCursorJoystick_TestRight
51605 SET 2,C
ReadCursorJoystick_TestRight 51607 BIT 2,A Set bit 1 of C if bit 2 of A is set.
51609 JR Z,ReadCursorJoystick_TestDown
51611 SET 1,C
ReadCursorJoystick_TestDown 51613 BIT 4,A Jump to ReadControls_Finish if bit 4 of A is clear.
51615 JR Z,ReadControls_Finish
51617 SET 4,C Set bit 4 of C.
51619 JR ReadControls_Finish Jump to ReadControls_Finish.
View the equivalent code in;
Prev: 51540 Up: Map Next: 51621