Prev: 35845 Up: Map Next: 35928
35903: Limit Speed To Range
Used by the routine at AccelerateObject.
Limits a speed to the range set by AccelerateObject.
Input
HL Speed
Output
HL Limited speed
LimitSpeedToRange 35903 BIT 7,H Jump to LimitSpeedToRange_Negative if it is negative.
35905 JR NZ,LimitSpeedToRange_Negative
35907 LD A,(35843) Fetch the positive limit from 35843.
35910 DEC A Subtract one.
35911 CP H Compare it with the high byte of the speed.
35912 RET NC Return if the speed is within the limit.
35913 INC A Restore the limit...
35914 LD H,A ...and use it as the speed.
35915 LD L,0 Clear the low byte of the speed.
35917 RET Return.
LimitSpeedToRange_Negative 35918 LD A,(35844) Fetch the negative limit from 35844.
35921 CP H Compare it with the high byte of the speed.
35922 RET C Return if the speed is within the limit.
35923 INC A Add one to the limit...
35924 LD H,A ...and use it as the speed.
35925 LD L,0 Clear the low byte of the speed.
35927 RET Return.
Prev: 35845 Up: Map Next: 35928