                           About TSRUnit

   TSRUnit is a Turbo Pascal unit that allows you to develop your own
TSR's. It is very simple to use and because of the interrupt methods
used is almost impossible to crash.
   In the archive should be:

TSR     .PAS        : The source to TSRUnit
TSR     .TPU        : TSRUnit compiled in Turbo Pascal 5.0
DEMO    .PAS        : Source for a demonstration of all of TSRUnit's
                   features
DEMO    .EXE        : The compiled demonstration
TEST1   .PAS        : Source for a simple TSR
TEST2   .PAS        : Another simple TSR
TSR     .TXT        : This document

  The procedures and fuctions in TSRUnit are as follows:

PROCEDURE TSRInstall (TSRName  : STRING;
                      TSRFunc  : Wordfuncs;
                      ShiftComb: BYTE;
                      KeyChr   : CHAR);

TSRName is the name that you are giving to the TSR program. TSRFunc is
the fuction that you intend to pop up. It must be of type WORD. The
value that the fuction returns should be the number of characters you
want inserted from the TSR back into the program. (See the three demo
programs to understand this more clearly) ShiftComb is the combination
of keys that will be used to pop up the TSR. Four constants are
defined to allow this (Altkey, ctrlkey, leftkey, rightkey). KeyChar is
the character of the key that is to be pressed. It can be any
alphanumeric key. To do multiple combinations add two constants
(Altkey+CtrlKey)


FUNCTION PrinterOkay : Boolean

Returns TRUE if the printer is selected, then printer has paper and no
I/O or time out error has occurred.


FUNCTION PrintStatus : BYTE

Returns the actual status of the printer
Definition of status byte bits: (1 & 2 are not used)
Bit -- 7 ---  ---- 6 ----  -- 5 ---  -- 4 ---  -- 3 --  --- 0 ---
    Not Busy  Acknowledge  No Paper  Selected  I/O Err. Timed-out


FUNCTION ScreenLineStr(Row:BYTE) : String80;

Returns all the characters in the specified row in a character string.



PROCEDURE ScreenLine(Row :BYTE ; VAR Line:LineWords; VAR Words:BYTE);

Returns an array of records, where each record contains a character
and the characters display attribute.


                          Inserting Characters

   TSRUnit will also insert characters from the TSR back into the
environment. To do this the pointer TSRChrPtr must be set to point to
the first character to be inserted, and the return value for TSRFunc
must be set to the number of characters. The only restriction for this
is that the characters must all reside in the same 64K segment of
memory.


                         Over-riding Hot Keys

To allow users of TSR's to avoid hot key confilcts with other
programs, TSRUnit permits the default hotkey combination to be over-
ridden when the TSR is installed. To replace the hotkey combination
include some command line parameters along with the TSR's program
name. The format for these is as follows

[/A] [/C] [/R] [/L] [/"[K["]]]

The square barackets surround optional items (Do not include the
barackets) /A /C /R /L represent the shift key parameters. The command
to install a program called TSRDemo with the hot key combination of
Alt, Left Shift and T is

TSRDemo /A/L/"T

                          Run Time Errors

   When Turbo Pascal detects a run-time error in a program it
automatically terminates it. If this is done in a TSR the chances are
that it will hang your system. In order to avoid this you can do one
of two things. Fisrtly you can write your own I/O checker that dosn't
terminate the program ( you can use the one in DEMO.PAS) You can also
use the printer status functions in TSRUnit. The combination of these
two things should allow you to run TSR's without hanging up your
system (or somebody else's)


Ken Pottebaum
321 Redbud
OK 70346
