Function 4B05h Set Execution State

mov dx, seg ExecState

mov ds, dx

mov dx, offset ExecState ;ds:dx points to EXECSTATE structure

mov ax, 4B05h ;Set Execution State

int 21h

jc error_handler

Set Execution State (Function 4B05h) prepares a new program for execution. This preparation includes setting the version number for the program as specified by the setver command.

Parameter

ExecState

Points to an EXECSTATE structure that contains the execution state. The EXECSTATE structure has the following form:

EXECSTATE STRUC

esReserved dw ? ;reserved

esFlags dw ? ;type flags

esProgName dd ? ;points to ASCIIZ string of program name

esPSP dw ? ;PSP segment of the new program

esStartAddr dd ? ;starting cs:ip of the new program

esProgSize dd ? ;program size, including PSP

EXECSTATE ENDS

For a full description of the EXECSTATE structure, see Chapter 5, “Program Management.”

Return Value

This function has no return value.

Comments

This function is required for programs that intercept Load and Execution Program (Function 4B00h).

After the function returns, the calling program must transfer execution control to the new program as soon as possible. In particular, before starting the new program, the calling program must not call MS-DOS system functions, ROM BIOS functions, or system interrupts.

When MS-DOS is installed in the high-memory area (HMA), this function turns off the A20 line, making the HMA inaccessible. If the new program needs access to the HMA, the program must turn on the A20 line. Note that MS-DOS automatically turns on the A20 line (and usually leaves it on) when carrying out other system functions.

See Also

Function 4B00h Load and Execute Program
Function 4B01h Load Program