Prev: AB9B Up: Map Next: AC06
ABD7: Controls: Exit Screen
Used by the routines at AC06, ED2A and F8B9.
Output
A 00 for no press and 01 for pressed
Controls_ExitScreen ABD7 LD A,($B2DB) If Game_Options is zero then jump to Controls_ExitScreen_Keyboard.
ABDA OR A
ABDB JR Z,Controls_ExitScreen_Keyboard
ABDD CP $01 If Game_Options is not 01 then jump to Controls_ExitScreen_Sinclair.
ABDF JR NZ,Controls_ExitScreen_Sinclair
Handle Kempston Joystick.
ABE1 IN A,($1F) Read from Kempston Joystick.
ABE3 BIT 3,A If bit 3 is set/ "UP" is being pressed then jump to Controls_NoPress_ExitScreen.
ABE5 JR Z,Controls_NoPress_ExitScreen
Key was pressed so return A=01.
Controls_Pressed_ExitScreen ABE7 LD A,$01 A=01.
ABE9 RET Return.
Handle Keyboard controls.
Controls_ExitScreen_Keyboard ABEA LD A,$FD Read from the keyboard;
Port Number Bit
0 1 2 3 4
FD A S D F G
ABEC IN A,($FE)
ABEE LD B,A Store the result in B.
ABEF LD A,$BF Read from the keyboard;
Port Number Bit
0 1 2 3 4
BF ENTER L K J H
ABF1 IN A,($FE)
ABF3 AND B Merge in the bits from B.
Fill in the "blanks".
ABF4 OR %11100000 Set bits 5-7.
If there's been any keypress at all then A won't be FF.
ABF6 CP $FF If the result is not FF jump to Controls_Pressed_ExitScreen.
ABF8 JR NZ,Controls_Pressed_ExitScreen
ABFA JR Controls_NoPress_ExitScreen Jump to Controls_NoPress_ExitScreen.
Handle Sinclair Joystick.
Controls_ExitScreen_Sinclair ABFC LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
ABFE IN A,($FE)
AC00 BIT 1,A If bit 1 is set jump to Controls_Pressed_ExitScreen.
AC02 JR Z,Controls_Pressed_ExitScreen
No key was pressed so return A=00.
Controls_NoPress_ExitScreen AC04 XOR A A=00.
AC05 RET Return.
Prev: AB9B Up: Map Next: AC06