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► ◄Notes► ◄Example► ◄Back►
──────────────────────────────────────────────────────────────────────────────
▀ The parameter block format for Subfunction 00H (Load and Execute Pro-
gram) 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 se-
quence of ASCIIZ strings in the form:
db '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:
db 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 Func-
tion 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 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 pro-
cess. 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.
-♦-