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
/
MBUG085.ARC
/
START.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
3KB
|
122 lines
program ST;
{Program to load turbo pascal files saved as .CHN
Turbo Pascal saves its library of routines with every .COM file.
Therefore the smallest .COM file is about 10k. If you have a lot of small
utility programs on a disk, a lot of room is taken up with each program
storing the TP runtime library.
If a program is compiled with the .CHN option instead, only the program
code and data is saved . Making small files instead, and freeing up a lot
of disk space.
Now all that is needed is a program to load the .CHN files.
Enter ST. All it basically does is to load the TP runtime library into
memory, take the first argument on the commandline after ST as the program
to chain to and stuff any further arguments back into a new commandline.
This program works with CP/M and PC/MS DOS ,only the declaration of the
variable cmdline alters - see the code.
When compiling ST to a .COM file (PC/MS DOS only) set the min code and data
values to the biggest .CHN file you will be loading. (Found when you
compile the .CHN file)
USAGE
ST programname [optional programname arguments]
St by itself displays a usage message.
Rex Foord (052 513131) (MBUG 1044) Sept '87 }
type
styp = string[127];
var
program_name : styp;
n : byte;
{****************************************************************************}
procedure help_message;
begin
writeln;
writeln('Program to start chain files');
writeln;
writeln('Usage : ST programname [optional arguments for programname]');
writeln;
end;
{****************************************************************************}
procedure recreate_command_line (n:byte);
{put rest of command line arguments back into a new commandline}
var
i : byte;
s : styp;
{MS-DOS Ver NEXT LINE OF CODE commented out this version ...
cmdline : styp absolute cseg:$80; for MS-DOS }
{CP/M Ver NEXT LINE OF CODE }
cmdline : styp absolute $80;
begin
if n > 1 then
begin
s := '';
for i := 2 to n do
begin
s := s + paramstr(i);
if i < n then s := s + ' ';
end;
cmdline := s;
end
else {no further arguments on line}
cmdline[0] := chr(0); {put in a blank string}
end;
{****************************************************************************}
procedure start_program (program_name : styp);
var
f : file;
i : integer;
begin
if pos('.',program_name) = 0 then
program_name := program_name + '.CHN'; {check for extension}
assign(f,program_name);
{$i-}
chain(f);
{$i+}
if ioresult <> 0 then
writeln('? Unable to chain to program ',program_name);
end;
{****************************************************************************}
begin {main}
n := paramcount; {no of parameters initially on command line}
if n = 0 then
help_message
else
begin
program_name := paramstr(1); {take first parameter as the program name}
recreate_command_line (n);
start_program (program_name);
end;
end.
en s := s + ' ';
end;
cmdline := s;
end
else {no