Prev: 9BA7 Up: Map Next: 9CC2
9BCF: Game timer
Used by the routine at main_loop.
tick 9BCF LD A,($A230) Return if perp_caught_stage > 0
9BD2 AND A
9BD3 RET NZ
9BD4 LD A,($A231) Return if transition_control == 4 -- don't tick while transitions are running
9BD7 CP $04
9BD9 RET Z
9BDA LD HL,$A17E Point HL at time_bcd
9BDD LD A,($A229) Jump to tick_0 if time_up_state was 1 - out of time
9BE0 DEC A
9BE1 JR Z,tick_0
9BE3 DEC A Jump to tick_1 if time_up_state was 2 - show "TIME UP" message
9BE4 JR Z,tick_1
9BE6 DEC A Jump to tick_2 if time_up_state was 3 - show "CONTINUE" message & run countdown
9BE7 JR Z,tick_2
9BE9 DEC A Return if it was 4 - countdown elapsed
9BEA RET Z
Otherwise it's zero?
9BEB LD A,(HL) A = time_bcd
9BEC AND A Set flags
9BED JR NZ,tick_time_remaining Jump to tick_time_remaining if non-zero
Out of time.
9BEF INC A time_up_state = 1
9BF0 LD ($A229),A
9BF3 LD A,$93 user_input_mask = $93 (allow Quit, Fire, Left, Right) [Q: Why left and right?]
9BF5 LD ($A16F),A
9BF8 RET Return
tick_time_remaining 9BF9 DEC HL Decrement the 1/16th sec counter
9BFA DEC (HL)
9BFB RET NZ Return if not zero
9BFC LD (HL),$0F Reset time_sixteenths to 15
9BFE INC HL Decrement time_bcd [POKE $9C01 for Infinite time]
9BFF LD A,(HL)
9C00 SUB $01
9C02 DAA
9C03 LD (HL),A
9C04 CP $15 Return if <> 15s remain
9C06 RET NZ
9C07 LD HL,$98FC Nancy berating us running out of time message
9C0A JP chatter Exit via chatter (priority 21)
tick_0 9C0D LD A,(HL) Is time_bcd zero? Jump to time_up if so
9C0E AND A
9C0F JR Z,tick_time_up
9C11 XOR A time_up_state = 0
9C12 LD ($A229),A
9C15 DEC A user_input_mask = $FF (allow all keys)
9C16 LD ($A16F),A
9C19 JR tick_time_remaining Loop back to tick_time_remaining
tick_time_up 9C1B LD HL,$8D07 Point at "TIME UP" message
9C1E CALL message_printing_related Call message_printing_related
9C21 LD HL,($A24A) Return if speed > 0
9C24 LD A,H
9C25 OR L
9C26 RET NZ
9C27 LD A,$02 time_up_state = 2
9C29 LD ($A229),A
9C2C LD A,$04 Index of "Your time's up" speech sample
9C2E JP play_speech_hook Exit via play_speech_hook
tick_1 9C31 LD A,($A231) Return if transition_control is non-zero
9C34 AND A
9C35 RET NZ
9C36 LD HL,$A13D Exit via quit_key if no credits remain
9C39 LD A,(HL)
9C3A AND A
9C3B JP Z,quit_key
9C3E DEC (HL) Decrement credits [POKE $9C3E for Infinite credits]
9C3F ADD A,$B0 Turn it into ASCII and poke it into the "CREDIT x" string
9C41 LD ($8D8C),A
9C44 LD A,$03 time_up_state = 3
9C46 LD ($A229),A
9C49 LD HL,$0115 HL = $0115
9C4C LD ($9C85),HL Self modify 'LD HL' @ 9C84 to load HL
9C4F RET Return
tick_2 9C50 LD HL,$A0D5 Is fire pressed?
9C53 BIT 4,(HL)
9C55 JR Z,tick_print_continue Jump if not (?)
Resetting mission code.
9C57 XOR A Reset time_up_state to zero
9C58 LD ($A229),A
9C5B LD HL,$A232 Reset smash_factor to zero
9C5E LD (HL),A
9C5F INC HL
9C60 LD (HL),A Reset smash_counter to zero
9C61 DEC A
9C62 LD ($A16F),A Set user input mask to allow everything through
9C65 LD A,$03
9C67 LD ($A252),A var_a252 = 3
9C6A LD ($A231),A transition_control = 3 -- Flag set to zero when attributes have been set
9C6D LD ($A170),A turbos = 3
9C70 LD A,$60 Set remaining time to 60 (BCD) [doesn't affect stuff if altered?!]
9C72 LD ($A17E),A
9C75 LD HL,$8006 Increment retry_count
9C78 INC (HL)
This entry point is used by the routines at run_pregame_screen and page_in_stage_128k.
play_start_noise 9C79 LD A,$05 Index of start noise sample
9C7B JP play_speech_hook Exit via play_speech_hook
tick_print_continue 9C7E LD HL,$8D18 Print "CONTINUE THIS MISSION" messages
9C81 CALL message_printing_related Call message_printing_related
9C84 LD HL,$0000 <self modified>
9C87 DEC H H--
9C88 JR NZ,tick_4
9C8A LD H,$06 H = 6
9C8C DEC L L--
9C8D LD A,L A = L
9C8E RRA
9C8F LD BC,$0801 BC = $0801 -- 8 => bip
9C92 JR NC,tick_3
9C94 INC B B++ -- 9 => bow
tick_3 9C95 CALL start_sfx Call start_sfx
9C98 LD A,L A = L
9C99 AND A Set flags
9C9A JR NZ,tick_4
9C9C INC A A++
9C9D LD ($A26A),A quit_state = A
9CA0 LD A,$04 time_up_state = 4
9CA2 LD ($A229),A
tick_4 9CA5 LD ($9C85),HL Self modify 'LD HL' @ 9C84 to load HL
9CA8 LD A,L A = L
9CA9 SRL A A >>= 1
9CAB LD DE,$8D7C Address of nn in "TIME nn"
9CAE CP $0A CP 10
9CB0 JR NZ,tick_5
9CB2 LD A,$31 A = $31
9CB4 LD L,$00 L = $00
9CB6 JR tick_6
tick_5 9CB8 LD L,A L = A
9CB9 LD A,$20 A = $20
tick_6 9CBB LD (DE),A *DE = A
9CBC LD A,L A = L + $B0
9CBD ADD A,$B0
9CBF INC DE DE++
9CC0 LD (DE),A *DE = A
9CC1 RET Return
Prev: 9BA7 Up: Map Next: 9CC2