;DRAW SPRITES COLOR to VRAM

;DrawColorSprites sprite,idspritepattern,nsprites 

func_drawcolorsprites:

push hl
push de

ld hl,($cb03)

or a
jr z,drawcolorsprites_2

ld b,a
ld de,16

drawcolorsprites_1:

add hl,de
djnz drawcolorsprites_1

drawcolorsprites_2:

ld a,($cb05)

rlc h
rla
rlc h
rla
srl h
srl h
di
out ($99),a
ld a,142
out ($99),a
ld a,l
out ($99),a
ld a,h
or 64
ei
out ($99),a

ld a,d
or a
ret z

pop de
pop hl

ld a,(7)
ld c,a

drawcolorsprites_3:

ld b,16
otir

dec d
jr nz,drawcolorsprites_3

ret

