Prev: 52402 Up: Map Next: 52445
52423: 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 52423 LD A,(IX+3) Fetch the z position of the first object.
52426 ADD A,H Add H.
52427 SUB (IY+3) Subtract the z position of the second object.
52430 JP P,TestOverlapInZ_Second Jump to TestOverlapInZ_Second if it is not negative.
52433 NEG Negate A.
52435 LD D,(IX+6) Fetch the height of the first object, which is the lower.
TestOverlapInZ_Compare 52438 SUB D Take the height off it, which sets the carry flag if the objects overlap.
52439 RET Return.
TestOverlapInZ_Second 52440 LD D,(IY+6) Fetch the height of the second object, which is the lower.
52443 JR TestOverlapInZ_Compare Jump to TestOverlapInZ_Compare.
View the equivalent code in;
Prev: 52402 Up: Map Next: 52445