Prev: D077 Up: Map Next: D0C8
D09C: 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 D09C LD C,$00 Set the controls to none.
D09E LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
D0A0 CALL ReadKeyboardPort
D0A3 BIT 4,A Set the left control if 5 is pressed.
D0A5 JR Z,ReadCursorJoystick_SecondRow
D0A7 SET 0,C
Fire, up, right and down from the 0-9 row.
ReadCursorJoystick_SecondRow D0A9 LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
D0AB CALL ReadKeyboardPort
D0AE BIT 0,A Set the jump control if 0 is pressed.
D0B0 JR Z,ReadCursorJoystick_TestUp
D0B2 SET 3,C
ReadCursorJoystick_TestUp D0B4 BIT 3,A Set the walk control if 7 is pressed.
D0B6 JR Z,ReadCursorJoystick_TestRight
D0B8 SET 2,C
ReadCursorJoystick_TestRight D0BA BIT 2,A Set the right control if 8 is pressed.
D0BC JR Z,ReadCursorJoystick_TestDown
D0BE SET 1,C
ReadCursorJoystick_TestDown D0C0 BIT 4,A Jump to ReadControls_Finish if 6 is not pressed.
D0C2 JR Z,ReadControls_Finish
D0C4 SET 4,C Set the pick up control.
D0C6 JR ReadControls_Finish Jump to ReadControls_Finish.
View the equivalent code in;
Prev: D077 Up: Map Next: D0C8