
;****************************
;*** CHECK IF IT IS SOLID ***
;****************************
; BC = position (B=Y , C=X)
; return MASTER in A and set Carry if solid else no carry
;
.COLL_CheckPosition
	push HL
	ld A,B
	add A ;*2
	add ATTR_Addr_low
	ld L,A
	ld H,ATTR_Addr_High	;HL point on address for Y
	ld A,(HL)
	inc L
	ld H,(HL)
	add C ;do not forget to add X to array address
	ld L,A
	bit 7,(HL)	;check solid bit on attribute
	jr z,COLL_CheckPositionNoCollision

	inc H	;bank
	inc H	;low addr
	inc H	;high addr
	inc H	;master
	
	ld A,(HL)
	pop HL
	scf	;set carry
	ret
	
.COLL_CheckPositionNoCollision
	pop HL
	xor A	;reset carry
	ret
	
;****************************
;*** CHECK IF IT IS SOLID ***
;****************************
; BC = position (B=Y , C=X)
; return MASTER in A and set Carry if solid else no carry
; same as prévious but return cell address in DE
.COLL_CheckPositionDE
	push HL
	ld A,B
	add A ;*2
	add ATTR_Addr_low
	ld L,A
	ld H,ATTR_Addr_High	;HL point on address for Y
	ld A,(HL)
	inc L
	ld H,(HL)
	add C ;do not forget to add X to array address
	ld L,A
	bit 7,(HL)	;check solid bit on attribute
	jr z,COLL_CheckPositionNoCollisionDE

	push HL
	inc H	;bank
	inc H	;low addr
	inc H	;high addr
	inc H	;master
	
	ld A,(HL)
	pop DE
	pop HL
	scf	;set carry
	ret
	
.COLL_CheckPositionNoCollisionDE
	ex DE,HL
	pop HL
	xor A	;reset carry
	ret