Program CircleDemo; Const NoRows = 200; NoCols = 320; XMax = NoCols shr 1; XMin = -XMax + 1; YMax = NoRows shr 1; YMin = -YMax + 1; Type ScreenType = Record Width:Word; end; Var Screen:ScreenType; ScreenY:Array[0..199] of Word; Procedure CalcScreenY(Width:Word); Var I:Integer; begin for I:=0 to 199 do ScreenY[I]:=I * Width; end; Procedure SetPixel(X, Y:Word; Color:Word); begin Mem[$A000:Y shl 8 + Y shl 6 + X]:=Color; end; Procedure Circle(X0, Y0, R:Integer); Var X, Y, S:Integer; Xx, Yy:Array[1..8] of Integer; K:Word; begin if (X0 + R > XMax) or (X0 - R < XMin) or (Y0 + R > YMax) or (Y0 - R < YMin) then Exit; SetPixel(X0 + R, Y0, 15); SetPixel(X0 - R, Y0, 15); SetPixel(X0, Y0 + R, 15); SetPixel(X0, Y0 - R, 15); X:=R; Y:=0; S:=3 - 2 * R; for K:=1 to 4 do begin Yy[K]:=Y0; Xx[4 + K]:=X0; end; Xx[1]:=X0 + R; Xx[2]:=Xx[1]; Xx[3]:=X0 - R; Xx[4]:=Xx[3]; Yy[5]:=Y0 + R; Yy[6]:=Y0 - R; Yy[7]:=Yy[5]; Yy[8]:=Yy[6]; While Y < X - 1 do begin Inc(Yy[1]); Yy[3]:=Yy[1]; Dec(Yy[2]); Yy[4]:=Yy[2]; Inc(Xx[5]); Xx[6]:=Xx[5]; Dec(Xx[7]); Xx[8]:=Xx[7]; if S <= 0 then S:=S + Y shl 2 + 6 else begin S:=S + (Y - x) shl 2 + 10; Dec(X); Dec(Xx[1]); Xx[2]:=Xx[1]; Inc(Xx[3]); Xx[4]:=Xx[3]; Dec(Yy[5]); Yy[7]:=Yy[5]; Inc(Yy[6]); Yy[8]:=Yy[6]; end; inc(Y); if X = Y then for K:=1 to 4 do SetPixel(Xx[K], Yy[K], 15) else for K:=1 to 8 do SetPixel(Xx[K], Yy[K], 15); end; end; begin asm mov ax, 0013h int 10h push 320 call CalcScreenY end; Circle(140, 60, 20); ReadLn; asm mov ax, 0003h int 10h end; end.