Prev: AA15 Up: Map Next: AA37
AA27: Reverse And Halve Speed
Used by the routines at BounceHorizontally and BounceVertically.
Used to make the ship rebound. The bytes of the speed are swapped into HL, the speed is negated and halved, a speed that is close to zero is set to zero, and the bytes are swapped back.
Input
HL Speed
Output
HL New speed
ReverseAndHalveSpeed AA27 LD A,H A=H.
AA28 LD H,L H=L.
AA29 LD L,A L=A.
AA2A CALL NegateNumber Call NegateNumber.
AA2D CALL HalveNumber Call HalveNumber.
AA30 CALL ZeroSmallSpeed Call ZeroSmallSpeed.
AA33 LD A,H A=H.
AA34 LD H,L H=L.
AA35 LD L,A L=A.
AA36 RET Return.
Prev: AA15 Up: Map Next: AA37