mov dx, offset Bytes ;number of bytes to remain resident
int 27h ;Terminate and Stay Resident
Terminate and Stay Resident (Interrupt 27h) ends the current program by returning control to its parent program, but it leaves the program in memory and preserves such program resources as open files and allocated memory.
This interrupt has been superseded. Programs should use Keep Program (Interrupt 21h Function 31h).
Bytes
Specifies the number of program bytes to remain in memory. This number must be in the range 0000h through 0FFFFh.
This interrupt does not return.
This interrupt is intended to be used by .COM programs. When a program issues the interrupt, the CS register must contain the segment address of the program segment prefix (PSP).
This interrupt carries out the following actions:
Sets the new size of the program by converting the value of the Bytes parameter to a corresponding number of paragraphs and reallocating the program memory. Program memory includes only the PSP and program data and code. The reallocation does not affect the program's environment block, nor does it affect the memory allocated by the program after it was loaded.
Flushes the file buffers but leaves files open.
Restores Termination Address (Interrupt 22h) from offset 0Ah in the PSP (pspTerminateVector field).
Restores the address of CTRL+C Handler (Interrupt 23h) from offset 0Eh in the PSP (pspControlCVector field).
Restores the address of Critical-Error Handler (Interrupt 24h) from offset 12h in the PSP (pspCritErrorVector field).
After completing these actions, this interrupt transfers control to the address specified by offset 0Ah in the PSP.
Interrupt 21h Function 31h Keep Program
Interrupt 22h Termination Address
Interrupt 23h CTRL+C Handler
Interrupt 24h Critical-Error Handler