Function 31h (49)        Terminate and Stay Resident

Terminates a process, but keeps a specified portion resident in
memory.

On entry:      AH         31h
AL         Return code
DX         Size of resident portion, in paragraphs

                                                                          

Function 31h is an enhanced version of DOS Interrupt 27h, Terminate
and Stay Resident, that offers two extra features: It allows more than
64K of memory to remain resident, and allows the terminating process
to report a return code.

Notes:         This function does not release any memory that was
allocated by the terminating process via Function
48h (Allocate Memory).

The return code may be retrieved by a parent process
via Function 4Dh, or tested by means of the
ERRORLEVEL feature of DOS batch processing.

Open files are not closed by this function.

See also: INT 27h
See also: 4Dh
See also: 00h
See also: INT 20h

31h (49) Terminate and Stay Resident