org 100h
        mov al,13h
        int 10h

        push word 0a000h
        pop es

main:
        xor di,di

        push dx

        shl dx,4
        xor si,si
        mov word [cs:si + posX + 1],dx

        mov bp,200
yloop:
        mov cx,320
xloop:

zoom:
        mov bx,16

        mov si,127
recurse:

        mov ax,si
        and ax,15
        cmp ax,8
        jnc noVertBlock

        mov ax,100
        sub ax,bp

        imul bx

        shr ax,4
posY:
        cmp ax,100
        jc noVertBlock
        cmp bp,100
        jnc noVertBlock

        mov ax,cx
        sub ax,160

        imul bx

        shr ax,3
posX:
        add ax,WORD 0

        cmp al,128
        jc finish
noVertBlock:
        inc bx
        dec si
        jnz recurse
finish:
        mov ax,si

        jnz cityblock
        mov ax,bp
        add ax,820

cityblock:
        shr ax,3
        add al,16

        stosb

        loop xloop

        dec bp
        jnz yloop


        mov dx,3dah
vsync:
        in al,dx
        and al,8
        jz vsync

        pop dx
        inc dx

        xor ah,ah
        in al,60h
        dec al
        jnz main

        mov ax,03h
        int 10h
ret
