Prev: 9D2E Up: Map Next: 9DF4
9D51: Update scoreboard and flashing lights
bonus_string 9D51 DEFM " ",$A0 Bonus digits buffer
hi 9D57 DEFM "H",$C9 "HI" gear string
lo 9D59 DEFM "L",$CF "LO" gear string
stage 9D5B DEFM "STAGE " "STAGE n" message shown in the score area
stage_n 9D61 DEFB $A0 stage_n writes the current stage number here in ASCII.
This entry point is used by the routines at main_loop, escape_scene and setup_game.
update_scoreboard 9D62 LD A,($A223) Check if stage has changed -- perhaps reset to zero by stage loads?
9D65 AND A Avoid work if previously updated
9D66 JR NZ,us_bonus_start
9D68 LD A,($8007) Load <wanted_stage_number>
9D6B ADD A,$B0 Add 48 to make it a digit then $80 to terminate the string
9D6D LD ($9D61),A Overwrite the N in "STAGE N"
9D70 LD ($A223),A
9D73 LD DE,$4486 Screen pixel (48,36)
9D76 LD HL,$9D5B Point at stage text
9D79 CALL draw_string Draw it
us_bonus_start 9D7C LD A,($A22C) Load <trigger_bonus_flag>
9D7F AND A If it's zero jump to attribute setting
9D80 JR Z,us_bonus_countdown
9D82 XOR A Clear it
9D83 LD ($A22C),A
9D86 LD HL,$4168 Screen pixel (64,24)
Clear the area - 5x7 bytes
9D89 LD B,$07 7 iterations
9D8B LD D,H DE = HL
9D8C LD E,L
bonus_string_0 9D8D LD C,L Preserve column
9D8E LD (HL),A Update five bytes
9D8F INC L
9D90 LD (HL),A
9D91 INC L
9D92 LD (HL),A
9D93 INC L
9D94 LD (HL),A
9D95 INC L
9D96 LD (HL),A
9D97 LD L,C Restore column
9D98 INC H Advance row
9D99 DJNZ bonus_string_0 Loop
9D9B LD HL,$0000 HL = <self modified> -- load address of score digits
9D9E CALL draw_string Draw it
9DA1 LD A,$08 Set bonus counter to 8
9DA3 JR us_bonus_set_counter Jump
us_bonus_countdown 9DA5 LD A,($A22D) A = <bonus_counter>
9DA8 AND A Jump if counter is zero
9DA9 JR Z,us_gear
9DAB DEC A Decrement the bonus counter
us_bonus_set_counter 9DAC LD ($A22D),A <bonus_counter> = A
9DAF SRL A Shift out LSB to carry
9DB1 LD C,A
9DB2 JR Z,bonus_string_1 Jump if C is zero, using zero for attributes
9DB4 LD C,$42 42 => BRIGHT + red over black
9DB6 JR C,bonus_string_1 Jump if odd
9DB8 LD C,$46 Otherwise 46 => BRIGHT + yellow over black
bonus_string_1 9DBA LD HL,$5868 Point at attributes (8,3)
9DBD LD B,$05 Set them all to C
bonus_string_2 9DBF LD (HL),C
9DC0 INC L
9DC1 DJNZ bonus_string_2
us_gear 9DC3 LD HL,$A174 Point HL at <displayed_gear>
9DC6 LD A,($A253) Compare to <gear>
9DC9 CP (HL)
9DCA JR Z,us_lights Avoid work if they're equal
9DCC LD (HL),A Update <displayed_gear>
9DCD LD DE,$448E Screen pixel (118,36)
9DD0 LD HL,$9D59 Point HL at "LO"
9DD3 AND A Low gear?
9DD4 JR Z,bonus_string_3 Jump to draw string if so
9DD6 LD HL,$9D57 Point HL at "HI"
bonus_string_3 9DD9 CALL draw_string Draw string
us_lights 9DDC LD A,($A22E) C = sighted_flag
9DDF LD C,A
9DE0 LD A,($A235) A = <counter_B>
9DE3 AND C If (<sighted> AND <counter_B>) is zero jump to plot_turbos_and_scores
9DE4 JR Z,plot_turbos_and_scores
9DE6 LD HL,$5820 Point HL at left light's attributes
9DE9 CALL toggle_light_brightness Toggle its brightness
9DEC LD HL,$583B Point HL at right light's attributes
9DEF CALL toggle_light_brightness Toggle its brightness
9DF2 JR plot_turbos_and_scores
Prev: 9D2E Up: Map Next: 9DF4