Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
_dos_keep
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The _dos_keep routine installs terminate-and-stay-resident
programs (TSRs) in memory, using system call INT 0x31.
The routine first exits the calling process, leaving it in memory,
and then returns the low-order byte of <retcode> to the parent of
the calling process. Before returning execution to the parent
process, _dos_keep sets the allocated memory for the now-resident
process to <memsize> paragraphs. (A paragraph is 16 bytes.) Any
excess memory is returned to the system.
The _dos_keep function calls the same internal routines called by
the exit functions. It therefore takes the following actions:
1. Calls atexit and onexit if defined.
2. Flushes all file buffers.
3. Restores interrupt vectors replaced by the C start-up code,
primarily interrupt 0 (divide by zero). If the emulator math
library is used and there is no coprocessor, interrupts
0x34 through 0x3d are restored. If there is a coprocessor,
interrupt 2 is restored.
The _dos_keep function does not automatically close files. You
should do this specifically, unless you want files opened by the
TSR installation code to remain open for the TSR.
Do not use the emulator math library in TSRs unless you are
familiar with the C start-up code and the coprocessor. Use the
alternate math package if the TSR must do floating-point math.
Do not run programs that use _dos_keep from inside the
Programmer's WorkBench environment, since doing so causes
subsequent memory problems. The _dos_keep function terminates a
program executed in the Programmer's WorkBench environment.
Return Value
None.
-♦-