Prev: C065 Up: Map Next: C083
C069: Is the thing at IX less than C cells from the knight?
Compares cells only, the columns and the rows: carry if both differences are less than C. Used with C = 2 (his own cell or a neighbour), 3, 4 and 5, to decide what is near enough to matter -- and what is far enough to be forgotten.
Input
IX the record
C the limit, in cells
Output
F carry if near
NEAR_KNIGHT C069 LD A,(KNIGHT_COLUMN) the columns: not near, no carry
C06C SUB (IX+$02)
C06F JP P,NEAR_KNIGHT_0
C072 NEG
NEAR_KNIGHT_0 C074 CP C
C075 RET NC
C076 LD A,(KNIGHT_ROW) the rows: carry if near
C079 SUB (IX+$04)
C07C JP P,NEAR_KNIGHT_1
C07F NEG
NEAR_KNIGHT_1 C081 CP C
C082 RET
Prev: C065 Up: Map Next: C083