Prev: 47442 Up: Map Next: 47459
47450: Bring Speed Closer To Zero
Moves a signed value one step closer to zero.
Input
A Value
Output
A The value, one closer to zero
F Zero flag set if the result is zero
BringSpeedCloserToZero 47450 AND A Return if the value is zero.
47451 RET Z
47452 JP P,BringSpeedCloserToZero_Subtract Jump to BringSpeedCloserToZero_Subtract if the value is positive.
47455 INC A Add two to a negative value...
47456 INC A
BringSpeedCloserToZero_Subtract 47457 DEC A ...and subtract one from a positive value (or one from the two added to a negative value).
47458 RET Return.
View the equivalent code in;
Prev: 47442 Up: Map Next: 47459