home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug013.arc
/
PLOT.PRO
< prev
next >
Wrap
Text File
|
1979-12-31
|
2KB
|
52 lines
procedure PLOT(x1,y1,x2,y2 : real);
{ Procedure developed in Turbo Pascal to
PLOT in LORES Graphics on the MicroBee
by Bob Burt }
{ This version uses real variables and so
is suitable to operate for both 64 X 16
and 80 X 24 screens, but is slower than
PLOTI.PRO (integer version for 64 X 16
screens) and PLOTI2.PRO (mixed real/
integer version for 80 X 24 screens }
label 99;
var
dx,dy,x,y,xi,yi : 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 := trunc(abs(dx) + 1); yi := abs(dy*256/dx)
end; {if}
if abs(dx) <= abs(dy) then
begin
yi := 256; count := trunc(abs(dy) + 1); xi := abs(dx*256/dy)
end; {if}
if abs(dx) <> (count - 1)*xi/256 then xi := xi + 1;
if abs(dy) <> (count - 1)*yi/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;
x := x1*256; y := y1*256;
mem[addr(draw)+2] := trunc(x - int(x/256)*256);
mem[addr(draw)+3] := trunc(x/256);
mem[addr(draw)+4] := trunc(y - int(y/256)*256);
mem[addr(draw)+5] := trunc(y/256);
mem[addr(draw)+6] := trunc(xi - int(xi/256)*256);
mem[addr(draw)+7] := trunc(xi/256);
mem[addr(draw)+8] := trunc(yi - int(yi/256)*256);
mem[addr(draw)+9] := trunc(yi/256);
mem[addr(draw)+10] := count;
draw
end; {procedure plot}