By: Dave Walker
--------------------------------------------------------------------

AW>Could ANYONE post me the structures, registers, etc. for
AW>the DOS exec (4Bh) call? I just CAN'T make the blasted
AW>thing work... grrr.. I've also heard there's a _REALLY_
AW>undocumented call that will use COMMAND.COM to execute a
AW>command. Any knowledge of this?

Here's a simple model for invoking a child process.  For simplicity, it
uses the parent's PSP and environment.  This is written in TASM format
using ideal mode, but it shouldn't be too hard to convert if desired.
There are a couple of things that might need explanation:

  - On starting an EXE program, DS and ES point to the PSP.  In other
    words, DS:0 = ES:0 = PSP:0.

  - The environment segment is stored at PSP:002Ch.  If you want the
    child to inherit the parent's environment, just fetch [PSP:002Ch]
    and store it in the first word of the parameter block.

To invoke a second copy of the command processor (not necessarily
COMMAND.COM, ie. 4DOS, etc.) try replacing the childname with something
similar to this:

dosfunc     db      '/C dir *.exe',0    ;Do DIR for EXE files

The /C option tells the command processor to execute the command and
return to it's caller.  By not using the /C option, you can invoke a
shell like so:

shell       db      'prompt SHELL$g',0  ;Invoke DOS shell

Dave 1:396/1
