program PRDEMO (input,output);

(* Dies ist ein kleines Demonstrationsprogramm *)
(* fuer die Anwendung von TURBO.GRAF. Diese    *)
(* Version zeigt die Verwendung des Treibers   *)
(* auf der NCRGRAF-Ebene                       *)
(*                                             *)
(*      Demoversion 3.0 ( C ) ComSoft          *)
(*      Fuer TURBOGRAF V 3.x / 24.08.84        *)

(*$IB:MGRAF.LIB*)   (* Durch Verwendung von MGRAF wird monochrom selektiert *)
(*$IB:GPRINT2.LIB*) (* EPSON FX 80 als Drucker *)
procedure BEGRUESSUNG(var P:boolean);

var
   C:    char;

begin
ClrScr;
Writeln;Writeln;Writeln;
Writeln ('Demonstration - Program for');
Writeln ('      Turbograf V 3.x');
Writeln (' PRINTER DEMO EPSON FX 80');
Writeln ('       (C) ComSoft');
Writeln;
Writeln ('This DEMO is installed for EPSON FX 80');
Write   ('Do you have such printer type connected ? (Y/N) ');
Read(Kbd,C);
Writeln;
P:=False;
If UpCase(C)='Y' then
   begin
      Writeln ('PRINTING IS RATHER SLOW');
      Write   ('Do you want the demo printed ? (Y/N) ');
      Read(Kbd,C);
      P:=(Upcase(C)='Y');
      Writeln;
   end
else
   Writeln('DEMO is run without printing');
Delay (4000);
ClrScr;
end;

procedure DISTR;
begin
GMODE (0);
SELCHAR (1,1);
SETTEXT (20,0,
    ' Turbograf Vers. 3/ ComSoft D-8901 Stadtbergen 2, Fuggerstr. 4 ',0,0,6);
SELCHAR (1,0);
end;

procedure VIELECK;
var
X   :array[0..18] of integer;
Y   :array[0..18] of integer;

A,B,C :integer;

begin
    for A:=0 to 18 do
       begin
          X[A] := ROUND (((COS ((6.28/360) * A*20)) * 180) + 320);
          Y[A] := ROUND (((SIN ((6.28/360) * A*20)) * 180) + 200);
       end;

    GINIT;
    GMODE (0);
       for B:=0 to 17 do
          for A:=B+1 to 18 do
             begin
                GPOINT (X[B],Y[B]);
                GLINE  (X[A],Y[A]);
             end;
DISTR;
Delay(1500);
end;


procedure CIRCLES;
var A:integer;
begin
A:=180;
GINIT;
repeat
    GPOINT (450-A,290-TRUNC(A/2));
    GCIRCL (A);
    A:=A-3;
until A=3;
DISTR;
end;

procedure BOX;

var M,N    :integer;
    NU     :string[2];

begin
GINIT;
GPOINT (50,350);
GZOOM (2);
GTEXT ('Fast Box Drawing',0);
GPOINT (70,300);
GTEXT ('With 16 Patterns',0);
Delay (600);
GMODE (0);
GZOOM (2);
for N:=0 to 3 do
    for M:=0 to 3 do
       begin
          GPATT(0);
          GZOOM(0);
          GPOINT(30+110*n,230-60*M);
          Str((N*4+M+1):2,NU);
          GTEXT(NU,0);
          GZOOM(2);
          GPATT (N*4+M);
          GPOINT (50+110*N,230-60*M);
          GBOX (22,13,0);
       end;
DISTR;
Delay(1500);
end;

procedure TEXT;

var L,M,N:  integer;
    I,J,A:  integer;

begin
GINIT;
GMODE (0);
GZOOM (1);
GPOINT (50,360);
GTEXT ('10 Graphics Character Sets',0);
GZOOM(0);
for L:=0 to 4 do
    begin
       N:=1;
       for J:=1 to 4 do
           for I:=1 to 32 do
               begin
                  SELCHAR(L,0);
                  GPOINT (10+9*I,345-16*J-70*L);
                  if N<128 then
                     GTEXT (CHR(N),0);
                  SELCHAR(L,1);
                  GPOINT (330+9*I,345-16*J-70*L);
                  if N<128 then
                     GTEXT (CHR(N),0);
                  N:=N+1;
               end;
     end;
SELCHAR(0,0);
Delay(1500);
end;

procedure INOUT;

begin
GINIT;
GZOOM (1);
GPOINT (10,50);
GTEXT ('Read Data from Disk ',0);
READSCREEN ('FELD.PIX');
DISTR;
end;

procedure PRINTIT;

var
   I:   integer;

begin
for I:=1 to 3 do
    Writeln(Lst);
GPRINT;
for I:=1 to 35 do
    Writeln(Lst);
end;

var
   P:   boolean;

begin
BEGRUESSUNG(P);
repeat
   if not KeyPressed then VIELECK;
   if (P and (not KeyPressed)) then PRINTIT;
   if not KeyPressed then CIRCLES;
   if (P and (not KeyPressed)) then PRINTIT;
   if not KeyPressed then BOX;
   if (P and (not KeyPressed)) then PRINTIT;
   if not KeyPressed then TEXT;
   if (P and (not KeyPressed)) then PRINTIT;
   if not KeyPressed then INOUT;
   if (P and (not KeyPressed)) then PRINTIT;
until KeyPressed;
GEXIT;
end.
