Chaining ISR 
Author Message
 Chaining ISR

I have been quite baffeled at how to chain  isr. I have the keyboard changed
to point to my own procedure now I need to call the old one after the my own
procedure.  So anybody know how to chain ISRs?


Sun, 24 May 1998 03:00:00 GMT  
 Chaining ISR

Quote:
>I have been quite baffeled at how to chain  isr. I have the keyboard changed
>to point to my own procedure now I need to call the old one after the my own
>procedure.  So anybody know how to chain ISRs?

Deric,

  I have done this many times in Assembler, but it can be readily done in
Pascal.  I will outline for you what you need to do, but there may be a few
more tricks to get this to work correctly.  Borland/Turbo pascal lets you
embed Assembler into the Pascal code and you will need to do that.

        1. Save the original interrupt vector.

        2. Replace the interrupt vector with the address of your new routine.

        3. You have two methods to access the original routine:

           1) To CALL the original routine, the following is used to simulate an
              interrupt call:

                asm
                  PUSHF
                  CALL    DWORD PTR SAVED_INT_VECTOR
                end;

              Be careful with this method, as the original interrupt will
execute
              the following end of interrupt sequence so you won't need to:

                asm
                  MOV     AL,20H
                  OUT     20H,AL
                end;

           2) Alternatively, at the end of your routine, you can clean up the
              stack and then jump to the original routine.  For Borland/Turbo
              pascal you would use the following from an intterupt procedure:

                asm
                  MOV     SP,BP
                  POP     BP
                  POP     ES
                  POP     DS
                  POP     DI
                  POP     SI
                  POP     DX
                  POP     CX
                  POP     BX
                  POP     AX
                  JMP     DWORD PTR CS:SAVED_INT_VECTOR

                SAVED_INT_VECTOR: DD ?
                end;

              However, for this second method to work, the saved vector must
              be addressable by the code segment, CS.

  Let me know if you have any problems with this.  I know it doesn't look
like Pascal, but the sweet thing is the rest of you code will be Pascal with
only a few imbedded assembler statements.

Thanks!

+-----------------------------------------------+
| Ron Muzzi                                     |
| Electronics Engineer                          |
|                                               |
| NOAA/Great Lakes Environmental Research Lab   |
| 2205 Commonwealth Blvd.                       |
| Ann Arbor, MI 48105                           |
|                                               |
| Phone: 313-741-2007                           |
| Fax:   313-741-2055                           |

+-----------------------------------------------+



Mon, 25 May 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Chain-4

2. BP7 protected mode chain to another program

3. Serial Communications interupt chaining.

4. Trouble with interrupt chaining

5. Chaining mouse event handlers in BP7

6. Problem CHAINING to an EXE file

7. Chaining to timer interrupt from protected mode

8. BP7/DOS: Chaining object methods (rather than calling them)

9. chained pointers

10. Chaining

11. Clock ISR in Turbo Pascal 7

12. using built-in assembler for ISR's

 

 
Powered by phpBB® Forum Software