home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG013.ARC
/
PLOTI2.PRO
< prev
next >
Wrap
Text File
|
1979-12-31
|
2KB
|
62 lines
procedure PLOT(x1,y1,x2,y2 : integer);
{ Procedure developed in Turbo Pascal
for the MicroBee by Bob Burt }
{ This version written using integer
variables, but with a switch to real
variable for the x axis if the
coordinate value exceeds 128. This
speeds up the plotting rate by a
factor of at least 3 }
label 99;
var
dx,dy,x,y,xi,yi : integer;
x_real : real;
count : integer;
begin
dx := x2 - x1;
dy := y2 - y1;
if (dx = 0) and (dy = 0) then
begin
xi := 0; yi := 0; count := 1; goto 99
end; {if}
if abs(dx) > abs(dy) then
begin
xi := 256; count := abs(dx) + 1; yi := abs(dy*256 div dx)
end; {if}
if abs(dx) <= abs(dy) then
begin
yi := 256; count := abs(dy) + 1; xi := abs(dx*256 div dy)
end; {if}
if abs(dx) <> ((count - 1)*xi div 256) then xi := xi + 1;
if abs(dy) <> ((count - 1)*yi div 256) then yi := yi + 1;
99 :
if dx < 0 then mem[addr(draw)+11] := 1
else mem[addr(draw)+11] := 0;
if dy < 0 then mem[addr(draw)+12] := 1
else mem[addr(draw)+12] := 0;
y := y1*256;
if x1 > 128 then
begin
x_real := x1*256;
mem[addr(draw)+2] := trunc(x_real - int(x_real/256)*256);
mem[addr(draw)+3] := trunc(x_real/256)
end
else
begin
x := x1*256;
mem[addr(draw)+2] := x - (x div 256)*256;
mem[addr(draw)+3] := x div 256
end;
mem[addr(draw)+4] := y - (y div 256)*256;
mem[addr(draw)+5] := y div 256;
mem[addr(draw)+6] := xi - (xi div 256)*256;
mem[addr(draw)+7] := xi div 256;
mem[addr(draw)+8] := yi - (yi div 256)*256;
mem[addr(draw)+9] := yi div 256;
mem[addr(draw)+10] := count;
draw
end; {procedure plot}