[net.micro.cpm] Reading CPM/86 Command Line

timothym@tekigm.UUCP (Timothy D Margeson) (07/10/85)

Hello,

I am looking for instructions on how to read the CPM/86 command line from
within Turbo Pascal specifically.

I have found the location of the command buffer, but it appears to be a
circular referenced affair. What I need is the pointer location if my
assumptions are correct, or any flames that might lead me in the correct
direction should my assumptions be wrong.

I will appreciate any and all advice as I haven't much hair left.

Thanks!

-- 
Tim Margeson (206)253-5240
tektronix!tekigm!timothym                   @@   'Who said that?'  
PO Box 3500  d/s C1-465
Vancouver, WA. 98665

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 Kushall

ABN.ISCAMS@USC-ISID.ARPA (07/15/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