Prev: B9EC Up: Map Next: BA21
BA0B: Zero Small Speed
Sets a speed to zero if it is too small to matter. The speed is a signed number, which is changed if it is below 64 or above FF58.
Input
HL Speed
Output
HL New speed
ZeroSmallSpeed BA0B LD A,H A=H.
BA0C AND A Jump to ZeroSmallSpeed_Negative if A is not zero.
BA0D JR NZ,ZeroSmallSpeed_Negative
BA0F LD A,L A=L.
BA10 CP $64 Return if A is 64 or more.
BA12 RET NC
BA13 LD HL,$0000 HL=00.
BA16 RET Return.
ZeroSmallSpeed_Negative BA17 INC A Advance A.
BA18 RET NZ Return if the zero flag is clear.
BA19 LD A,L A=L.
BA1A CP $58 Return if A is less than 58.
BA1C RET C
BA1D LD HL,$0000 HL=00.
BA20 RET Return.
Prev: B9EC Up: Map Next: BA21