Prev: C8EF Up: Map Next: C91B
C8FF: 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 C8FF LD A,($5B23) Fetch GameCompletedFlag.
C902 LD C,A Copy it to C.
C903 LD A,($5B24) Fetch GameOverFlag.
C906 OR C Merge C.
C907 LD C,$00 Set C to 00.
C909 JP NZ,ReadControls_Finish Jump to ReadControls_Finish if they are not zero.
C90C LD A,($5B04) Fetch ControlMethod.
C90F RRCA Rotate bits 1 and 2 into bits 0 and 1.
C910 AND %00000011 Keep only bits 0 and 1.
C912 JP Z,ReadKeyboard Jump to ReadKeyboard if they are zero.
C915 DEC A Decrement A.
C916 JR Z,ReadKempstonJoystick Jump to ReadKempstonJoystick if it is zero.
C918 DEC A Decrement A.
C919 JR Z,ReadCursorJoystick Jump to ReadCursorJoystick if it is zero.
Continue on to ReadInterface2Joystick.
View the equivalent code in;
Prev: C8EF Up: Map Next: C91B