[geeks] DOS IS Ok....unix is better.
Jonathan C. Patschke
jp at celestrion.net
Fri Jun 7 05:36:32 CDT 2002
On Fri, 7 Jun 2002, Kevin Lee wrote:
> im my experience in the OLD days the only thing really the FSCKUP your
> dos box was that WEIRDO thing called a T.S.R.....how many remember
> them....raise your hands....tentacles...etc.
Ah, memories....
It's not that weird, really. TSRs are almost identical in theory to
extensions on older single-tasking versions of the Macintosh system
software. Your TSR would load itself, attach to some software interrupts
(basically creating its own system calls), and then return control to DOS
with a flag that says "but don't remove me from memory".
The important distinction between "leave me running" and "don't remove me
from memory" is that DOS originally didn't have a concept of multiple
processes. You just had -memory-, and if you jumped off to foo:bar,
there'd better be code living there (unprotected memory, how quaint). So,
if you told DOS not to remove your data from memory, any time one of your
TSR's services got called, it was just like the running program had that
code embedded.
A TSR could register itself with any software interrupt, including those
already owned by DOS or another TSR ("chaining"). This made it easy to
"patch" the OS to do something it didn't know how to do before, at the
risk of making the system incompatible with programs that depended on true
DOS. Stacker and Doublespace worked in this way to intercept calls that
would do low-level disc I/O so that compressed partitions would
transparently appear like normal partitions without having to fully
reimplement FAT.
But some TSRs needed to process data asynchronously (the Mouse driver, for
instance), not just when another application called those added/patched
system calls. These TSRs would patch the -timer- software interrupt and
chain onto whomever previously owned it. So every N times a second, your
timer routine would get called whenever DOS raised the timer interrupt.
Here's the kicker, though, any number of programs could chain onto the
timer interrupt, which meant your code had to be -fast- or else the system
clock would drift. This is why machines with lots of TSRs lost time so
easily.
Way back when (9th or 10th grade, I think), I wrote a printing system for
DOS (in Turbo Pascal!) that parsed something similar to HTML but much more
limited. I probably still have the code lying around somewhere, but it
wouldn't be of any use unless you happened to have the three or four
printers I wrote drivers for. The printing system would attach to one of
the unused interrupts (66h, I think), and you'd just call it with a
command and a pointer to one or two strings for data. It was way fun to
write. I was glad I had OS/2, though--I crashed the virtual DOS boxen all
the time, and I'd have hated to reboot that often.
Damn, that feels like a lifetime ago.
> ok TSR= Terminate and STAY Resident. sheesh...they had some nifty
> TSR's that watched DCD and rebooted your pc everyone someone hung up
> of your bbs....or
Someone wrote a really neat scientific calculator that popped up when you
hit a certain key combination--excellent for when you were writing papers
in WordPerfect and didn't have a desktop calculator or a scratchpad handy.
TSRs, by definition, are hacks. Neat, cute hacks that are characteristic
of the PC world before Windows. Yes, DOS always sucked. Yes, PCs always
sucked. But people still found ways to use that crufty OS to do really
neat things.
I, for one, miss the days when my 486 SX/25 running DOS 5.0, WordPerfect
5.1, and Lotus 1-2-3 2.2 was considered "advanced" and when no one laughed
at you for using Turbo Pascal. Simple, simple times those were. But I'd
have loved a Sun 3/xx running SunOS 4, I think--I just didn't know it,
then. :)
--Jonathan
More information about the geeks
mailing list