Prev: 8C05 Up: Map Next: 8C58
8C3F: Keep a velocity within the speed limit
Used by the routine at accelerate.
A positive velocity of more than n.0 becomes n.0; a negative one below -n becomes -n.0 (n from speed_limit).
Input
HL The velocity
Output
HL The velocity, limited
limit_speed 8C3F BIT 7,H Positive: no more than n
8C41 JR NZ,limit_speed_0
8C43 LD A,(speed_limit)
8C46 DEC A
8C47 CP H
8C48 RET NC
8C49 INC A
8C4A LD H,A
8C4B LD L,$00
8C4D RET
limit_speed_0 8C4E LD A,(speed_limit_down) Negative: no less than -n
8C51 CP H
8C52 RET C
8C53 INC A
8C54 LD H,A
8C55 LD L,$00
8C57 RET
Prev: 8C05 Up: Map Next: 8C58