Prev: 50622 Up: Map Next: 50665
50643: 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 50643 LD A,(IX+3) Fetch the z position of the first object.
50646 ADD A,H Add H.
50647 SUB (IY+3) Subtract the z position of the second object.
50650 JP P,TestOverlapInZ_Second Jump to TestOverlapInZ_Second if the sign flag is clear.
50653 NEG Negate A.
50655 LD D,(IX+6) Fetch the height of the first object.
TestOverlapInZ_Compare 50658 SUB D Subtract D.
50659 RET Return.
TestOverlapInZ_Second 50660 LD D,(IY+6) Fetch the height of the second object.
50663 JR TestOverlapInZ_Compare Jump to TestOverlapInZ_Compare.
View the equivalent code in;
Prev: 50622 Up: Map Next: 50665