Prev: 87DC Up: Map Next: 88D5
8876: User input checking
Used by the routine at main_loop.
check_user_input 8876 LD A,($A231) Load transition_control
8879 LD HL,$A0D5 Address of user_input
887C CP $04 Ignore the user's input unless transition_control is set to 4
887E JR NZ,check_user_input_0
8880 LD (HL),$00 Clear user_input
8882 RET Return
check_user_input_0 8883 LD A,($A16F) AND user_input with user input mask
8886 AND (HL)
8887 LD (HL),A
8888 AND $E0 AND with mask for (Quit+Pause+Turbo), return if none
888A RET Z
888B RLA Quit bit set? Jump to quit_key if so
888C JR C,quit_key
888E RLA Pause bit set? Jump to pause_key if so
888F JR C,pause_key
Turbo was pressed
8891 LD HL,$A24E Address of boost timer
8894 LD A,(HL) Return if a turbo boost is in effect
8895 AND A
8896 RET NZ
8897 LD A,($A170) Return if no turbo boosts are left
889A AND A
889B RET Z
889C LD (HL),$3C Set 60 ticks of boost
889E LD HL,$9917 HL -> Random choice of (WHOAAAAA! / GREAT! / ONE MORE TIME.)
88A1 LD A,$02 Set priority to 2
88A3 CALL chatter Call chatter (priority 2)
88A6 JP turbo_sfx_play_hook Exit via turbo_sfx_play_hook
This entry point is used by the routine at tick.
quit_key 88A9 LD A,($A26A) If quit_state != 0 then return (quit in progress)
88AC AND A
88AD RET NZ
88AE CALL drive_chatter_stop Call drive_chatter_stop
88B1 CALL fill_attributes Call fill_attributes
88B4 LD ($A16F),A user_input_mask = 0 -- A is zero from fill_attributes
88B7 INC A
88B8 LD ($A26A),A quit_state = 1 -- start quitting
88BB RET Return
pause_key 88BC CALL silence_audio_hook Call silence_audio_hook
check_user_input_1 88BF CALL keyscan Call keyscan while PAUSE is pressed
88C2 AND $40
88C4 JR NZ,check_user_input_1
check_user_input_2 88C6 CALL keyscan Call keyscan until keys are pressed
88C9 AND $7F
88CB JR Z,check_user_input_2
check_user_input_3 88CD CALL keyscan Call keyscan until keys are released (debounce)
88D0 AND $7F
88D2 JR NZ,check_user_input_3
88D4 RET Return
Prev: 87DC Up: Map Next: 88D5