Prev: 45856 Up: Map Next: 45878
45858: Limit Vertical Speed
Used by the routine at UpdateShipSpeeds.
Keeps the vertical speed of the ship within its limits: no faster than 253 downwards, and no faster than half the value at VerticalLimit upwards.
Input
HL Vertical speed
Output
HL Limited vertical speed
LimitVerticalSpeed 45858 LD A,H A=H.
45859 BIT 7,A Jump to LimitVerticalSpeed_Up if bit 7 of A is clear.
45861 JR Z,LimitVerticalSpeed_Up
45863 CP 254 Return if A is 254 or more.
45865 RET NC
45866 LD H,253 H=253.
45868 RET Return.
LimitVerticalSpeed_Up 45869 LD A,(23615) The vertical scroll limit.
45872 SRL A Shift A right.
45874 CP H Return if A is H or more.
45875 RET NC
45876 LD H,A H=A.
45877 RET Return.
Prev: 45856 Up: Map Next: 45878