home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / 13 / int08h.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.5 KB  |  32 lines

  1.         .
  2.         .
  3.         .
  4. myflag  dw      ?                       ; variable to be incremented
  5.                                         ; on each timer-tick interrupt
  6.  
  7. oldint8 dd      ?                       ; contains address of previous
  8.                                         ; timer-tick interrupt handler
  9.         .
  10.         .                               ; get the previous contents
  11.         .                               ; of the Interrupt 0BH vector...
  12.         mov     ax,3508h                ; AH = 35H (Get Interrupt Vector)
  13.         int     21h                     ; AL = Interrupt number (08H)
  14.         mov     word ptr oldint8,bx     ; save the address of
  15.         mov     word ptr oldint8+2,es   ; the previous Int 08H Handler
  16.         mov     dx,seg myint8           ; put address of the new
  17.         mov     ds,dx                   ; interrupt handler into DS:DX
  18.         mov     dx,offset myint8        ; and call MS-DOS to set vector
  19.         mov     ax,2508h                ; AH = 25H (Set Interrupt Vector)
  20.         int     21h                     ; AL = Interrupt number (08H)
  21.         .
  22.         .
  23.         .
  24. myint8:                                 ; this is the new handler
  25.                                         ; for Interrupt 08H
  26.  
  27.         inc     cs:myflag               ; increment variable on each
  28.                                         ; timer-tick interrupt
  29.  
  30.         jmp     dword ptr cs:[oldint8]  ; then chain to the
  31.                                         ; previous interrupt handler
  32.