Prev: C36D Up: Map Next: C38F
C386: Shorten a move by one unit
Moves A one step towards zero -- down if positive, up if negative -- and leaves Z set if nothing is left. Every loop in the collision code uses it to cut a move short a unit at a time and try again.
Input
A a dU, dV or dZ
Output
A one unit closer to zero; Z set if zero
SHORTEN_DELTA C386 AND A Already zero
C387 RET Z
C388 JP P,SHORTEN_DELTA_DEC Negative: +2 here and -1 below
C38B INC A
C38C INC A
SHORTEN_DELTA_DEC C38D DEC A The step down that sets Z
C38E RET
Prev: C36D Up: Map Next: C38F