.286
.model small
.code
org 100h
start:
		mov ax, 13h
		int 10h
		mov ax, 0a000h
		mov es, ax
;----------------------------------
		mov X, 0
		mov ax, rad
		mov Y, ax
		mov sum, 0
writeloop:	mov ax, x
		add ax, x0
		push ax
		mov ax, y0
		sub ax, y
		push ax
		push 5
		call plotpixel
	      	inc x
		mov ax, x
		add sum, ax
		mov ax, y
		cmp sum, ax
		jl endloop
		mov ax, y
		sub sum, ax
		dec y
endloop:        mov ax, rad
		cmp x, ax
		jle writeloop
		mov ah, 08h
		int 21h
		mov ax, 3
		int 10h
		int 20h
;----------------------------------------------
x0	dw	100
y0	dw	100
x	dw	?
y	dw	?
rad	dw	20
sum 	dw	?
;-----------------------------------------------
plotpixel	PROC NEAR
	PUSH BP
	MOV BP,SP
plotcol equ word ptr [bp+4]
ploty	equ word ptr [bp+6]
plotx	equ word ptr [bp+8]
	push ax
	push bx
	push si
	mov ax, ploty
	mov bx, ax
	shl ax, 8
	shl bx, 6
	add ax, bx
	add ax, ploty
	mov si, ax
	mov ax, plotcol
	mov es:[si], al
	pop si
	pop bx
	pop ax
	pop bp
	ret 6
ENDP

end start