Int 21H [2.0] Function 4DH (77) Get return code

Used by a parent process, after the successful execution of an EXEC call (Int 21H Function 4BH), to obtain the return code and termination type of a child process.

Call with:

AH = 4DH

Returns:

AH = exit type

00H if normal termination by Int 20H, Int 21H Function

00H, or Int 21H Function 4CH

01H if termination by user's entry of CtrlDC

02H if termination by critical-error handler

03H if termination by Int 21H Function 31H or Int 27H

AL = return code passed by child process (0 if child terminated

by Int 20H, Int 21H Function 00H, or Int 27H)

Notes:

This function will yield the return code of a child process only once. A subsequent call without an intervening EXEC (Int 21H Function 4BH) will not necessarily return any valid information.

This function does not set the carry flag to indicate an error. If no previous child process has been executed, the values returned in AL and AH are undefined.

Example:

Get the return code and termination kind of child process that was previously executed with Int 21H Function 4BH (EXEC).

retcode dw ? ; return code, termination type

.

.

.

mov ah,4dh ; function number

int 21h ; transfer to MS-DOS

mov retcode,ax ; save child process info

.

.

.