Prev: 50601 Up: Map Next: 50643
50622: Test Overlap In Y
Tests whether two objects overlap along y, once the first has moved by its new speed along y. They overlap when the distance between the y positions is smaller than the two depths added together.
Input
L New speed along y 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
Compare the y distance with the depths.
TestOverlapInY 50622 LD A,(IX+5) Fetch the depth of the first object.
50625 ADD A,(IY+5) Add the depth of the second object.
50628 LD D,A Copy the total to D.
50629 LD A,(IX+2) Fetch the y position of the first object.
50632 ADD A,L Add L.
50633 SUB (IY+2) Subtract the y position of the second object.
50636 JP P,TestOverlapInY_Compare Jump to TestOverlapInY_Compare if the sign flag is clear.
50639 NEG Negate A.
TestOverlapInY_Compare 50641 SUB D Subtract D.
50642 RET Return.
View the equivalent code in;
Prev: 50601 Up: Map Next: 50643