Table des matières
INT 0x21 - 0x4b - DOS 2+ - "EXEC" - Load and/or Execute Program
Request/Call:
reg | value | descr |
---|---|---|
AH | 0x4b | |
AL | type of load | |
DS:DX | ASCIIz program name (must include extentsion) | |
ES:BX | parameter block (see below) |
Structures format
Format of EXEC parameter block for AL=00h,01h,04h:
Offset | Size | Description |
---|---|---|
0x00 | WORD | segment of environment to copy for child process (copy caller's environment if 0000h) |
0x02 | DWORD | pointer to command tail to be copied into child's PSP |
0x06 | DWORD | pointer to first FCB to be copied into child's PSP |
0x0A | DWORD | pointer to second FCB to be copied into child's PSP |
0x0E | DWORD | (AL=01h) will hold subprogram's initial SS:SP on return |
0x12 | DWORD | (AL=01h) will hold entry point (CS:IP) on return |
Format of EXEC parameter block for AL=03h:
Offset | Size | Description |
---|---|---|
0x00 | WORD | segment at which to load overlay |
0x02 | WORD | relocation factor to apply to overlay if in .EXE format |
Return:
CL cleared if successfull
- BX, DX are destroyed
- if sub function 0x01 is called, process ID set to new program's PSP can be requested via Int 0x21, 0x62
CL is set on error
- AX = error code (0x01, 0x02, 0x05, 0x08, 0x0a, 0x0b) see Int 0x21, 0x59, DOS error Code
Notes & Comments
- DOS 2.x destroys all registers, including SS:SP
- for function 00h and 01h, the calling process must ensure that there is enough unallocated memory available; if necessary, by releasing memory with AH=49h or AH=4Ah
- for function 01h, the value to be passed to the child program is put on top of the child's stack
- for function 03h, DOS assumes that the overlay is being loaded into memory allocated by the caller
- function 01h has been documented for DOS 5+, but was undocumented in prior versions
- some versions (such as DR-DOS 6.0) check the parameters and parameter block and return an error if an invalid value (such as an offset of FFFFh) is found
BUG: DOS 2.00 assumes that DS points at the current program's PSP