Prev: 27916 Up: Map Next: 28090
28060: Read Player Input
Used by the routines at GamePlayEntry and Robbie_CarryingCan.
Reads the controls, using either the Kempston joystick or the keyboard depending on the option chosen on the game selection screen. The bits of the result are reset when the control is being used:
Bit Joystick Key
0 Right W
1 Left Q
2 Down E
3 Up R
4 Fire T
Output
A The controls
ReadInput 28060 LD A,(24067) Jump to ReadKempstonJoystick if GameOptions is set to joystick controls.
28063 BIT 1,A
28065 JP NZ,ReadKempstonJoystick
Read keyboard input.
28068 LD A,251 Read from the keyboard;
Port Number Bit
0 1 2 3 4
$FB Q W E R T
28070 OUT (253),A
28072 IN A,(254)
Convert the bits into game compatible bits (as in, see ReadKempstonJoystick - as this is what is being matched).
28074 LD C,A Remember the keys that have been read in C.
28075 RRA Rotate the keys right once, so that the W key (right) is in bit 0.
28076 AND %00000001 Keep only bit 0 (right).
28078 LD E,A Store the right key in E.
28079 LD A,C Restore the keys that were read.
28080 RLA Rotate the keys left once, so that the Q key (left) is in bit 1.
28081 AND %00000010 Keep only bit 1 (left).
28083 OR E Combine it with the right key.
28084 LD E,A Store the right and left keys in E.
28085 LD A,C Restore the keys that were read.
28086 AND %00011100 Keep only bits 2-4 (the E, R and T keys: down, up and fire).
28088 OR E Combine them with the right and left keys.
28089 RET Return.
Prev: 27916 Up: Map Next: 28090