Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Int 21h Function 4Bh
 Summary Example                         Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     The parameter block format for Subfunction 00h (Load and Execute
     Program) is as follows:
 
     Bytes       Contents
 
     00h-01h     Segment pointer to environment block
     02h-03h     Offset of command line tail
     04h-05h     Segment of command line tail
     06h-07h     Offset of first FCB to be copied into new PSP+5Ch
     08h-09h     Segment of first FCB
     0Ah-0Bh     Offset of second FCB to be copied into new PSP+6Ch
     0Ch-0Dh     Segment of second FCB
 
     The parameter block format for Subfunction 03h (Load Overlay) is
     as follows:
 
     Bytes       Contents
 
     00h-01h     Segment address where overlay is to be loaded
     02h-03h     Relocation factor to apply to loaded image
 
     The environment block must be paragraph aligned. It consists of a
     sequence of ASCIIZ strings in the form:
 
       BYTE   'COMSPEC=A:\COMMAND.COM',0
 
     The entire set of strings is terminated by an extra null (00h)
     byte.
 
     The command tail format consists of a count byte, followed by an
     ASCII string, terminated by a carriage return (which is not
     included in the count). The first character in the string should
     be an ASCII space (20h) for compatibility with the command tail
     passed to programs by COMMAND.COM. For example:
 
       BYTE   6,' *.DAT',0dh
 
     Before a program uses Int 21h Function 4Bh to run another program,
     it must release all memory it is not actually using with a call to
     Int 21h Function 4Ah, passing the segment address of its own PSP
     and the number of paragraphs to retain.
 
     Ordinarily, all active handles of the parent program are inherited
     by the child program, although the parent can prevent this in
     MS-DOS versions 3.0 and later by setting the inheritance bit when
     the file or device is opened. Any redirection of the standard
     input and/or output in the parent process also affects the child
     process.
 
     The environment block can be used to pass information to the child
     process. If the environment block pointer in the parameter block
     is zero, the child program inherits an exact copy of the parent's
     environment. In any case, the segment address of the child's
     environment is found at offset 002Ch in the child's PSP.
 
     After return from the EXEC function call, the termination type and
     return code of the child program may be obtained with Int 21h
     Function 4Dh.
 
     The following structure defines the parameter block:
 
       PARAM_BLK    STRUCT
         EnvSeg     WORD    ?               ; Segment address of
                                              environment block
         TailAddr   DWORD   WORD PTR ?      ; Segment:offset of command-
                                              line tail
         Fcb1Addr   DWORD   WORD PTR ?      ; Segment:offset of 1st FCB
         Fcb2Addr   DWORD   WORD PTR ?      ; Segment:offset of 2nd FCB
       PARAM_BLK    ENDS
 
     The command-line tail is a string containing the program arguments
     as they would be entered from the keyboard. The first byte
     specifies the number of characters in the tail, including tabs and
     spaces. The terminating byte must be ASCII character 0Dh (carriage
     return), which is not included in the character count.
                                    -♦-