Terminate and Stay Resident (TSR)
TECH Help! topics cover many facets of writing TSR programs:
DOS fn 31H Make your program resident in memory. Also INT 27H.
DOS fn 4aH Shrink your memory block to only the size you need.
DOS fn 4bH EXEC a child process (you're resident while it executes).
DOS fn 34H Get InDOS Flag and ErrorMode addresses before installing (VERY
important in writing crash-free TSRs).
DOS fn 01H-0cH take special precautions with these fns.
DOS fn 52H Trace MCBs to see what TSRs are resident. ◄undocumented►
DOS fn 35H/25H Save/restore an interrupt vector (install an INT handler).
DOS fn 51H/50H Save/restore the PSP of interrupted program.
DOS fn 2fH/1aH Save/restore DTA of interrupted program.
XMS fn 07H/03H Save/restore the state of A20 (if you mess around with it).
INT 33H 0017H / 0018H Save/restore mouse status
INT 67H 4700H / 4800H Save/restore Expanded Memory Manager page mapping
XMS 01H a TSR may want to own the HMA▲.
INSTALL= and INSTALLHIGH= CONFIG.SYS commands make a TSR resident.
Switcher API Maintain separate data areas per each DOS session.
MRCI API TSRs using MRCI compression must be careful.
Accessing Upper Memory Have your TSR load itself into a UMB▲.
DOS Environment Use 49H to free your environment at PSP:002eH.
Program Startup & Exit Some general background info applies to TSRs, too.
xView Syntax How to use TECH Help! as a RAM-resident popup.
────────────────────────────────────█▌Interrupts often intercepted by TSRs▐█
INT 08H Get control 18 times per second.
INT 09H Watch keyboard for the scan code of your hot key.
Use the Keyboard Flags to check the current state of shift keys.
INT 16H Watch keyboard for your Extended ASCII keystroke hot key.
INT 23H Get control when user presses Ctrl-Break in your program.
INT 24H Get control on Critical Error (e.g., drive door open).
INT 28H Get control on DOS Idle (at a time when it is safe to popup).
INT 2fH Communicate with previously-installed copy of yourself.
DOS Functions BIOS Data Area API Index Service Groups