Prev: E063 Up: Map Next: E0A0
E087: Do the moved object and a box overlap in U?
Used by the routines at HIT_BOXES_U and HIT_BOXES_V.
A = |the object's U + half its step - the box's centre| less (half the object's half-size + the box's half-size), all in the cell's half units. That is negative, with carry set, when the two overlap, and it is then minus the depth of the overlap.
Input
E The object's U in the cell (PLACE_IN_CELL)
IX The object
IY The box
Output
A The gap between them, negative for an overlap
F Carry set if they overlap
OVERLAP_U E087 LD A,(IX+$08) C = the object's half-size in U, halved, plus the box's
E08A SRL A
E08C ADD A,(IY+$02)
E08F LD C,A
E090 LD A,(IX+$0A) The object's U after half its step, less the box's centre
E093 SRA A
E095 ADD A,E
E096 SUB (IY+$00)
E099 JP P,OVERLAP_U_0 Made positive
E09C NEG
OVERLAP_U_0 E09E SUB C Less the two half-sizes: carry if they overlap
E09F RET
Prev: E063 Up: Map Next: E0A0