Prev: AFC4 Up: Map Next: B03C
B00B: Controls: Right
Used by the routines at B09F, EFC7 and F8B9.
Output
A 00 for no press and 01 for pressed
Controls_Right B00B LD A,($B2DB) If Game_Options is zero then jump to Controls_Right_Keyboard.
B00E OR A
B00F JR Z,Controls_Right_Keyboard
B011 CP $01 If Game_Options is not 01 then jump to Controls_Right_Sinclair.
B013 JR NZ,Controls_Right_Sinclair
Handle Kempston Joystick.
B015 IN A,($1F) Read from Kempston Joystick.
B017 BIT 0,A If bit 0 is not set/ "RIGHT" is being pressed then jump to Controls_Pressed_Right.
B019 JR NZ,Controls_Pressed_Right
B01B JR Controls_NoPress_Right Jump to Controls_NoPress_Right.
Handle Sinclair Joystick.
Controls_Right_Sinclair B01D LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
B01F IN A,($FE)
B021 BIT 3,A If bit 3 is not set jump to Controls_NoPress_Right.
B023 JR NZ,Controls_NoPress_Right
Key was pressed so return A=01.
Controls_Pressed_Right B025 LD A,$01 A=01.
B027 RET Return.
Handle Keyboard controls.
Controls_Right_Keyboard B028 LD A,$FB Read from the keyboard;
Port Number Bit
0 1 2 3 4
FB Q W E R T
B02A IN A,($FE)
Filter out the keys leaving only: W and R.
B02C OR %11110101 Set bits 0, 2, 4-7.
B02E LD B,A Store the result in B.
B02F LD A,$DF Read from the keyboard;
Port Number Bit
0 1 2 3 4
DF P O I U Y
B031 IN A,($FE)
Filter out the keys leaving only: P, I and Y.
B033 OR %11101010 Set bits 1, 3, 5-7.
B035 AND B Merge in the bits from B.
B036 CP $FF If the result is not FF jump to Controls_Pressed_Right.
B038 JR NZ,Controls_Pressed_Right
No key was pressed so return A=00.
Controls_NoPress_Right B03A XOR A A=00.
B03B RET Return.
Prev: AFC4 Up: Map Next: B03C