Ideal
Model Tiny
P186
CodeSeg
Org 100h

Proc        Prog

            mov ax,12h
            int 10h
            mov bx,0A000h
            mov ds,bx
            mov dx,03CEh
            mov ax,0305h
            out dx,ax

Xloop:      cmp bh,150
            ja Xck
            mov ax,si
            shl ax,4
            test al,al
            jnz Xpp
            xor al,al
            out dx,ax
Xpp:        mov ch,80h
            ror ch,cl
            xchg [bx],ch
Xck:        shr cl,1
            adc bx,bx
            jnc Xlb
            xor cl,7
            xor bl,4
Xlb:        dec si
            jnz Xloop

            mov si,-100
            mov ah,1
            int 16h
            jz Xloop

            mov ax,3
            int 10h
            ret

EndP        Prog

End Prog
