The LazyBoy Library Manual - GetCmdLine

Part of the System group.

%imacro GetCmdLine 1
Prefers: ES:DI

Return a register pair pointer to the ASCIIZ string for the parameters passed to the program from the command line (also known as the Command Line Tail).

The pointer returned may be either to the PSP command tail. Or if it is excessively long, it may point to a version in the environment variable table. This macro will always return the version from the environment table when it is present.

If the version from the Program Prefix Segment is returned, the macro will replace the terminating Carriage Return character with and zero. This is to permit the string to be treated simply as a null terminated ASCIIZ string.

Regardless of which string is returned, it only includes the parameters passed to the program and automatically trims any leading spaces. Once trimmed, if there is any data remaining, the Carry Flag will be cleared. A blank command line will return with the Carry Flag set.

Example:

    GetCmdLine es:di     ; get ASCIIZ parameter string.

Note: There were several bugs discovered by me recently in FreeCOM 0.85a that revolve around passing command line parameters over 126 characters. Those were communicated to the developers of FreeCOM and should be resolved with it's next release. This macro uses algorithms which should be immune to those issues and compatible with FreeCOM 0.85a or later.