Program BresenhamLine; 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 BresenLine(X1, Y1, X2, Y2:Word; Color:Byte); Var DeltaX, DeltaY, Inc1, Inc2, D, X, Y:Integer; begin DeltaX:=X2 - X1; DeltaY:=Y2 - Y1; D:=DeltaY shl 1 - DeltaX; Inc1:=DeltaY shl 1; Inc2:=(DeltaY - DeltaX) shl 2; X:=X1; Y:=Y1; SetPixel(X, Y, Color); While X < X2 do begin if D < X1 then begin Inc(D, Inc1); Inc(X); end else begin Inc(D, Inc2); Inc(X); Inc(Y); end; SetPixel(X, Y, Color); end; end; begin asm mov ax, 0013h int 10h push 320 call CalcScreenY end; BresenLine(0, 0, 319, 199, 15); ReadLn; asm mov ax, 0003h int 10h end; end.