home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / pascal / 7520 < prev    next >
Encoding:
Text File  |  1992-12-16  |  2.4 KB  |  55 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!s.psych.uiuc.edu!amead
  3. From: amead@s.psych.uiuc.edu (Alan Mead)
  4. Subject: Re: Creating a TSR
  5. References: <ByyHw1.2vx@pcuf.fi> <Hendrik.Klompmaker.27.724459150@beheer.zod.wau.nl>
  6. Message-ID: <BzD80L.KHr@news.cso.uiuc.edu>
  7. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  8. Organization: UIUC Department of Psychology
  9. Date: Wed, 16 Dec 1992 18:43:32 GMT
  10. Lines: 43
  11.  
  12. Hendrik.Klompmaker@beheer.zod.wau.nl (Hendrik Klompmaker) writes:
  13.  
  14. >In article <ByyHw1.2vx@pcuf.fi> hammer@pcuf.fi (Mikko Uromo) writes:
  15. >>From: hammer@pcuf.fi (Mikko Uromo)
  16. >>Subject: Creating a TSR
  17. >>Date: Tue, 8 Dec 1992 19:52:49 GMT
  18. >>[Mikko is trying to write a TSR]
  19.  
  20. >I tried some of the PD stuff around to make a TSR but find that nothing 
  21. >beats the Turbo Power Object professional library. I only use parts of it 
  22. >but it's sure worth the money.
  23.  
  24. Yes.  The absolute easiest way is to use the Turbo Power unit.  It is
  25. shareware but I'm not sure that they keep releaseing new versions (at
  26. least to Internet).  I emailed the authors for my v5.5 TPU.
  27.  
  28. But I became disenchanted with a Pascal TSR because ASM is sooo much
  29. more efficient and I found a neat (PD last I heard) package, TBONES
  30. that makes it relatively easy to write a TSR (ie, *if* you know ASM).
  31. TBONES should be available from large FTP sites.
  32.  
  33. If you are really interested in HOW to write a TSR (as opposed to just
  34. getting the job done), then I have a few bits of code.  The problem
  35. (which I'll only sketch) is rather more complex than you seemed to
  36. think.  DOS and some of the BIOS is NON-REENTRANT, meaning that if you
  37. call, a function twice (once by some application and the second time by
  38. you TSR that "pops-up" over the first app) the second call overwrites
  39. information neccessary for the first call to return.  Thus after your
  40. TSR reliquishes control, execution resumes at some random point in
  41. memory and chaos ensues.
  42.  
  43. The trick (art?) of figureing out when it is "safe" to pop-up is the
  44. hard part.
  45.  
  46. Note that if you never want to call an interrupt, it is almost
  47. trivially easy to write a TSR.  Just remember to shrink your heap (with
  48. $M directive) and terminate with Keep() rather than Halt() or "END.".
  49. For instance, I have a neat little TSR clock that uses Mem[:] to (1)
  50. read the time and (2) poke the nessessary string directly into video
  51. ram.  Thus this TSR side-steps the whole nasty issue of when it is safe
  52. to issue a interrupt by not doing so.
  53.  
  54. -alan
  55.