← 8ED3 Initialize the score and game counters for a new game Map 8F67 → Object pool
8F0A: Re-arm the object pool to serve a ball
Positions the bat and the ball for the current side and leaves only their two pool slots active.
rearm_serve 8F0A LD A,(bat_side) Pick the bat and ball start positions for the current bat side.
8F0D OR A
8F0E JR NZ,rearm_serve_0
8F10 LD HL,$58D4 The right-hand side puts them against that edge.
8F13 LD DE,$58CA
8F16 JR rearm_serve_1
rearm_serve_0 8F18 LD HL,$581C The left-hand side puts them against the other.
8F1B LD DE,$5826
rearm_serve_1 8F1E LD (object_table),HL Either way, store the pair into the pool's first two slots.
8F21 LD (ball_a_object),DE
8F25 LD HL,slot_bat_normal Point the bat and ball slots at their sprite data.
8F28 LD (bat_sprite_ptr),HL
8F2B LD HL,slot_ball
8F2E LD (ball_a_sprite_ptr),HL
8F31 LD A,(ball_speed) Load the ball's speed from the options screen, clear its bounce count and both step thresholds, and raise the serve flag.
8F34 LD (ball_a_speed),A
8F37 XOR A
8F38 LD (ball_a_bounce_count),A
8F3B LD (ball_a_x_threshold),A
8F3E LD (ball_a_y_threshold),A
8F41 INC A
8F42 LD (ball_a_on_bat),A
8F45 LD IX,object_table Clear the active flag on all nine pool slots.
8F49 PUSH IX
8F4B LD DE,$0009
8F4E LD B,$09
rearm_serve_2 8F50 RES 0,(IX+$08)
8F54 ADD IX,DE
8F56 DJNZ rearm_serve_2
8F58 POP IX Re-activate the bat and ball A.
8F5A SET 0,(IX+$08)
8F5E LD IX,ball_a_object
8F62 SET 0,(IX+$08)
8F66 RET
← 8ED3 Initialize the score and game counters for a new game Map 8F67 → Object pool
Fork me on GitHub