Prev: C89A Up: Map Next: C8D2
C8AD: Is an object near a point?
Used by the routines at HANDLE_EXIT_SCREEN and ARCH_NUDGE_TO_CENTRE.
Carry set if the object's U, V and Z are all within the limits of the point: strictly less than L in U, H in V and 4 in Z. As Knight Lore's.
Input
IX A record whose +$09 to +$0B hold the point's U, V and Z
IY The object
L The limit in U
H The limit in V
Output
F Carry set if near
IS_NEAR_TO C8AD LD A,(IX+$09) U
C8B0 SUB (IY+$01)
C8B3 JR NC,IS_NEAR_TO_0
C8B5 NEG
IS_NEAR_TO_0 C8B7 CP L
C8B8 RET NC
C8B9 LD A,(IX+$0A) V
C8BC SUB (IY+$02)
C8BF JR NC,IS_NEAR_TO_1
C8C1 NEG
IS_NEAR_TO_1 C8C3 CP H
C8C4 RET NC
C8C5 LD A,(IX+$0B) Z: within 4 sets the carry
C8C8 SUB (IY+$03)
C8CB JR NC,IS_NEAR_TO_2
C8CD NEG
IS_NEAR_TO_2 C8CF CP $04
C8D1 RET
Prev: C89A Up: Map Next: C8D2