Prev: 6D0C Up: Map Next: 6DBA
6D9C: 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 6D9C LD A,($5E03) Jump to ReadKempstonJoystick if GameOptions is set to joystick controls.
6D9F BIT 1,A
6DA1 JP NZ,ReadKempstonJoystick
Read keyboard input.
6DA4 LD A,$FB Read from the keyboard;
Port Number Bit
0 1 2 3 4
$FB Q W E R T
6DA6 OUT ($FD),A
6DA8 IN A,($FE)
Convert the bits into game compatible bits (as in, see ReadKempstonJoystick - as this is what is being matched).
6DAA LD C,A Remember the keys that have been read in C.
6DAB RRA Rotate the keys right once, so that the W key (right) is in bit 0.
6DAC AND %00000001 Keep only bit 0 (right).
6DAE LD E,A Store the right key in E.
6DAF LD A,C Restore the keys that were read.
6DB0 RLA Rotate the keys left once, so that the Q key (left) is in bit 1.
6DB1 AND %00000010 Keep only bit 1 (left).
6DB3 OR E Combine it with the right key.
6DB4 LD E,A Store the right and left keys in E.
6DB5 LD A,C Restore the keys that were read.
6DB6 AND %00011100 Keep only bits 2-4 (the E, R and T keys: down, up and fire).
6DB8 OR E Combine them with the right and left keys.
6DB9 RET Return.
Prev: 6D0C Up: Map Next: 6DBA