;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;This is the bitmap intersection routine I use in XC-1701.
;It tests wether the bitmap at (H,L) collides with the ship at (D,E)
;If so, Carryflag is set
;
;As XC-1701 is my first program for ZShell, this routine is not optimized.
;If you find a way to do this faster, please write me a letter:
; Andreas Ess
; Tufers 156
; A-6811 Goefis
; Austria/Europe
;
;Please give me an appropriate credit if you use this peace of code.
; Thanx, Andreas
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

;-----------------------------------------------------------------------------
;BitmapInter: Collision between to 8x8 bitmaps? yes -> Carryflag = 1 (v1.1)
; (H,L) contains position of 1st, (B,C) of second bitmap
;-----------------------------------------------------------------------------
BitmapInter:
 ld    a, b     ;compute absolute amount of overlap
 sub   h
 bit   7, a
 jr    z, GoOnTesting
 neg
GoOnTesting:
 cp    9   		;test X-Overlap
 jr    nc, NoColl1
 ;X-Test succeeded, but what about Y?
 ld    a, c
 sub   l
 bit   7, a
 jr    z, GoOnTesting1
 neg
GoOnTesting1:
 cp    9
 jr    nc, NoColl1
 scf            ;set carry flag -> collision occured
 ret
NoColl1:
 or    a 	;clear carry flag
 ret
