home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / alt / msdos / programm / 2266 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  4.9 KB

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