Prev: 9945 Up: Map Next: 99EC
9965: Runs chatter, mugshots and noise effect
Used by the routines at main_loop, run_pregame_screen and escape_scene.
drive_chatter 9965 LD A,($963D) Load chatter_state
9968 DEC A If chatter_state was 1 (starting) then jump to drive_chatter_clear
9969 JR Z,drive_chatter_starting
996B DEC A If chatter_state was 2 (displaying) then jump to drive_chatter_do_noise_effect
996C JR Z,drive_chatter_do_noise_effect
996E DEC A If chatter_state was 0 (idle) then jump to drive_chatter_idle
996F JR NZ,drive_chatter_idle
Otherwise chatter_state is 3 (stopping).
9971 LD HL,$963C Decrement noise_counter in-place
9974 DEC (HL)
9975 LD A,(HL) Load noise_counter
9976 JP NZ,ne_9a5c Jump into noise_effect if it was non-zero
9979 LD ($963D),A New chatter_state is 0 (idle)
997C CALL ne_plot_attrs Call noise_plot_attrs to clear to black
This is the flashing cursor.
drive_chatter_idle 997F LD D,$20 Plot a space character
9981 LD A,$AA Alternating bit generator: $AA rotated 1 becomes $55, $55 rotated 1 becomes $AA, and so on, result in carry flag
9983 RRCA
9984 LD ($9982),A
9987 LD A,$FF (flag?)
9989 JP C,plot_mini_font_2 Exit via plot_mini_font_2 if carry set
998C JP plot_mini_font_1 Otherwise exit via plot_mini_font_1
drive_chatter_do_noise_effect 998F LD A,($963C) If noise_counter > 0 exit via noise_effect
9992 AND A
9993 JP NZ,noise_effect
9996 LD A,($9633) If chatter_delay is zero jump to drive_chatter_clear_line
9999 AND A
999A JR Z,drive_chatter_clear_line
999C DEC A Otherwise decrement chatter_delay
999D LD ($9633),A
99A0 LD B,A Copy chatter_delay for later
99A1 JR Z,drive_chatter_99bd If chatter_delay was zero jump to drive_chatter_99bd
99A3 LD HL,($962E) Load address of next character
99A6 DEC HL Go back 1
99A7 LD D,(HL) Load the character for when we call plot_mini_font*
99A8 RES 7,D Clear string terminator bit
99AA LD A,($9632) A = message_x - 1
99AD DEC A
99AE RR B Rotate chatter_delay (testing the bottom bit but why?)
Could JP $9989 here instead.
99B0 JP C,plot_mini_font_2 Exit via plot_mini_font_2 if carry set
99B3 JP plot_mini_font_1 Otherwise exit via plot_mini_font_1
drive_chatter_clear_line 99B6 LD A,($9632) If message_x != 0 exit via pc_clear_line
99B9 AND A
99BA JP NZ,pc_clear_line
drive_chatter_99bd 99BD LD HL,($9630) Load message set address
99C0 LD A,(HL) Read a byte
99C1 CP $FF Is it a message set terminator? Jump to drive_chatter_stop if so
99C3 JR Z,drive_chatter_stop
An $FE byte means the next two bytes are the address of another message set.
99C5 CP $FE Is it introducing a message set address?
99C7 JR NZ,pc_chatter_message Exit via pc_chatter_message if not
The next two bytes hold a message set address.
99C9 INC HL Step over the $FE byte
99CA LD A,(HL) message_set = wordat(HL)
99CB INC HL
99CC LD H,(HL)
99CD LD L,A
99CE LD ($9630),HL
99D1 JR drive_chatter_clear Jump to drive_chatter_clear
This entry point is used by the routines at run_pregame_screen and check_user_input.
drive_chatter_stop 99D3 LD A,$04 Set noise_counter to 4
99D5 LD ($963C),A
99D8 DEC A Set chatter_state to 3 (stopping)
99D9 LD ($963D),A
99DC JP clear_message_line Exit via clear_message_line
drive_chatter_starting 99DF LD A,$02 chatter_state = 2 (displaying)
99E1 LD ($963D),A
drive_chatter_clear 99E4 CALL clear_message_line Call clear_message_line
99E7 LD A,$04 Set noise effect counter to 4
99E9 JP noise_effect Exit via noise_effect
Prev: 9945 Up: Map Next: 99EC