home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / asm / IRQJMP.ZIP / IRQJMP.ASM
Encoding:
Assembly Source File  |  1991-07-08  |  2.4 KB  |  75 lines

  1. DATA     SEGMENT     WORD PUBLIC
  2. ENDS
  3.  
  4. CODE     SEGMENT     WORD PUBLIC
  5.          ASSUME      CS:CODE, DS:DATA
  6.          PUBLIC      IrqJmp
  7. ;-----------------------------------------------------------------------
  8. ; PROCEDURE IrqJmp(p:pointer);
  9. ; Effect  : Jumps to the address pointed to with p.
  10. ; Purpose : To guarantee the return of the program flow to the old
  11. ;           routine, when it has been intercepted by a self constructed
  12. ;           interrupt procedure. IrqJmp is called last in the interrupt
  13. ;           procedure, p must contain the interrupt vector of the original
  14. ;           interrupt routine.
  15.  
  16. IrqJmp  PROC    Near
  17.  
  18. taill       EQU   WORD Ptr[BP+04]
  19. tailh       EQU   WORD Ptr[BP+06]
  20.  
  21.             PUSH BP
  22.             MOV BP,SP         ; establish bp adressability
  23.             MOV AX,tailh      ; get highpart of interrupt vector
  24.             MOV cs:hirq,AX    ; store it at hi jumpaddress
  25.             MOV AX,taill      ; get lopart of intvec
  26.             MOV cs:lirq,AX    ; store it at lo jump address
  27.             MOV SP,BP
  28.             POP BP
  29.             POP AX ;dummy pop to remove return address of irqjmp from stack.
  30.  
  31.                    ; the following part is the exact reversal of the entry
  32.                    ; code of the (calling) interrupt procedure generated by
  33.                    ; TP.
  34.  
  35.             MOV SP,BP
  36.             POP BP
  37.             POP ES
  38.             POP DS
  39.             POP DI
  40.             POP SI
  41.             POP DX
  42.             POP CX
  43.             POP BX
  44.             POP AX
  45.                     ; to return to original/intercepted interrupt routine
  46. jump        DB 0EAh ;jmp [p]
  47.  
  48. lirq        DW ?
  49. hirq        DW ?
  50.  
  51. IrqJmp  ENDP
  52.  
  53. CODE     ENDS              ; End of CODE segment
  54.          END               ; End of text.
  55.  
  56. Comments:
  57.  
  58. It can be assembled with either TASM or a86 (an excellent shareware
  59. assembler written by eric isaacson, which can be downloaded from any
  60. selfrespecting bbs)
  61.  
  62. C>TASM irqjmp.asm
  63. C>A86 irqjmp.asm irqjmp.obj
  64.  
  65. I've tested it with both tasm and a86 and it works though I got one hangup
  66. with the version with the tasm generated object file. After checking it
  67. with td there didn't seem to be any difference between the versions
  68. generated by a86 and tasm, so I assume one of the MANY other TSR's in my
  69. memory are responsible for this behavior. 8-(
  70. Ah well, have fun with it.
  71.  
  72. Met Vriendelijke Groeten,
  73.  
  74.                Wiebe Wiersema.
  75.