Prev: 45116 Up: Map Next: 45213
45165: Controls: Jump
Used by the routines at 45215 and 63673.
Output
A 0 for no press and 1 for pressed
Controls_Jump 45165 LD A,(45787) If Game_Options is zero then jump to Controls_Jump_Keyboard.
45168 OR A
45169 JR Z,Controls_Jump_Keyboard
45171 CP 1 If Game_Options is not 1 then jump to Controls_Jump_Sinclair.
45173 JR NZ,Controls_Jump_Sinclair
Handle Kempston Joystick.
45175 IN A,(31) Read from Kempston Joystick.
45177 BIT 4,A If bit 4 is set/ "FIRE" is being pressed then jump to Controls_NoPress_Jump.
45179 JR Z,Controls_NoPress_Jump
Key was pressed so return A=1.
Controls_Pressed_Jump 45181 LD A,1 A=1.
45183 RET Return.
Handle Sinclair Joystick.
Controls_Jump_Sinclair 45184 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
45186 IN A,(254)
45188 BIT 0,A If bit 0 is set jump to Controls_Pressed_Jump.
45190 JR Z,Controls_Pressed_Jump
45192 JR Controls_NoPress_Jump Jump to Controls_NoPress_Jump.
Handle Keyboard controls.
Controls_Jump_Keyboard 45194 LD A,254 Read from the keyboard;
Port Number Bit
0 1 2 3 4
254 SHIFT Z X C V
45196 IN A,(254)
45198 LD B,A Store the result in B.
45199 LD A,127 Read from the keyboard;
Port Number Bit
0 1 2 3 4
127 SPACE FULL-STOP M N B
45201 IN A,(254)
45203 AND B Merge in the bits from B.
Fill in the "blanks".
45204 OR %11100000 Set bits 5-7.
If there's been any keypress at all then A won't be 255.
45206 CP 255 If the result is not 255 jump to Controls_Pressed_Jump.
45208 JP NZ,Controls_Pressed_Jump
No key was pressed so return A=0.
Controls_NoPress_Jump 45211 XOR A A=0.
45212 RET Return.
Prev: 45116 Up: Map Next: 45213