Date : Thu, 11 Jul 1985 08:22:00 EDT
From : Kushall.henr@XEROX.ARPA
Subject: Re: Reading CPM/86 Command Line
I have been using the following method for reading the command line
arguments from Turbo Pascal. (CP/M-86 version 2.0, Turbo Pascal version
2.0)
Declare the following global variable:
var
CmdLine : String[128] absolute(DSeg:$80); { this is the location of
the CP/M 86 Command line buffer}
CmdLineString : String[128]; { used to save the command line }
You must execute the following code before your program does any IO and
destroys the buffer !
CmdLineString := CmdLine; { Copies the command line args into the safe
area}
Note that if length(CmdLine) = 0 then no args were passed.
The data format of Dseg:$80 is as follows:
The byte at Dseg:$80 is the nunber of characters passed in the cmd line
after the name of the .CMD file called including the leading space. This
will be CmdLine[0] in the Turbo Pascal string. Thus the string is
returned by CP/M in the same format as required by Turbo.
The same method can be used for CP/M 80 except the declaration is:
CmdLine : String[128] Absolute $80;
And for MS-DOS
CmdLine : String[128] Absolute(CSeg:$80);
It is my understanding that the CP/M-80 versions only allow a limited
number of characters to be passed as arguments(arround 30) I have not
verified this for any of the implementations.
Turbo Pascal 3.0 includes 'standard' procedures for reading the command
line arguments.
Ed Kushall