Prev: 43931 Up: Map Next: 44038
43991: Controls: Exit Screen
Used by the routines at 44038, 60714 and 63673.
Output
A 0 for no press and 1 for pressed
Controls_ExitScreen 43991 LD A,(45787) If Game_Options is zero then jump to Controls_ExitScreen_Keyboard.
43994 OR A
43995 JR Z,Controls_ExitScreen_Keyboard
43997 CP 1 If Game_Options is not 1 then jump to Controls_ExitScreen_Sinclair.
43999 JR NZ,Controls_ExitScreen_Sinclair
Handle Kempston Joystick.
44001 IN A,(31) Read from Kempston Joystick.
44003 BIT 3,A If bit 3 is set/ "UP" is being pressed then jump to Controls_NoPress_ExitScreen.
44005 JR Z,Controls_NoPress_ExitScreen
Key was pressed so return A=1.
Controls_Pressed_ExitScreen 44007 LD A,1 A=1.
44009 RET Return.
Handle Keyboard controls.
Controls_ExitScreen_Keyboard 44010 LD A,253 Read from the keyboard;
Port Number Bit
0 1 2 3 4
253 A S D F G
44012 IN A,(254)
44014 LD B,A Store the result in B.
44015 LD A,191 Read from the keyboard;
Port Number Bit
0 1 2 3 4
191 ENTER L K J H
44017 IN A,(254)
44019 AND B Merge in the bits from B.
Fill in the "blanks".
44020 OR %11100000 Set bits 5-7.
If there's been any keypress at all then A won't be 255.
44022 CP 255 If the result is not 255 jump to Controls_Pressed_ExitScreen.
44024 JR NZ,Controls_Pressed_ExitScreen
44026 JR Controls_NoPress_ExitScreen Jump to Controls_NoPress_ExitScreen.
Handle Sinclair Joystick.
Controls_ExitScreen_Sinclair 44028 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
44030 IN A,(254)
44032 BIT 1,A If bit 1 is set jump to Controls_Pressed_ExitScreen.
44034 JR Z,Controls_Pressed_ExitScreen
No key was pressed so return A=0.
Controls_NoPress_ExitScreen 44036 XOR A A=0.
44037 RET Return.
Prev: 43931 Up: Map Next: 44038