It appears that most programmers have problems detecting collision between sprites, sometimes the boundary-box is too big, sometimes at certain side there is a lack of collision.
Anyway, here is a routine that does collision detection, it is used with excellent results in Zombie Near.
In this case, IX points to data for first sprite, IY points to data for second sprite. We suppose that sprites are centered (i.e. a bullet is exactly at center of sprite drawing, same for ship/enemy)
We load register C with size of box, by example, a 4x4 bullet against a ship of 16x16 pixels would use 12 pixels. But if we are checking 16x16 square versus another 16x16 square, we would use 16 pixels.
In the case of Zombie Near, the collision check between zombies and player are 12 pixels and everybody founds it great
The structure of code makes it ideal to use IX to point to a list of sprites, B for size of list and IY to point to the bullet/player/zombie/ship.
d_x: equ 0
d_y: equ 1
.5: cp c
.6: cp c
; here we have a collision...