How do I get the command line arguments passed to an EXE
from within the EXE itself, using ASM? I have been VERY busy
converting a bunch of my UNIT's to OBJ files, as I downloaded
the MASM 6.14 macro assembler about a week ago. I already know how
to use the PSP to retrieve the path/name of the EXE itself.
I have tried various searches through the PSP, and none of them
seem to contain the command lines. I *could* use the part of the
environment block that starts with "CMDLINE=", BUT, that is only
valid if the program is run from a DOS command prompt. (i.e.,
that env var does not get set when, for example, the EXE is SHELL'd
to from another app).
Any replies gratefully received.
P.S. This question applies BOTH to my PB/DOS programs, and the standalone
EXE files that I wish to write with MASM. I figured it'd be OK to post this
question because of its partial relevance to PB/DOS programs.
ADDED: got another question: how can I allocate/free memory from within
ASM? In other words, do the same thing as PB's SETMEM statement.
I've tried using int 21h, service 48h, but it ALWAYS fails. So, I read
up on SETMEM in the online Help, and it referenced the "far heap."
How can I do the same thing it does? I couldn't find anything in
Ralf Brown's interrupt lists that would do it. I also tried the
DPMI allocator interrupt service, but it always generated the
"...has performed an illegal function...please restart your computer..."
Windows error message.
------------------
[This message has been edited by Clay Clear (edited April 08, 2003).]
from within the EXE itself, using ASM? I have been VERY busy
converting a bunch of my UNIT's to OBJ files, as I downloaded
the MASM 6.14 macro assembler about a week ago. I already know how
to use the PSP to retrieve the path/name of the EXE itself.
I have tried various searches through the PSP, and none of them
seem to contain the command lines. I *could* use the part of the
environment block that starts with "CMDLINE=", BUT, that is only
valid if the program is run from a DOS command prompt. (i.e.,
that env var does not get set when, for example, the EXE is SHELL'd
to from another app).
Any replies gratefully received.

P.S. This question applies BOTH to my PB/DOS programs, and the standalone
EXE files that I wish to write with MASM. I figured it'd be OK to post this
question because of its partial relevance to PB/DOS programs.

ADDED: got another question: how can I allocate/free memory from within
ASM? In other words, do the same thing as PB's SETMEM statement.
I've tried using int 21h, service 48h, but it ALWAYS fails. So, I read
up on SETMEM in the online Help, and it referenced the "far heap."
How can I do the same thing it does? I couldn't find anything in
Ralf Brown's interrupt lists that would do it. I also tried the
DPMI allocator interrupt service, but it always generated the
"...has performed an illegal function...please restart your computer..."
Windows error message.
------------------
[This message has been edited by Clay Clear (edited April 08, 2003).]
Comment