Prev: 44996 Up: Map Next: 45116
45067: Controls: Right
Used by the routines at 45215, 61383 and 63673.
Output
A 0 for no press and 1 for pressed
Controls_Right 45067 LD A,(45787) If Game_Options is zero then jump to Controls_Right_Keyboard.
45070 OR A
45071 JR Z,Controls_Right_Keyboard
45073 CP 1 If Game_Options is not 1 then jump to Controls_Right_Sinclair.
45075 JR NZ,Controls_Right_Sinclair
Handle Kempston Joystick.
45077 IN A,(31) Read from Kempston Joystick.
45079 BIT 0,A If bit 0 is not set/ "RIGHT" is being pressed then jump to Controls_Pressed_Right.
45081 JR NZ,Controls_Pressed_Right
45083 JR Controls_NoPress_Right Jump to Controls_NoPress_Right.
Handle Sinclair Joystick.
Controls_Right_Sinclair 45085 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
45087 IN A,(254)
45089 BIT 3,A If bit 3 is not set jump to Controls_NoPress_Right.
45091 JR NZ,Controls_NoPress_Right
Key was pressed so return A=1.
Controls_Pressed_Right 45093 LD A,1 A=1.
45095 RET Return.
Handle Keyboard controls.
Controls_Right_Keyboard 45096 LD A,251 Read from the keyboard;
Port Number Bit
0 1 2 3 4
251 Q W E R T
45098 IN A,(254)
Filter out the keys leaving only: W and R.
45100 OR %11110101 Set bits 0, 2, 4-7.
45102 LD B,A Store the result in B.
45103 LD A,223 Read from the keyboard;
Port Number Bit
0 1 2 3 4
223 P O I U Y
45105 IN A,(254)
Filter out the keys leaving only: P, I and Y.
45107 OR %11101010 Set bits 1, 3, 5-7.
45109 AND B Merge in the bits from B.
45110 CP 255 If the result is not 255 jump to Controls_Pressed_Right.
45112 JR NZ,Controls_Pressed_Right
No key was pressed so return A=0.
Controls_NoPress_Right 45114 XOR A A=0.
45115 RET Return.
Prev: 44996 Up: Map Next: 45116