;DRAW SPRITES PATTERN to VRAM

;DrawPatternSprites sprite,idspritepattern,nsprites 

func_drawpatternsprites:

push hl
push de

ld hl,($cb06)

or a
jr z,drawpatternsprites_2

ld b,a
ld de,32

drawpatternsprites_1:

add hl,de
djnz drawpatternsprites_1

drawpatternsprites_2:

ld a,($cb08)

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

pop de
pop hl

ld a,d
or a
ret z

ld a,(7)
ld c,a

drawpatternsprites_3:

ld b,32
otir

dec d
jr nz,drawpatternsprites_3

ret

