.model small .stack 256h video equ 0b800h .data save_di dw ? incr dw 1 .code .386 start proc near mov ax, @data mov ds, ax mov ax, video mov es, ax mov ax, 4 int 10h ;sets at medium resolution mov ah, 0ch int 21h xor si, si xor dx, dx call paint_back mov di, 4 ;to begin the figure at the first even line redraw: mov save_di,di mov al,055h call drawball mov ah,1 int 21h cmp al,'x' je dosRet mov al,0aah ;call drawball call paint_back mov di,save_di ;inc di add di,incr cmp di,10 jle cont cmp di,4 jge cont neg incr ;;;input cont: ;mov dl, 0ffh ;mov ah,6 ;int 21h ;jnz dosRet jmp redraw done: mov ah,1 int 21h dosRet: mov ax, 2 int 10h mov ax, 4c00h int 21h start endp pause proc push cx mov cx,32000 pusha popa pop cx ret pause endp paint_back proc xor di, di ;start di at first even line mov cx,1f40h mov al, 0aah rep stosb mov di, 2000h mov cx,1f40h rep stosb ret paint_back endp drawball proc mov di,save_di ;restore the starting position mov cx, 1 rep stosb ;second even line add di, 78 mov cx, 3 rep stosb add di, 76 ;third even line mov cx, 5 rep stosb add di, 76 mov cx, 3 rep stosb add di, 78 mov cx, 1 rep stosb mov di,save_di add di, 2000h ;first odd line mov cx, 1 rep stosb add di, 78 ;second odd line mov cx, 3 rep stosb add di, 76 ;third odd line mov cx, 5 rep stosb add di, 76 mov cx, 3 rep stosb add di, 78 mov cx, 1 rep stosb ret drawball endp end start