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 / CPM / TURBOPAS / TRUN.LBR / TRUN31.PQS / TRUN31.PAS
Pascal/Delphi Source File  |  2000-06-30  |  4KB  |  91 lines

  1.  
  2. Program TRUN;
  3.  
  4.  
  5. {           TRUN runs a program specified on the command line.
  6.  
  7.     This version will work ONLY with Turbo Pascal vers 3.0.  It should
  8.     work with either CP/M  or  MS-DOS.  For earlier versions of Turbo,
  9.     TRUN v. 2.8 uses a  different algorithm to parse the command line.
  10.  
  11.                  (c) July, 1985 by Mike Dingacci, MD
  12.  
  13.                 Program is hereby placed in the public
  14.                 domain.  It may be used by  anyone for
  15.                 any purpose. The author will accept no
  16.                 responsibility for the accuracy of the
  17.                 software,  nor for any problems  which
  18.                 may result from its use.       - RMD -
  19.  
  20.                 Comments or
  21.                 questions to:    P.O. Box 1124
  22.                                  Fallon, Nevada  89406
  23. }
  24. Var
  25.  
  26.   Cmdline,Cmd          : String[127];
  27.   Cmdfil               : File;
  28.   a                    : String[2];
  29.   I                    : Integer;
  30.  
  31. Procedure Instruct;       { v. number = same as v. of Turbo used to compile }
  32.    Begin
  33.      ClrScr; Gotoxy(1,4);
  34.      Write(
  35.      '        TRUN v. 3.0  -  Compiled with Turbo Pascal v. 3.0      ' ,a,a,
  36.  
  37.      '  This is a run-time loader,  compiled with the  DEFAULT  START' ,a,
  38.      '  ADDRESS  (the end of the pascal library plus 1).   For proper' ,a,
  39.      '  handling of variables, CHN programs run with this loader must' ,a,
  40.      '  be compiled with this same start address.   To run a CHN file' ,a,
  41.      '  with a  DIFFERENT start address, a new version of this loader' ,a,
  42.      '  may be compiled with a start address IDENTICAL to that of the' ,a,
  43.      '  program to be run.                                           ' ,a,a);
  44.  
  45.      {  Above message for CP/M-80.  Use the following for CP/M-86 and
  46.         MS-DOS versions of TRUN:
  47.  
  48.      '  This is a run-time loader compiled with  DEFAULT MEMORY SIZE.' ,a,
  49.      '  For proper handling of variables with MS-DOS and CP/M-86, the' ,a,
  50.      '  loader and the  CHN programs to be run must all have the same' ,a,
  51.      '  respective CODE SEGMENT, DATA SEGMENT, and FREE MEMORY sizes.' ,a,
  52.      '  In order to run  CHN  programs with  DIFFERENT memory values,' ,a,
  53.      '  compile a new  version of this loader whose memory values are' ,a,
  54.      '  IDENTICAL to those of the files to be run.                   ' ,a,a,}
  55.  
  56.      Write(
  57.      'To avoid this message, use the syntax:  TRUN filename          ' ,a,a,
  58.      'Filename is the name (without extension) of CHN program to run.' ,a,a,
  59.  
  60.      'Name of program to run: '); Readln(Cmd);
  61.      For I := 1 to Length(Cmd) Do Cmd [I] := Upcase(Cmd[I]); { Capitalize    }
  62.    End; {Instruct}
  63.  
  64. BEGIN
  65.  
  66.    Cmd := ''; Cmdline := ''; a := chr(13) + chr(10); { initialize variables  }
  67.  
  68.    For I := 1 to ParamCount do Cmdline := Cmdline+' '+Paramstr(I);
  69.  
  70.    If ParamCount>0 Then Cmd := ParamStr(1) Else Instruct; { instructions if
  71.                                                             no parameters    }
  72.  
  73.    If Pos('.',Cmd) = 0 Then Cmd := Cmd+'.CHN'; { adds extent to ParamStr(1)  }
  74.  
  75.    If Cmd <> '.CHN' Then Begin             { routine chains to .CHN program  }
  76.                                            { named in ParamStr(1)            }
  77.  
  78.       Write('TRUN v. 3.0 (08/18/85): ');   { same v. as TURBO used to compile}
  79.       Writeln(Cmd); Writeln;
  80.       Assign(Cmdfil,Cmd);
  81.       {$I-} Chain(Cmdfil) {$I+};           { 'file not found' error-trapping }
  82.                                            { starts on chain to cmdfil and   }
  83.                                            { error message follows:          }
  84.       If Ioresult = 1 Then Write(
  85.  
  86.       '- - - - - - - - - - - > ', Chr(7), Cmd, ' NOT found.        ' ,a,a,
  87.       'Check disk and try again!                                   ');
  88.    End;
  89.  
  90. END. {TRUN}
  91.