Prev: 9A75 Up: Map Next: 9AA7
9A86: Polar x distance
Input
A Polar x1
B Polar x2
polar_x_distance 9A86 LD (temp_polar_x),A Store polar x1
9A89 SUB B Polar x1 - polar x2
9A8A JR NC,polar_x_distance_0 Jump ahead of >= 0
9A8C NEG Else make positive
polar_x_distance_0 9A8E CP $20 Is it < 32?
9A90 RET C Then return
9A91 LD A,(temp_polar_x) Restore polar x1
9A94 CP $20 Is it >= 32?
9A96 JR NC,polar_x_distance_1 Then skip ahead
9A98 ADD A,$40 Else add 64
polar_x_distance_1 9A9A LD C,A Store in C
9A9B LD A,B Get polar x2
9A9C CP $20 Is it >= 32?
9A9E JR NC,polar_x_distance_2 Then skip ahead
9AA0 ADD A,$40 Else add 64
polar_x_distance_2 9AA2 SUB C Subtract the modified polar x1
9AA3 RET NC Return if >= 0
9AA4 NEG Else make positive
9AA6 RET And return
Prev: 9A75 Up: Map Next: 9AA7