← A938 Speed the ball up as the rally continues Map A99A → Prize-reveal tune gate
A954: Hold a ball on the bat, and release it
Holds a ball on the bat until fire, a release request, or 250 frames. When a ball arrives at the bat, the bat catches it only while the glue prize is active.
Input
IY the ball state record
Output
A 1 to bounce off the bat, 0 while the ball is held
A ball parked for a serve is held the same way. The serve setup raises its stuck flag, so from its first frame it takes the held branch whether or not glue is active. The serve comes on fire or on a release request, and otherwise by itself after 250 frames.
Only a glue catch and the level setup clear the hold timer, and the promotion of ball B copies its timer over ball A's. A release leaves the timer where it stands, so a serve after a lost ball resumes that count. After a fire release the serve comes that much sooner. After a timeout release the count runs through the wrap, so it takes 256 frames.
The hold timer, the release request and the fire press are each checked every frame while the ball is held.
ball_catch_test A954 LD A,(IY+$0B) Not already stuck to the bat? Handle the ball's arrival.
A957 OR A
A958 JR Z,catch_on_arrival
A95A INC (IY+$0F) Held: advance the hold timer.
A95D LD A,(IY+$0F)
A960 CP $FA Release once the hold timer runs out.
A962 JR Z,catch_release
A964 LD A,(glue_release_req) Release if a new prize has requested it.
A967 OR A
A968 JR NZ,catch_release
A96A LD HL,controls Release on a fire press; otherwise hold the ball.
A96D BIT 4,(HL)
A96F JR Z,catch_stay_held
catch_release A971 XOR A Release: clear the request latch and the caught flag, and report a bounce.
A972 LD (glue_release_req),A
A975 LD (IY+$0B),A
A978 INC A
A979 RET
catch_on_arrival A97A LD A,(glue_active) A fresh arrival: catch the ball only while the glue prize is active.
A97D OR A
A97E JR NZ,catch_hold_ball
A980 XOR A Glue off: clear the request latch and report a normal bounce.
A981 LD (glue_release_req),A
A984 INC A
A985 RET
catch_hold_ball A986 LD A,$01 Catch the ball: set the caught flag.
A988 LD (IY+$0B),A
A98B XOR A Freeze it on the bat: zero both step thresholds.
A98C LD (IY+$02),A
A98F LD (IY+$03),A
A992 LD (IY+$0F),A Restart the hold timer.
catch_stay_held A995 XOR A Held this frame: clear the request latch and report no bounce.
A996 LD (glue_release_req),A
A999 RET
← A938 Speed the ball up as the rally continues Map A99A → Prize-reveal tune gate
Fork me on GitHub