home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / WIH.ZIP / README.NEW < prev    next >
Encoding:
Text File  |  1987-02-01  |  5.0 KB  |  90 lines

  1. This describes some extensions of the ideas first demonstrated in SIH.PAS
  2. The basic concept is still to run a program that attaches itself to a DOS
  3. software interupt and terminates but stays resident, and then to activate
  4. it using the INTR function from another program. All the programs are written
  5. in Turbo PASCAL, and source code is included.  The extensions include:
  6.    1. saving and restoring registers locally instead of on the stack.
  7.    2. being able to manipuate values passed in the registers
  8.    3. attaching multiple interupts within a single resident program
  9.    4. activating one interupt from another (and I thought it couldn't
  10.       be done)
  11.    5. placing the interupt service in a subprocedure and include file
  12.    6. having the interupt procedure handle only the system services
  13.       (i.e. obtaining and restoring register values) and calling a user
  14.       procedure to do anythng else
  15.    7. demonstrating some fairly extensive user procedures (using windows)
  16.  
  17. This library contains the following files:
  18.    SIHREG  .PAS - simplest form of interupt demonstration
  19.    SIH     .INC - contains the interupt handler code and user documentation
  20.    INTCALL .PAS - program to call the interupts
  21.    WIH     .PAS - more complex demonstration with windowed user procedure
  22.    NEWSCRN .INC - windowing procedures (see WIH for example)
  23.    MIH     .PAS - demonstration of multiple interupts gets its
  24.                   user procedures from include files
  25.    SHOW_REG.INC - user procedure to view and change registers
  26.    SHOW_SEG.INC - user procedure to view current segment registers
  27.    CALL41  .INC - user procedure to call interupt $41
  28.    SIH_GLOB.INC - declaration of type and variables that must be global
  29.                   (this has been copied into WIH, MIH etc.)
  30.  
  31. To try these programs, compile one or more of SIHREG, WIH, or MIH.  Use
  32. options menu to select COM file (C option) and limit the stack segment to
  33. $400 paragrapghs (A option).  Compile INTCALL with the same options.
  34. Run the first program.  There is normally no output.  Now run INTCALL.
  35. It will let you look at the interupt vectors. Press "y" if you want to, but
  36. it is unnecessary.  Select interupt 65 ($41). You may set values of AX,BX and
  37. DI (choosen arbitraritly; if you decide to write a more powerfull test program
  38. please upload a copy). The interupt handler will become active. All the user
  39. routines are self explanatory, but none does any error checking of input.
  40. Be careful to follow Turbo format for entering register values,
  41. (e.g. 111 222 333).  If you have compiled and run MIH you can also select
  42. interupt 66 ($42).  Its has CALL41 as its user procedure and can activate
  43. the other interupt.  I have seen some inconsistancy in the way register
  44. values are passed and preserved.  I'm not ceratain the scheme for using
  45. global variables works when interupt handlers in the same program call each
  46. other.  I'm working on a way to eliminate the globals entirely.
  47.  
  48. I hope the system of include files makes this code easier to work with.  To
  49. prepare your own program, follow this pattern.
  50.  
  51.     Program Main;
  52.     (*$ISIH_GLOB.INC*)  for declaration of variable to hold register values
  53.      {your global declarations}
  54.      {subprocedures needed by your main or user procedures}
  55.  
  56.     Procedure Interupt_Handler;  {The name is your choice. Call it once
  57.                                  from the main program}
  58.     Const Interupt_Number = $41; {The name is required. You may choose any
  59.                                  value, but first be sure DOS does't use it.}
  60.        Procedure User_Procedure:
  61.          Begin                   {The name must be as shown, but the code
  62.                                   is up to you. Select from one of the
  63.                                   procedures in the include files or roll
  64.                                   your own.  Please upload any good ones.}
  65.          End;
  66.  
  67. (*$ISIH.INC*)                    {supplies the interupt handler code}
  68.  
  69. Begin {main procedure}
  70.    Interupt_Handler;             {call it once to initialize}
  71.         {any initialization for your user procedure}
  72.    SETUP.DX := $400              {reserve 16K for resident code}
  73.                                  {you may need more!}
  74.    SETUP.AH := $31               {DOS fuction to terminate resident}
  75.    MsDos(Setup);                 {Setup is of type RegisterSet which is
  76.                                   defined in SIH_GLOB.INC}
  77. End.
  78.  
  79. Please leave any comments, suggestions, or ideas in messages here.
  80. These programs are evolving very quickly right now, so I would prefer that
  81. no one else upload them to other boards.  We will end up proliferating too
  82. many copies of too many versions.  If you can incorprate the ideas into your
  83. own programs, however, your welcome to use or distribute them any way you
  84. want.  Please give me a mention if you do.
  85.  
  86.                                                   July 12, 1985
  87.                        Steve Smith
  88.                        Severna Park, MD
  89.                         647 - 7139
  90.