Prev: C5BE Up: Map Next: C5E9
C5D3: Test Overlap In Z
Tests whether two objects overlap along z, once the first has moved by its new speed along z. They overlap when the distance between the z positions is smaller than the height of whichever of the objects is lower.
Input
H New speed along z of the first object
IX The address of the first object
IY The address of the second object
Output
F Carry flag set if the objects overlap
Use the height of the lower object.
TestOverlapInZ C5D3 LD A,(IX+$03) Fetch the z position of the first object.
C5D6 ADD A,H Add H.
C5D7 SUB (IY+$03) Subtract the z position of the second object.
C5DA JP P,TestOverlapInZ_Second Jump to TestOverlapInZ_Second if the sign flag is clear.
C5DD NEG Negate A.
C5DF LD D,(IX+$06) Fetch the height of the first object.
TestOverlapInZ_Compare C5E2 SUB D Subtract D.
C5E3 RET Return.
TestOverlapInZ_Second C5E4 LD D,(IY+$06) Fetch the height of the second object.
C5E7 JR TestOverlapInZ_Compare Jump to TestOverlapInZ_Compare.
View the equivalent code in;
Prev: C5BE Up: Map Next: C5E9