home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!decwrl!concert!duke!news.duke.edu!phy.duke.edu!kds
- From: kds@phy.duke.edu (Stokes Kevin)
- Newsgroups: alt.msdos.programmer
- Subject: Re: TSR in C
- Message-ID: <4880@news.duke.edu>
- Date: 26 Aug 92 15:52:23 GMT
- References: <BtLGAC.F35@news.cso.uiuc.edu>
- Sender: news@news.duke.edu
- Organization: Duke University Physics Dept.; Durham, N.C.
- Lines: 87
- Nntp-Posting-Host: physics.phy.duke.edu
-
- >I am interested in writing a screensaver program in C, and could
- >use some help.
-
- My serious advice is to give it up, if you plan to distribute it. I have
- written a shareware screen saver called InnerMission. I have about 600
- registered users. The problem is that almost every one of them has some
- odd program which conflicts with IM.
- The bottom line is: If you want to write on which just blanks the screen
- by disabling the video, it is easy and can be sort of reliable.
- If you want one which switches to graphics mode (like mine), and puts up
- a cute animation or something, you have a horrendus s**tmess. DOS just isn't
- good enough to allow something like this.
-
-
- ( A whirlwind of angry babbling follows: Recommended reading for any person
- considering authoring a TSR which must save and restore the screen when done )
-
-
- Some examples:
- So you trap int 16h so see how long it has been since the user pressed the
- last key. Then when you are popped up you watch BIOS int 16h to see when
- the user wants to pop down. Seems logical.
- But in WordPerfect, they bypass the bios by diverting the hardware keyboard
- interrupt to their own routine, without calling the old one. Therefore your
- TSR doesn't see any activity, so your screen saver pops up. Now the user
- has a blank screen which can't be brought back, since your TSR doesn't see
- any keys being pressed, even as the frustrated customer is flailing away on
- all the keys in the keyboard. He/she has to reboot via the reset switch and
- never loads your screen saver again. (may even try to bill you for the lost
- time retyping the whole document )
-
- OK so you have your TSR not pop if someone else has grabbed int9. But then,
- lots of other programs grab int 9, but still call the old int9. They do this
- just to keep track of keyboard activity without diverting keys to the BIOS.
- Now your TSR won't work with ANY of theses programs, because you told it to
- not pop up if someone else grabs int 9.
-
- So you make your program grab int 9 back if you notice some other program
- has taken it from you. Your TSR cleverly then calls the old int9 that you
- stole, so the other program is non the wiser. However, then you find that
- the other program grabs it back immediately, and you have a runaway loop.
-
- Fine. Now you cleverly save the text mode screen buffer, so that when the
- user wants to pop back, you put his old screen back up. Works great.
- Now the user runs a program which redines the 'blink' bit to make high-intensity
- background color. Your TSR however, didn't realize that the user's program
- had twiddled with the standard text mode, so when you pop him back, the whole
- screen is blinking. Another pissed off customer who thinks your software
- stinks.
-
- OK, so you make your TSR for VGA only, no EGA where you can't tell if blink
- bit is on or off. No the users pull up their favorite program which uses
- 80x43 mode, for more characters on the screen. Your TSR doesn't know about
- this, so it only saves the top 25 lines, and when you pop him back, his screen
- is no longer in 80x43, and he has to exit his program whilst grumbling about
- your poor software.
-
- So you learn how to detect if the user has twiddled the VGA for this, but
- then you realize that your screen buffer now has to be almost 7k in order to
- store the screen. The TSR is getting bigger. Then along comes a customer
- who's program uses all 8 pages of text video ram. And then another one who
- has a program which redifines the font. When he pops down, his screen is
- filled with gibberish.
-
- So fine. You realize you'll need to save 32k worth of VGA state data
- when you popup. No one whats a 45k screen saver TSR, so you have write your
- saved screen to disk. So you want to create and write files from a TSR.
- Good Luck!
-
- This stuff goes on and on with no end. I have ceased distributing my
- screen saver.
-
- If you want to write a screen saver which saves the screen and puts up
- and amusing animation, be prepared to write a program which is close to
- Desqview in complexity. DV really amazes me. The've managed to handle
- least 85% of the stuff like this. However, I think being a Quarterdeck
- programmer would be really unfun, because that kind of kludgy workarounds
- are just not fun at all.
-
- -Kevin
-
-
- --
- ------------------------------------------------------------------------------
- | Kevin Stokes | Please direct all pointless |
- | Pie in the Sky Software | flames to my mailbox, it's much |
- | | more irritating. |
-