Prev: 51439 Up: Map Next: 51483
51455: Read Controls
Used by the routines at HandlePlayerLegs and HandleTurningLegs.
Reads the controls that the player is using and stores them in ControlsPressed. The controls are made into a byte, with bit 0 for left, bit 1 for right, bit 2 for walking forward, bit 3 for jumping and bit 4 for picking up and dropping an object. Bit 5 is set by ReadControls_Finish. No controls are read while the game over scene is shown or the game has been completed.
Output
C The controls
Pick the reader from ControlMethod.
ReadControls 51455 LD A,(23331) Fetch GameCompletedFlag.
51458 LD C,A Copy it to C.
51459 LD A,(23332) Fetch GameOverFlag.
51462 OR C Merge C.
51463 LD C,0 Set C to 0.
51465 JP NZ,ReadControls_Finish Jump to ReadControls_Finish if they are not zero.
51468 LD A,(23300) Fetch ControlMethod.
51471 RRCA Rotate bits 1 and 2 into bits 0 and 1.
51472 AND %00000011 Keep only bits 0 and 1.
51474 JP Z,ReadKeyboard Jump to ReadKeyboard if they are zero.
51477 DEC A Decrement A.
51478 JR Z,ReadKempstonJoystick Jump to ReadKempstonJoystick if it is zero.
51480 DEC A Decrement A.
51481 JR Z,ReadCursorJoystick Jump to ReadCursorJoystick if it is zero.
Continue on to ReadInterface2Joystick.
View the equivalent code in;
Prev: 51439 Up: Map Next: 51483