
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; DATA
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
align 4
d9frametbl      dd      cspr18,cspr19,cspr19,cspr1a,cspr1a,cspr1b,cspr1b,cspr1c
                dd      cspr1d,cspr1e,cspr1e,cspr1f,cspr1f,cspr20,cspr20,cspr21

d9leafx         label   word
temp0=152
temp1=187
rept 24
                dw      temp0
  temp0=temp0+temp1
  if temp0 gt 333
    temp0=temp0-334
    temp1=temp1-17
  endif
endm
d9leafy         label   byte
temp0=137
temp1=167
rept 24
                db      temp0
  temp0=temp0+temp1
  if temp0 gt 209
    temp0=temp0-210
    temp1=temp1-11
  endif
endm

d9dphase        db      0,0

d9cntr          db      0f0h
d9num           db      0
d9numd          db      1

;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; CODE
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±

;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
p90:
        mov al,d9cntr
        dec al
        jnz short p90f0
        mov d9cntr,0f0h
        mov d9num,0
        mov d9numd,1
        mov edi,offset d9frametbl
        mov ecx,8
p90l1:
        mov eax,[edi]
        xchg eax,[edi+4*8]
        stosd
        loop p90l1
        jmp setnext
p90f0:
        mov d9cntr,al
        mov bh,d9num
        mov bl,d9numd
        cmp al,23
        jne short p90f1
        mov bl,-1
        mov d9numd,bl
p90f1:

        add bh,bl
        jz short p90f2
        cmp bh,23
        jb short p90f3
p90f2:
        mov d9numd,0
p90f3:
        mov d9num,bh

        mov cx,word ptr d9dphase
        add cl,7
        add ch,13
        mov word ptr d9dphase,cx

        movzx esi,bh
p90l0:
        movzx ebx,d9leafy[esi]
        mov eax,offset sincos0
        mov al,cl
        add al,bl
        mov al,[eax]
        shr al,6
        add al,1
        add bl,al
        cmp bl,210
        jb short p90l0f0
        sub bl,210
p90l0f0:
        mov d9leafy[esi],bl

        imul edi,ebx,100
        add edi,_vidptr

        movzx ebx,d9leafx[esi*2]
        mov al,ch
        add al,bl
        movzx eax,byte ptr [eax]
        shr al,5
        movzx edx,al
        shr al,1
        add al,1
        sub ebx,eax
        jnc short p90l0f1
        add ebx,334
p90l0f1:
        mov d9leafx[esi*2],bx

        sub ebx,13
        mov eax,ebx
        sar eax,2
        lea edi,[edi+eax-9*100]
        and ebx,3
        mov al,vidbittbl2[ebx]

        mov ebx,d9frametbl[edx*4]
        mov dx,3c5h
        call ebx
p90l0c:
        add cx,11bh
        sub esi,1
        jnc p90l0

        ret

