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