Kushall.henr@XEROX.ARPA (07/11/85)
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 KushallABN.ISCAMS@USC-ISID.ARPA (07/14/85)
Re getting the command line in CP/M-80: FACT - in Version 1, at least, of Turbo Pascal, Turbo eats everything after maybe the 30th or 31st character - puts a bunch of (consistent) garbage there. I have extensively tested this and am sorely tried by this particular bug! David P Kirschbaum Toad Hall AB.ISCAMS@USC-ISID