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
/
TRUN281.PQS
/
TRUN281.PAS
Wrap
Pascal/Delphi Source File
|
2000-06-30
|
5KB
|
102 lines
Program TRUN;
{ TRUN runs a program specified on the command line.
This version works with earlier versions of CP/M-80 Turbo Pascal.
Change the variable "Cmdbuffer" as shown in order to convert this
version of TRUN for use with MS-DOS or CP/M-86 Turbo (v. 1 & 2).
(c) August, 1985 by: Mike Dingacci, MD
Program is hereby placed in the public
domain. It may be used by anyone for
any purpose. The author will accept no
responsibility for the accuracy of the
software, nor for any problems which
may result from its use. - RMD -
Comments or
questions to: P.O. Box 1124
Fallon, Nevada 89406
}
Type
Cmdstr = String[127]; { Max = 32 char in CP/M-80 because the TPA }
{ starts at $100, overwriting everything }
{ beyond 32 characters in the command buffer. }
{ Theoretical max = 127, if your DOS allows. }
Var
Cmdline,Cmd : Cmdstr; { Declared 1st for easy passage to .CHN file }
Cmdbuffer : Cmdstr Absolute $80; {--> for CP/M-80 }
{*** Cmdbuffer : Cmdstr Absolute Dseg:$80; --> for CP/M-86 ***}
{*** Cmdbuffer : Cmdstr Absolute Cseg:$80; --> for MS-DOS ***}
I,Ltr,Z : Integer;
Cmdfil : File;
a : String[2];
Procedure Instruct; { v. number = same as v. of Turbo used to compile }
Begin
ClrScr; for I := 1 to 3 Do Writeln;
Write(
' TRUN v. 2.8 - Compiled with Turbo Pascal v. 2.0 ' ,a,a,
' This is a run-time loader, compiled with the DEFAULT START' ,a,
' ADDRESS (the end of the pascal library plus 1). For proper' ,a,
' handling of variables, CHN programs run with this loader must' ,a,
' be compiled with this same start address. To run a CHN file' ,a,
' with a DIFFERENT start address, a new version of this loader' ,a,
' may be compiled with a start address IDENTICAL to that of the' ,a,
' program to be run. ' ,a,a);
{ Above message for CP/M-80. Use the following for CP/M-86 and
MS-DOS versions of TRUN:
' This is a run-time loader compiled with DEFAULT MEMORY SIZE.' ,a,
' For proper handling of variables with MS-DOS and CP/M-86, the' ,a,
' loader and the CHN programs to be run must all have the same' ,a,
' respective CODE SEGMENT, DATA SEGMENT, and FREE MEMORY sizes.' ,a,
' In order to run CHN programs with DIFFERENT memory values,' ,a,
' compile a new version of this loader whose memory values are' ,a,
' IDENTICAL to those of the files to be run. ' ,a,a,}
Write(
'To avoid this message, use the syntax: TRUN filename ' ,a,a,
'Filename is the name (without extension) of CHN program to run.' ,a,a,
'Name of program to run: '); Readln(Cmd);
For I := 1 to Length(Cmd) Do Cmd [I] := Upcase(Cmd[I]); { Capitalize }
End; {Instruct}
BEGIN {TRUN}
a := Chr(13) + Chr(10); { CR/LF placed in variable a }
Cmd := ''; I := 0; Z := 0; { variables zeroed for below }
Cmdline := Cmdbuffer; { put buffer into string to parse }
Ltr := Length(Cmdline); { Ltr = no. of characters }
While I < Ltr Do Begin { Routine builds ParamStr(1) }
I := I+1; { (could build 2, 3, etc.) }
If Z = 1 Then If Cmdline[I] <> ' ' Then Cmd := Cmd + Cmdline[I];
If Cmdline[I] = ' ' Then Z := Z + 1;
End;
If Cmd = '' Then Instruct; { Instructions if no parameters. }
If Pos('.',Cmd) = 0 Then Cmd := Cmd+'.CHN'; { If no extent then = '.CHN' }
If Cmd <> '.CHN' Then Begin { Chain to CHN program named -- }
{ (unless it is a blank line). }
Write('TRUN v. 2.8 (08/25/85): '); { Same v. as Turbo used to compile}
Writeln(Cmd); Writeln;
Assign(Cmdfil,Cmd);
{$I-} Chain(Cmdfil) {$I+}; { 'file not found' error-trapping }
{ starts on chain to cmdfil and }
{ error message follows: }
If Ioresult <> 0 Then Write(
'- - - - - - - - - - - > ', Chr(7), Cmd, ' NOT found. ' ,a,a,
'Check disk and try again! ');
End;
END. {TRUN}