| ← 9988 | Map | 9B23 → |
9AF3: Drag every caught ball up with the bat
|
Drags any ball stuck on the bat up by the same pixel step the bat just moved. The downward drag is its counterpart.
|
|||||||
|
|||||||
|
A ball is stuck on the bat while its on-the-bat flag is set. Either it waits for the serve, or the glue prize holds it.
The two balls are handled independently, so in two-ball play either, both or neither may be dragged.
|
|||||||
| drag_caught_up | 9AF3 | LD B,A | Hold the step in B, where the two patched opcodes read it. | ||||
| 9AF4 | LD A,$90 | The SUB B opcode: this up-entry subtracts the step from each caught ball's Y. The down-entry arrives at the next store with ADD A,B instead. | |||||
| drag_caught_up_0 | 9AF6 | LD (smc_drag_step_a),A | Patch both shared step opcodes to the chosen add/subtract. | ||||
| 9AF9 | LD (smc_drag_step_b),A | ||||||
| 9AFC | PUSH IX | ||||||
| 9AFE | LD A,(ball_a_on_bat) | Drag ball A only while it is stuck on the bat. | |||||
| 9B01 | OR A | ||||||
| 9B02 | JR Z,drag_caught_up_1 | ||||||
| 9B04 | LD IX,ball_a_object | Point IX at ball A's sprite record and read its Y. | |||||
| 9B08 | LD A,(IX+$01) | ||||||
|
The step instruction that the upward drag sets to lift a caught ball and the downward drag sets to lower it.
|
|||||||
| smc_drag_step_a | 9B0B | SUB B | Shift ball A's Y by the step. | ||||
| 9B0C | LD (IX+$01),A | Store ball A's Y back. | |||||
| drag_caught_up_1 | 9B0F | LD A,(ball_b_on_bat) | Repeat for ball B: act only while ball B is on the bat. | ||||
| 9B12 | OR A | ||||||
| 9B13 | JR Z,drag_caught_up_2 | ||||||
| 9B15 | LD IX,obj2_object | Point IX at the secondary object, which carries ball B, and read its Y. | |||||
| 9B19 | LD A,(IX+$01) | ||||||
| smc_drag_step_b | 9B1C | DEFB $90 | Shift ball B's Y by the step. | ||||
| 9B1D | LD (IX+$01),A | Store ball B's Y back. | |||||
| drag_caught_up_2 | 9B20 | POP IX | Give the caller its register back. | ||||
| 9B22 | RET | ||||||
| ← 9988 | Map | 9B23 → |
