mov dx, seg ProgName
mov ds, dx
mov dx, offset ProgName ;ds:dx points to program name
mov bx, seg OvlArgs
mov es, bx
mov bx, offset OvlArgs ;es:bx points to LOADOVERLAY structure
mov ax, 4B03h ;Load Overlay
int 21h
jc error_handler ;carry set means error
Load Overlay (Function 4B03h) loads a program as an overlay. MS-DOS loads the overlay into memory already allocated by the program.
ProgName
Points to a zero-terminated ASCII string that specifies the program to load. The program name must be a valid MS-DOS filename.
OvlArgs
Points to a LOADOVERLAY structure that contains information used to load overlays. The LOADOVERLAY structure has the following form:
LOADOVERLAY STRUC
loStartSegment dw ? ;segment address of overlay's memory
loRelocationFactor dw ? ;relocation factor
LOADOVERLAY ENDS
For a full description of the LOADOVERLAY structure, see Chapter 5, “Program Management.”
If the function is successful, the carry flag is clear. Otherwise, the carry flag is set and the AX register contains an error value, which may be one of the following:
Value | Name |
0001h | ERROR_INVALID_FUNCTION |
0002h | ERROR_FILE_NOT_FOUND |
0003h | ERROR_PATH_NOT_FOUND |
0004h | ERROR_TOO_MANY_OPEN_FILES |
0005h | ERROR_ACCESS_DENIED |
0008h | ERROR_NOT_ENOUGH_MEMORY |
000Ah | ERROR_BAD_ENVIRONMENT |
Function 4B00h Load and Execute Program
Function 4B01h Load Program