[comp.lang.pascal] Need code for use w/Turbo Pascal 4.0 to do TSR things

afc@i.cc.purdue.edu (Greg Flint) (04/15/89)

I have a need for a TSR program, but I don't know how to set up such a beast.
My TP4 manual says that any program can go TSR via the "KEEP" function, but
that no further information or support is available.

I've scanned SIMTEL20's MSDOS directories and I've found some TSR code that
works with TP3 and some that works with an assembler.  I have neither TP3 nor
an assembler (nor the knowledge to tie the assembler to TP4 even if I had one).
I cannot get the TP3 code to work with TP4 -- something to do with a change
in how "inline" code should be set up according to the UPDATE program.

What I want to do is to create a program that does the following:

  * Before going TSR, it allows the user to specify the "hot" key.
    (I'd like to specify more that one, each of which triggers a different
    function, but I could live with one "hot" key to be followed by user
    input.)

  * It goes TSR (via the "KEEP" function or inline code).

  * After the "hot" key(s) is/are hit, it "wakes up" and executes the 
    routines that I've put in the program.

  * After running these routines, the program would let the user specify
    whether the program should remain a "TSR" or if it should quit and free
    up its allocated memory.

Sample programs or code segments that perform all or part of the above
would be best.  Directions on how to setup the pre-TSR code, specify the
entry to the "awakened" program, and how to clean up the memory also would
be helpful.

I've set the follow-up to comp.lang.pascal since I believe that this topic
may be of interest to other TP4 programmers.

Does anyone know if TP5 has any TSR support?  I plan to upgrade in the next
couple of months, but I would advance my timetable if TSR support is in TP5.

Thanks in advance.
-------------------------------------------------------------------------------
Greg Flint 	  Math G-169	    (317) 494-1787  UUCP:  j.cc.purdue.edu!gdf
  Purdue Univ.	  Purdue University		    ARPA:  gdf@j.cc.purdue.edu
  Computing Ctr.  West Lafayette, IN 47907	  BITNET:  flint@purccvm.bitnet

bob@sactoh0.UUCP (Bob F. Breedlove) (04/16/89)

In article <3097@i.cc.purdue.edu>, afc@i.cc.purdue.edu (Greg Flint) writes:
> I have a need for a TSR program, but I don't know how to set up such a beast.
> My TP4 manual says that any program can go TSR via the "KEEP" function, but
> that no further information or support is available.

It sounds like what you REALLY need is Turbo Professional 4.0 (and
later 5.0) from TurboPower software. This is NOT public domain, but
is an excellent set of routines for Turbo Pascal. It includes a
very solid unit for TSR handling. It allows you to do much of what
you've described.

I've used versions of these routines since TP3. They come with full
source code and are very solid. Also, the company provides
excellent support.

TurboPower is in Scotts Valley, CA at 408-438-8608.

I am NOT associated with TurboPower in any way except as a very
satisfied customer.

-- 
Bob Breedlove  SYSOP: BOBsBBS (916/929-7511)
        pacbell!sactoh0!bfbreedl

gbm@gbmatl.UUCP (gary mckenney) (04/17/89)

In article <3097@i.cc.purdue.edu>, afc@i.cc.purdue.edu (Greg Flint) writes:
> I have a need for a TSR program, but I don't know how to set up such a beast.
> My TP4 manual says that any program can go TSR via the "KEEP" function, but
> that no further information or support is available.

You need to contact the following:

Essential Software, Inc.
P.O. Box 1003
Maplewood, NJ  07040

(914) 762-6605
(201) 762-6965

They supposedly have a set of routines to implement TSR's.  I've called them
once to ask some questions and they supposedly give full Microsoft C I/O
support.  You have to ask them if it works in TURBO Pascal or how to make calls.

Keep in mind that this is not an endorsement but only a possible lead to your
solution.

I've used their ESSENTIAL COMMUNICATIONS LIBRARY and it's a reputable and
well documented product.

Gary McKenney

slezakm@jacobs.CS.ORST.EDU (Mark R. Slezak) (04/17/89)

Ii isn't code for version 4.0 of Turbo Pascal, but in the May 1989 issue
of Dr. Dobb's Journal (#151,) there is an artical by Ken L. Pottebaum on
TSR's and Turbo Pascal. 

His artical contains code for a unit (it is turbo 5.0 thou...) I am not
sure, but it may be adaptable to Turbo 4.0. I haven't looked it over to
all that much yet, but it appears to be inline code.

 Douglas Adams                              The Long Dark Tea-Time Of The Soul
+-----------------------------------------------------------------------------+
:   It was signed "You-know-who,"but this had been crossed out and first the  :
: word "Odin" and then in larger letters "Your Father" had been substituted.  :
: Odin never ceased to make absolutely clear his view of his son's            :
: intellectual accomplishments.                                               :
+-----------------------------------------------------------------------------+
 Mark R. Slezak           {tektronix,hp-pcd}!orstcs!jacobs!CS.ORST.EDU!slezakm

mitch@arcturus.UUCP (Mitchell S. Gorman) (04/18/89)

In article <3097@i.cc.purdue.edu>, afc@i.cc.purdue.edu (Greg Flint) writes:
> I have a need for a TSR program, but I don't know how to set up such a beast.
> My TP4 manual says that any program can go TSR via the "KEEP" function, but
> that no further information or support is available.
> 

I have a feeling that this post might not be all too helpful.  :^)

I have a book that's called something like "Advanced Turbo Pascal." (Sorry,
don't remember the exact name.)  It's got a grey cover, on which it says
such wonderful things as 'How to use the debugger', 'How to write TSRs',
'How to cure world hunger', 'How to make zillions of dollars and impress
your friends'.  (Okay, okay, it doesn't REEELLY tell you how to make
zillions of dollars - I just made that up!)

	Anyway... 
There is a huge section in there which goes into detail on which interrupts
you need to write handlers for, and why, and how.  There is a medium-sized
unit included (took about an hour or so to type in - $50 for a source disk
is a little steep), which sets up a basic TSR example, and which has info
in the comments about how to modify to suit your own applications.

There is also a sizable section on utilizing the mouse interrupt (whazzat,
$33??).  Lets you pick off button presses, releases, movements, etc.  All
that groovy sort of stuff.

VERY handy book.  Lots of info on the debugger, and other good things.

I think it's what you're looking for (or at least, it's what you need;
they're not always the same thing.  :^)

I wish I could remember the exact title, or the author's name.  It's
published by the same house that puts out that big reference volume for
Borland.  Of course, I don't remember which one that is, either!! (It's
either Osbourne of McGraw-Hill, although I suddenly have the sinking
feeling someone's gonna tell me they're one and the same!)

Anyway, good luck.

	Mitch @ Rockwell, Anaheim

Disclaimer:	I didn't write the book; I just liked what was in it.

cs3b3aj@maccs.McMaster.CA (Stephen M. Dunn) (04/21/89)

In article <3097@i.cc.purdue.edu> afc@i.cc.purdue.edu (Greg Flint) writes:
>I have a need for a TSR program, but I don't know how to set up such a beast.
>My TP4 manual says that any program can go TSR via the "KEEP" function, but
>that no further information or support is available.

   In the July 1988 BYTE magazine, there is an article called "A Turbo TSR"
which gives an outline of how the author of the article designed a simple
TSR which, when activated with a hot key, shows a clock on the screen.  The
article itself gives rather sketchy information, but there is an editor's
note as follows:
  Pseudocode for QuickTime is in listing 1.  The complete source for QT
  is available on disk, on BIX, on BYTEnet, and in the Quarterly Listings
  Supplement.  See page 3 for further details.
(QuickTime, or QT is the name of the author's TSR; BIX is Byte's
bulletin board).

   You might want to follow up on this; I think it would likely solve most
of your problems.  By the way, QT is written in TP4.

   Hope this helps.
-- 
======================================================================
! Stephen M. Dunn, cs3b3aj@maccs.McMaster.CA ! DISCLAIMER:           !
! This space left unintentionally blank - vi ! I'm only an undergrad !
======================================================================

astieber@csd4.milw.wisc.edu (Anthony J Stieber) (04/21/89)

The package described below can be made available via FTP to this site
or can be mailed (when I get the chance).  Either way let me know if you
want it.  NB: I havn't actually tried it out.
--
Tony Stieber	astieber@csd4.milw.wisc.edu

   TP-TSR                 2/11/89                Richard W. Prescott

   This package illustrates a method for writing TP4/5 interrupt 
   routines with sufficient power and flexibility to support 
   sophisticated resident applications.  The interrupt hook and 
   return procedures are written in assembly language, however the 
   remainder of the application can be written entirely in Pascal, 
   can use up to 64K stack, and can Chain or Return from Interrupt 
   from any point in the Pascal Code.  All source code is provided, 
   and all assembly source code is contained in the Units CONSOLE and 
   DOS21_0A which are provided in both source and compiled form.  
   Users without an assembler can redesign everything but the 
   interrupt hook and return procedures.  

cs3b3aj@maccs.McMaster.CA (Stephen M. Dunn) (04/22/89)

In article <4364@arcturus> mitch@arcturus.UUCP (Mitchell S. Gorman) writes:
>I have a book that's called something like "Advanced Turbo Pascal." (Sorry,
>don't remember the exact name.)  It's got a grey cover, on which it says
>such wonderful things as 'How to use the debugger', 'How to write TSRs',
[ lotsa stuff deleted ]
>VERY handy book.  Lots of info on the debugger, and other good things.
>I think it's what you're looking for (or at least, it's what you need;
>they're not always the same thing.  :^)
>I wish I could remember the exact title, or the author's name.  It's
>published by the same house that puts out that big reference volume for
>Borland.  Of course, I don't remember which one that is, either!! (It's
>either Osbourne of McGraw-Hill, although I suddenly have the sinking
>feeling someone's gonna tell me they're one and the same!)

   You expected this, so here it is:  They're the same ... they're called
Osbourne McGraw-Hill (surprise).

   As for the book (aha!  here's the important part of this post), if you're
looking for this one, make sure you get one that says it's for TP5.  I have
the Turbo PAscal 4 book called "Advanced Turbo Pascal", and it is _not at all_
like the book described above.  It has mostly stuff you'd find in a data
structures or algorithms course, with not much of it being specific to TP4.
In fact, although it has sections on the Database and Graphics toolboxes,
it (for some stupid reason) describes the Turbo 3 versions, not Turbo 4!

   Anyway, what's the point?  Just make sure you check which version you're
buying.


   Hope this helps.

-- 
======================================================================
! Stephen M. Dunn, cs3b3aj@maccs.McMaster.CA ! DISCLAIMER:           !
! Goddamn exams!  I hate them!  I hate them! ! I'm only an undergrad !
======================================================================