Obj_Hit ($F8FF)

Thit routine checks to see if a missile hashit an object. If the missile has hit the object, then the carry bit will be set; otherwise, the carry bit will be cleared. A hit is checked for in the following fashion:

if (object y-height/2) <= missile y <= (object y+height/2)

and

(object x-width/2) <= missile x <= (object x+width/x)

then the missile hit, otherwise it missed.

 

ENTRY:

Y-reg = (y,x) position of the object

X-reg = (y,x) position of the missile

D-reg = (h/2,w/2) size of object

 

EXIT:

Carry bit set if the object & missile have collided

All registers preserved.

 

Source