func_setspriteaddress:

;SET TABELLA ATTRIBUTI SPRITES  -> AHL -> $cb00-$cb02
ld a,($f3e4)
and 252
or 4
ld e,a
ld a,($ffea)
ld d,a

ld hl,0
ld b,128
xor a
setspriteaddress_1:
adc hl,de
adc a,0
djnz setspriteaddress_1
and 1
ld ($cb00),hl
ld ($cb02),a

;SET TABELLA COLORI SPRITES -> AHL -> $cb03-$cb05
ld de,512
sbc hl,de
sbc a,0
and 1
ld ($cb03),hl
ld ($cb05),a

;SET TABELLA MODELLI SPRITES -> AHL -> $cb06-$cb08
ld de,2048
ld hl,0
ld a,($f3e5)
ld b,a
xor a
setspriteaddress_2:
adc hl,de
adc a,0
djnz setspriteaddress_2
and 1
ld ($cb06),hl
ld ($cb08),a

ret