home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / d / dec92.zip / 1012049A < prev    next >
Text File  |  1992-10-09  |  2KB  |  128 lines

  1. page ,132
  2.  
  3. ; masm tisr ; >err
  4.     .286p
  5. .xlist
  6. include bogus.inc
  7. include pic.h
  8. .list
  9.  
  10. WM_COMMAND        = 0111h
  11.  
  12. EXTRN POSTMESSAGE:FAR
  13.  
  14. Words struc
  15. LoWord dw ?
  16. HiWord dw ?
  17. Words ends
  18.  
  19. ;
  20. ; Set variables for our interrupt number
  21. ;
  22. ife (FAKE_IRQ GE 8)
  23. INT_DEV equ (INT_MASTER_0+(FAKE_IRQ AND 7))
  24. PIC00 equ INTA00
  25. PIC01 equ INTA01
  26. else
  27. INT_DEV equ (INT_SLAVE_0+(FAKE_IRQ AND 7))
  28. INT_MASK equ 1 SHL (FAKE_IRQ AND 7)
  29. PIC00 equ INTB00
  30. PIC01 equ INTB01
  31. endif
  32.  
  33. page
  34.  
  35. FIXED_DATA SEGMENT DWORD PUBLIC 'DATA'
  36. PUBLIC _hWndEvent,_wParamEvent,_wCount
  37.  
  38. _hWndEvent label word
  39. hWndEvent dw  0         ; Window to post events to
  40.  
  41. _wParamEvent label word
  42. wParamEvent dw    0        ; wParam value to post
  43.  
  44. _wCount label word
  45. wCount dw  0            ; count of unprocessed interrupts
  46.  
  47. FIXED_DATA ENDS
  48.  
  49. page
  50.  
  51. ;IP    IntSvcRtn - The Interrupt Service Routine
  52. ;
  53. ;    WARNINGS
  54. ;
  55. ;    NOTES
  56. ;        This ISR increments a count and re-arms the device.
  57. ;        If the count was previously zero, a message is posted.
  58. ;
  59. ;        If the "fStopping" flag is set, the device is not re-armed.
  60. ;
  61.  
  62. FIXED_TEXT SEGMENT PARA PUBLIC 'CODE'
  63. selData1    dw    FIXED_DATA
  64.     assume    CS:FIXED_TEXT,DS:NOTHING
  65. PUBLIC _IntSvcRtn
  66. _IntSvcRtn label far
  67. IntSvcRtn proc far
  68.     push    ax
  69.     push    dx
  70.     push    ds
  71.     mov    ds,selData1
  72.     assume    ds:FIXED_DATA
  73.     inc    wCount
  74.     mov    al,NOT FAKE_CTL_EOI
  75.     mov    dx,FAKE_PORT
  76.     out    dx,al            ; send EOI to device
  77.     mov    al,EOI
  78.     out    PIC00,al        ; send EOI to PIC
  79. ife (PIC00 EQ INTA00)
  80.     out    INTA00,al        ; send EOI to master PIC, too
  81. endif
  82.     cmp    hWndEvent,0        ; exiting?
  83.     jz    isr9            ; if so, then don't restart or post
  84.     cmp    wCount,1        ; Need to post?
  85.     jne    isr8            ; skip if not
  86.  
  87.     push    bx            ; save the remaining registers
  88.     push    cx
  89.     push    es
  90.  
  91.     push    hWndEvent
  92.     push    WM_COMMAND
  93.     push    wParamEvent
  94.     push    0    ; lParam is zero
  95.     push    0
  96.     call    POSTMESSAGE        ; post the event
  97.  
  98.     pop    es
  99.     pop    cx
  100.     pop    bx
  101.  
  102. isr8:
  103.     mov    al,NOT FAKE_CTL_START
  104.     mov    dx,FAKE_PORT
  105.     out    dx,al            ; restart I/O
  106. isr9:
  107.     pop    ds
  108.     assume    ds:NOTHING
  109.     pop    dx
  110.     pop    ax
  111.     iret
  112. IntSvcRtn endp
  113.  
  114.  
  115. ; Needed by AllocIntReflector
  116. PUBLIC _BogusCallback
  117. _BogusCallback label far
  118. BogusCallback proc far
  119.     pushf
  120.     call    IntSvcRtn
  121.     ret
  122. BogusCallback endp
  123.  
  124. FIXED_TEXT ENDS
  125.  
  126.  
  127.     end
  128.