Prev: 661D Up: Map Next: 6633
6628: Reduce Car Y Position
Used by the routine at HandlerCar.
Continues HandlerCar when the car is moving towards lower Y positions. Takes the distance away from the Y position, stopping at zero.
Input
DE Y position of the car
HL Distance to move
ReduceCarY 6628 EX DE,HL Swap DE and HL so that HL is the Y position and DE is the distance.
6629 AND A Reset the carry flag.
662A SBC HL,DE HL=HL - DE.
662C JR NC,HandlerCar_StoreY If the result is not negative then jump to HandlerCar_StoreY.
662E LD HL,$0000 HL=0000 (stop at zero).
6631 JR HandlerCar_StoreY Jump to HandlerCar_StoreY.
Prev: 661D Up: Map Next: 6633