Prev: E028 Up: Map Next: E087
E063: Does the moved object run into a box of a cell? Give the overlap in U
Used by the routines at CUT_STEP_PLUS_U and CUT_STEP_MINUS_U.
The cell's boxes come from BOX_TABLE by its type: four bytes a box -- its centre in U and V and its half-sizes in U and V, in the cell's half units (PLACE_IN_CELL) -- and a list ends at a 0. A box is hit when the object's footprint, moved by this turn's step, overlaps it in V (OVERLAP_V) and in U (OVERLAP_U). The first box hit returns carry, with A minus the depth of the overlap in U, in half units. HIT_BOXES_V is the same with the two tests the other way round, to give the overlap in V.
Input
D The column of the cell
H Its row
IX The object
Output
A Minus the overlap in U, in half units (when carry is set)
F Carry set if a box is hit
HIT_BOXES_U E063 CALL PLACE_IN_CELL Find the cell's type and the object's place in it
E066 LD BC,BOX_TABLE IY = the type's list of boxes
E069 CALL TABLE_WORD
E06C PUSH HL
E06D POP IY
HIT_BOXES_U_0 E06F LD A,(IY+$00) A 0 ends the list: nothing hit, carry clear
E072 AND A
E073 RET Z
E074 CALL OVERLAP_V Overlapping this box in V?
E077 JR NC,HIT_BOXES_U_1
E079 CALL OVERLAP_U ...and in U: then return carry, with the overlap in U
E07C RET C
HIT_BOXES_U_1 E07D INC IY The next box
E07F INC IY
E081 INC IY
E083 INC IY
E085 JR HIT_BOXES_U_0
Prev: E028 Up: Map Next: E087