[comp.os.msdos.programmer] EXEC question

n8541751@unicorn.cc.wwu.edu (Where there is darkness, light) (04/17/91)

Hi,

I'm writing an application from which I want to be able to run other DOS apps.
This is easy enough to do using the EXEC function, but unfortunately the
programs get read from disk each time.

What I really want to be able to do is load a program from disk, put it
in far memory somewhere, and then execute it later using a far call.

I tried to do this by allocating a piece of memory, calling the Create New
Program Segment Prefix function to make a psp in it, reading a .COM file
into it starting at offset 100h, reseting some values such as memory
size and the command line parameter area in the new PSP, saving all current
critical values like the stack regs in code segment variables, loading
all registers properly for the .COM program, and finally performing a far
call to offset 100h in the segment into which it was loaded.  Then I
restored the parent program's stack etc. from the code segment variables.
This method actually provided moderate success....some programs run fine, 
but not others.

Any ideas??  

I also thought about using the EXEC function, but it doesn't appear to be
set up properly for this, at least not the documented portion of it.

The DOS Technical Reference for version 4.0 lists calls to EXEC
with al=0 for a normal exec, and al=3 for an overlay.  Does anyone know what
functions are performed if al = 1 or 2?  Maybe just what I'm looking for?

I'm working in a mixture of MSC 6.0 and assembly.

Thanks for any suggestions.

Kris.
-- 
Kriston M. Bruland          |    . .         . .      . . .      .       . .
n8541751@unicorn.cc.wwu.edu |    .   .     . .        .        . .       .   .
8541751@nessie.cc.wwu.edu   |    .             .         .     .   .     .