Prev: 6FB0 Up: Map Next: 6FD7
6FB4: Read Controls
Used by the routine at GamePlay_Start.
Reads the controls which have been chosen in GameOptions; the keyboard, the Kempston joystick or the cursor joystick. The bits of the result are reset for the directions (and fire) which are being pressed.
Bit Control Keyboard
00 Right W
01 Left Q
02 Down E
03 Up R
04 Fire T
Output
A The controls
ReadControls 6FB4 LD A,($5F0C) Fetch the game options.
6FB7 AND %00000110 Keep only bits 1-2 (the choice of controls).
6FB9 CP $02 Jump to ReadKempstonJoystick if the Kempston joystick is being used.
6FBB JR Z,ReadKempstonJoystick
6FBD CP $04 Jump to ReadCursorJoystick if the cursor joystick is being used.
6FBF JR Z,ReadCursorJoystick
6FC1 LD A,$FB Read from the keyboard;
Port Number Bit
0 1 2 3 4
FB Q W E R T
6FC3 OUT ($FD),A
6FC5 IN A,($FE)
6FC7 LD C,A Keep the key states in C.
6FC8 RRA Move the "W" key into bit 0.
6FC9 AND %00000001 Keep only bit 0.
6FCB LD E,A Keep the result in E.
6FCC LD A,C Fetch the key states.
6FCD RLA Move the "Q" key into bit 1.
6FCE AND %00000010 Keep only bit 1.
6FD0 OR E Combine with E.
6FD1 LD E,A Keep the result in E.
6FD2 LD A,C Fetch the key states.
6FD3 AND %00011100 Keep only bits 2-4 ("E", "R" and "T").
6FD5 OR E Combine with E.
6FD6 RET Return.
View the equivalent code in;
Prev: 6FB0 Up: Map Next: 6FD7