logoalt Hacker News

smartmictoday at 5:56 AM3 repliesview on HN

What the heck are "TSR"s? Is this common knowledge?


Replies

dspilletttoday at 10:58 AM

It was common knowledge, though not for most of those (with some exceptions like legacy gaming fans) coming into the PC world much after the early 2000s.

Terminate but Stay Resident was the original DOS function call to allow a utility program to exit but stay in memory waiting for interrupt signals (it will have hooked into those interrupts before calling TSR) to respond to. Utilities that operated in this manner (mouse drivers, and many other useful things) became collectively known as TSR programs and then just TSRs.

There were later other methods of leaving code resident, implemented by various memory managers for background tools that needed to use RAM outside the first 1MB (which in reality meant outside the first 640KB because of how the PC memory map was arranged), but the name TSR stuck to cover them generally.

martijnvdstoday at 6:45 AM

DOS programs generally were like command line apps today (but simpler, obviously). They did a thing, then exited. Or they showed their "TUI" (as we'd call it today), and when you told it to exit, you got back to the DOS prompt to start the next program.

TSRs were a special kind of program, that instead of telling DOS "I'm done, here's my memory back", said "I'm done for now, but don't unload me", so their memory stayed allocated/used. And you got your command prompt back immediately to continue your work.

TSRs usually hooked into an interrupt like the keyboard interrupt, intercepting a hotkey to re-activate the program (so you could browse your address book while you were in your (text mode) word processor; "kind-of" multitasking), or they offered a service to other programs (like the mouse and CD-ROM drivers).

There were all kinds of things that ran as TSRs. Virus scanners (hooking into disk write/reads), modem tools (showing "RING" in the corner of the screen when the modem detected an incoming call), note-taking apps, address books, you name it.

romberttoday at 6:01 AM

TSR stands for Terminate and Stay Resident, a distinct behaviour for DOS era programs, which would usually run to completion and exit.

show 1 reply