Prev: 53367 Up: Map Next: 53448
53404: 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 53404 LD C,0 Set the controls to none.
53406 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
53408 CALL ReadKeyboardPort
53411 BIT 4,A Set the left control if 5 is pressed.
53413 JR Z,ReadCursorJoystick_SecondRow
53415 SET 0,C
Fire, up, right and down from the 0-9 row.
ReadCursorJoystick_SecondRow 53417 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
53419 CALL ReadKeyboardPort
53422 BIT 0,A Set the jump control if 0 is pressed.
53424 JR Z,ReadCursorJoystick_TestUp
53426 SET 3,C
ReadCursorJoystick_TestUp 53428 BIT 3,A Set the walk control if 7 is pressed.
53430 JR Z,ReadCursorJoystick_TestRight
53432 SET 2,C
ReadCursorJoystick_TestRight 53434 BIT 2,A Set the right control if 8 is pressed.
53436 JR Z,ReadCursorJoystick_TestDown
53438 SET 1,C
ReadCursorJoystick_TestDown 53440 BIT 4,A Jump to ReadControls_Finish if 6 is not pressed.
53442 JR Z,ReadControls_Finish
53444 SET 4,C Set the pick up control.
53446 JR ReadControls_Finish Jump to ReadControls_Finish.
View the equivalent code in;
Prev: 53367 Up: Map Next: 53448