Through its memory-management system, DOS allows a program to remain resident in memory after terminating. The resident program can later regain control of the processor to perform tasks such as background printing or “popping up” a calculator on the screen. Such a program is commonly called a TSR, from the Terminate-and-Stay-Resident function it uses to return to DOS.
This chapter explains the techniques of writing memory-resident software. The first two sections present introductory material. Following sections describe important DOS and BIOS interrupts and focus on how to write safe, compatible, memory-resident software. Two example programs illustrate the techniques described in the chapter. These programs are also available as sample programs on the MASM 6.0 disks.