
include ivram.inc



dseg

p_counter   dw  0

;pattern     dw  00000h, 08080h, 0C0C0h, 0E0E0h
            dw  0F0F0h, 0F8F8h, 0FCFCh, 0FEFEh
            dw  0FFFFh, 07F7Fh, 03F3Fh, 01F1Fh
            dw  00F0Fh, 00707h, 00303h, 00101h

pattern     dw  00000h, 00080h, 000C0h, 000E0h
            dw  000F0h, 000F8h, 000FCh, 000FEh
            dw  000FFh, 0007Fh, 0003Fh, 0001Fh
            dw  0000Fh, 00007h, 00003h, 00001h


enddseg


cseg

    extrn   ivsa_add_renderer: near

; add_demo_render()

    public _add_demo_render
needeven
_add_demo_render proc near
    center
    push    si
    push    di

    xor     bx, bx              ; bl, bh: x, y
    mov     si, p_counter       ; si: counter

adr_10:
    xor     bl, bl
    mov     cx, IV_CX
adr_20:
    push    bx
    push    cx
    mov     dx, cs:demo_renderer
    mov     ax, si
    call    ivsa_add_renderer
    pop     cx
    pop     bx
    inc     bl
    inc     si
    and     si, 0Fh
    loop    adr_20
    
    inc     bh
    cmp     bh, IV_CY
    jb      adr_10

adr_next:
    mov     ax, p_counter
    inc     ax
    and     ax, 0Fh
    mov     p_counter, ax

adr_ret:
    pop     di
    pop     si
    cleave
    ret    
_add_demo_render endp


; for demo

demo_renderer proc near
    mov     bx, ax
    shl     bx, 1
    mov     si, offset pattern
    mov     cx, 2
    mov     dx, 1Fh
    rept 8
        mov ax, es:[di]
        or  ax, [si + bx]
        add bx, cx
        and bx, dx
        stosw        
    endm
    ret
demo_renderer endp



endcseg


    end
