Prev: C954 Up: Map Next: C9A5
C979: 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 C979 LD C,$00 Set C to 00.
C97B LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
C97D CALL ReadKeyboardPort
C980 BIT 4,A Set bit 0 of C if bit 4 of A is set.
C982 JR Z,ReadCursorJoystick_SecondRow
C984 SET 0,C
Fire, up, right and down from the 0-9 row.
ReadCursorJoystick_SecondRow C986 LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
C988 CALL ReadKeyboardPort
C98B BIT 0,A Set bit 3 of C if bit 0 of A is set.
C98D JR Z,ReadCursorJoystick_TestUp
C98F SET 3,C
ReadCursorJoystick_TestUp C991 BIT 3,A Set bit 2 of C if bit 3 of A is set.
C993 JR Z,ReadCursorJoystick_TestRight
C995 SET 2,C
ReadCursorJoystick_TestRight C997 BIT 2,A Set bit 1 of C if bit 2 of A is set.
C999 JR Z,ReadCursorJoystick_TestDown
C99B SET 1,C
ReadCursorJoystick_TestDown C99D BIT 4,A Jump to ReadControls_Finish if bit 4 of A is clear.
C99F JR Z,ReadControls_Finish
C9A1 SET 4,C Set bit 4 of C.
C9A3 JR ReadControls_Finish Jump to ReadControls_Finish.
View the equivalent code in;
Prev: C954 Up: Map Next: C9A5