← B0BF Maybe start the golden brick's idle twinkle Map B20D → Detonate the bomb prize: clear the eight slots around the hit slot
B0DF: Apply the prize on a removed prize glyph
Applies the prize on a revealed glyph that a ball or an inhabitant's step just removed. It cancels any prize still in effect except a safety net.
Prize Effect
Glue The ball sticks to the bat until fire releases it
Bomb Empties the eight slots around the hit one
Missile The bat becomes the missile bat
Expand An extra segment extends the bat
Double bat A second bat moves with the bat and returns the ball
Double score Points count double until the next prize or the last ball is lost
Extra life One more life, up to the cap of 25
Slow ball The ball's speed drops by up to 2, but not below the serve speed
Safety net A timed barrier on the bat's losing edge
apply_prize B0DF LD HL,(hit_brick_addr) Read the hit brick's tile. Only a prize glyph goes on: the safety net glyph, or a tile from the glue glyph to the last slow ball frame. For any other tile, return.
B0E2 LD A,(HL)
B0E3 CP $6C
B0E5 JR Z,cancel_prize
B0E7 CP $79
B0E9 RET C
B0EA CP $A5
B0EC RET NC
cancel_prize B0ED LD A,(double_bat_active) Stand down a live double bat.
B0F0 OR A
B0F1 JR Z,cancel_prize_expand
B0F3 XOR A
B0F4 LD (obj2_active),A
cancel_prize_expand B0F7 LD A,(expand_active) An expanded bat goes back to its normal size: arm the shrink.
B0FA OR A
B0FB JR Z,cancel_prize_missile
B0FD XOR A
B0FE LD (fx_grow_arm),A
B101 INC A
B102 LD (fx_shrink_arm),A
cancel_prize_missile B105 LD A,(missile_active) A missile bat is turned back into the plain one.
B108 OR A
B109 JR Z,cancel_prize_flags
B10B XOR A
B10C LD (fx_bat_missile_arm),A
B10F INC A
B110 LD (fx_bat_normal_arm),A
cancel_prize_flags B113 XOR A Clear the glue, double bat, missile and double score flags, and request a glue release, before the new prize takes hold.
B114 LD (glue_active),A
B117 LD (double_bat_active),A
B11A LD (missile_active),A
B11D LD (double_score),A
B120 INC A
B121 LD (glue_release_req),A
B124 LD A,(HL) G/glue: set the glue active flag – the ball will stick to the bat.
B125 CP $79
B127 JR NZ,apply_bomb
B129 LD A,$01
B12B LD (glue_active),A
B12E RET
apply_bomb B12F CP $7D B/bomb: take over the secondary object, and stand down any ball or missile shot it carried. Arm the 3×3 bomb detonation, whose frame 8 sets off the blast. Save the blast center, park the object on the hit brick and set ball B's heading code.
B131 JR NZ,apply_missile
B133 XOR A
B134 LD (ball_b_in_play),A
B137 LD (missile_shot),A
B13A INC A
B13B LD (fx_bomb_arm),A
B13E LD (cluster_center_addr),HL
B141 LD A,(hit_brick_index)
B144 LD (cluster_brick_index),A
B147 CALL brick_addr_to_pixel
B14A LD A,B
B14B LD (obj2_object),A
B14E LD A,C
B14F LD (obj2_y),A
B152 LD A,$63
B154 LD (ball_b_heading),A
B157 RET
apply_missile B158 CP $81 M/missile: switch the bat to the missile-bat sprite, unless a missile shot is out or a retract runs. An expanded bat shrinks at once.
B15A JR NZ,apply_expand
B15C LD A,(missile_shot)
B15F OR A
B160 RET NZ
B161 LD A,(fx_retract_arm)
B164 OR A
B165 RET NZ
B166 XOR A
B167 LD (fx_bat_normal_arm),A
B16A LD (fx_shrink_arm),A
B16D INC A
B16E LD (missile_active),A
B171 LD (fx_bat_missile_arm),A
B174 LD A,(expand_active)
B177 OR A
B178 RET Z
B179 XOR A
B17A LD (expand_active),A
B17D LD A,(bat_y)
B180 ADD A,$08
B182 LD (bat_y),A
B185 XOR A
B186 LD (bat_ext_active),A
B189 RET
apply_expand B18A CP $85 E/expand: extend the bat with its extension segment, unless it is already expanded.
B18C JR NZ,apply_double_bat
B18E LD A,(expand_active)
B191 OR A
B192 JR NZ,apply_expand_done
B194 LD A,$01
B196 LD (expand_active),A
B199 LD (fx_grow_arm),A
apply_expand_done B19C XOR A Either way, clear the shrink and bat-swap flags.
B19D LD (fx_shrink_arm),A
B1A0 LD (fx_bat_normal_arm),A
B1A3 RET
apply_double_bat B1A4 CP $89 D/double bat: set the double bat active flag, which puts a second bat in play that moves with the bat.
B1A6 JR NZ,apply_double_score
B1A8 LD A,$01
B1AA LD (double_bat_active),A
B1AD RET
apply_double_score B1AE CP $8D x2/double score: set the double score flag, which makes the score fold add the points twice.
B1B0 JR NZ,apply_extra_life
B1B2 LD A,$01
B1B4 LD (double_score),A
B1B7 RET
apply_extra_life B1B8 CP $91 Grant an extra life.
B1BA JR NZ,apply_slow_ball
B1BC CALL gain_life
B1BF RET
apply_slow_ball B1C0 CP $95 The one animated prize: slow the active ball toward the serve speed, the speed the options screen sets and the serve uses.
B1C2 JR Z,slow_ball_select
B1C4 CP $99
B1C6 JR Z,slow_ball_select
B1C8 CP $9D
B1CA JR Z,slow_ball_select
B1CC CP $A1
B1CE JR NZ,apply_safety_net
slow_ball_select B1D0 LD A,(active_ball) Point IY at the active ball state record; this arm takes ball A (ball_a_x_accum).
B1D3 OR A
B1D4 JR NZ,slow_ball_use_b
B1D6 LD IY,ball_a_x_accum
B1DA JR slow_ball_step_down
slow_ball_use_b B1DC LD IY,ball_b_x_accum Otherwise it is ball B's.
slow_ball_step_down B1E0 LD A,(ball_speed) Weigh the ball's speed against one above the serve speed. Below it the speed stands; at it a single decrement lands on the serve speed; above it two decrements take off 2. So the speed steps down to the serve speed and stops there – it never drops under the served speed.
B1E3 INC A
B1E4 LD B,A
B1E5 LD A,(IY+$06)
B1E8 CP B
B1E9 JR C,slow_ball_clear_rally
B1EB JR Z,slow_ball_dec
B1ED DEC (IY+$06)
slow_ball_dec B1F0 DEC (IY+$06) The second decrement, taken alone at the threshold and after the first above it
slow_ball_clear_rally B1F3 XOR A All three outcomes join here to clear the ball's rally bounce count. The next rally speed step is then a whole rally interval of bounces away.
B1F4 LD (IY+$0A),A
B1F7 RET
apply_safety_net B1F8 LD A,(safety_net_fx_phase) Safety net, and any other in-range value: raise its barrier (run_prize_safety_net). A net already in its hold phase is not re-armed – the step and hold counters are zeroed instead, which restarts the hold at full length.
B1FB CP $03
B1FD JR NZ,safety_net_arm
B1FF XOR A
B200 LD (safety_net_fx_step),A
B203 LD (safety_net_fx_hold),A
B206 RET
safety_net_arm B207 LD A,$01 Any other phase – no net, the arm, the brighten ramp or the dim ramp – sets the phase to the arm value. The next pass of the safety net animation then stamps the net and starts the upward ramp.
B209 LD (safety_net_fx_phase),A
B20C RET
← B0BF Maybe start the golden brick's idle twinkle Map B20D → Detonate the bomb prize: clear the eight slots around the hit slot
Fork me on GitHub