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

  1. myint8:                                 ; this is the new handler
  2.                                         ; for Interrupt 08H
  3.  
  4.         mov     ax,1                    ; test and set interrupt-
  5.         xchg    cs:myflag,ax            ; handling-in-progress semaphore
  6.  
  7.         push    ax                      ; save the semaphore
  8.  
  9.         pushf                           ; simulate interrupt, allowing 
  10.         call    dword ptr cs:oldint8    ; the previous handler for the
  11.                                         ; Interrupt 08H vector to run
  12.  
  13.         pop     ax                      ; get the semaphore back
  14.         or      ax,ax                   ; is our interrupt handler
  15.                                         ; already running?
  16.  
  17.         jnz     myint8x                 ; yes, skip this one
  18.  
  19.         .                               ; now perform our interrupt
  20.         .                               ; processing here...
  21.         .
  22.  
  23.         mov     cs:myflag,0             ; clear the interrupt-handling-
  24.                                         ; in-progress flag
  25.  
  26. myint8x:
  27.         iret                            ; return from interrupt
  28.