Terminate and Stay Resident

A resident service provider uses this function after its
initialization to terminate execution while leaving its
protected mode memory (and optionally some real mode memory)
allocated.

Call With:

AX = 0C01H
BL = return code
DX = number of paragraphs (16-byte blocks) of DOS
memory to reserve

Returns:

Nothing (this call never returns)

Notes:

o This function should only be used by DPMI clients which
only provide resident services to other DPMI protected
mode clients. If the objective is only to provide
resident services to real mode programs, the client
should use the DPMI translation service Int 31H Function
0300H to invoke DOS's Int 21H Fn 31H directly.
o The value in DX only specifies the size of DOS allocated
memory to reserve. Any protected mode memory owned by
the program remains allocated unless it is explicitly
released before executing this function. Note that the
value in DX must either be 0 or a minimum of 6. If DX is
0, the DPMI host executes a DOS real mode terminate
function (Int 21H Fn 4CH), and no real mode memory
is reserved. If DX is nonzero, the DPMI host requests
the DOS real mode terminate-and-stay-resident function
(Int 21H Fn 31H).

o If the client has not made a prior call to Int 31H
Function 0C00H, the client will simply be terminated.
o For further details on programming of resident service
providers, see page 41.