Prev: B00B Up: Map Next: B06D
B03C: Controls: Left
Used by the routines at B09F, EFC7 and F8B9.
Output
A 00 for no press and 01 for pressed
Controls_Left B03C LD A,($B2DB) If Game_Options is zero then jump to Controls_Left_Keyboard.
B03F OR A
B040 JR Z,Controls_Left_Keyboard
B042 CP $01 If Game_Options is not 01 then jump to Controls_Left_Sinclair.
B044 JR NZ,Controls_Left_Sinclair
Handle Kempston Joystick.
B046 IN A,($1F) Read from Kempston Joystick.
B048 BIT 1,A If bit 1 is not set/ "LEFT" is being pressed then jump to Controls_Pressed_Left.
B04A JR NZ,Controls_Pressed_Left
B04C JR Controls_NoPress_Left Jump to Controls_NoPress_Left.
Handle Sinclair Joystick.
Controls_Left_Sinclair B04E LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
B050 IN A,($FE)
B052 BIT 4,A If bit 4 is not set jump to Controls_NoPress_Left.
B054 JR NZ,Controls_NoPress_Left
Key was pressed so return A=01.
Controls_Pressed_Left B056 LD A,$01 A=01.
B058 RET Return.
Handle Keyboard controls.
Controls_Left_Keyboard B059 LD A,$FB Read from the keyboard;
Port Number Bit
0 1 2 3 4
FB Q W E R T
B05B IN A,($FE)
Filter out the keys leaving only: Q, E and T.
B05D OR %11101010 Set bits 1, 3, 5-7.
B05F LD B,A Store the result in B.
B060 LD A,$DF Read from the keyboard;
Port Number Bit
0 1 2 3 4
DF P O I U Y
B062 IN A,($FE)
Filter out the keys leaving only: O and U.
B064 OR %11110101 Set bits 0, 2, 4-7.
B066 AND B Merge in the bits from B.
B067 CP $FF If the result is not FF jump to Controls_Pressed_Left.
B069 JR NZ,Controls_Pressed_Left
No key was pressed so return A=00.
Controls_NoPress_Left B06B XOR A A=00.
B06C RET Return.
Prev: B00B Up: Map Next: B06D