home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cl5sr386.zip / GO32 / EVINTR.ASM < prev    next >
Assembly Source File  |  1992-04-13  |  3KB  |  141 lines

  1. ;;;
  2. ;;; EVINTR.ASM
  3. ;;;  Interrupt handlers for an interrupt-driven mouse and keyboard event queue
  4. ;;;  mechanism for Turbo C and DJGPP (under MS DOS of course)
  5. ;;;
  6. ;;;  Copyright (C) 1992, Csaba Biegl
  7. ;;;    [820 Stirrup Dr, Nashville, TN, 37221]
  8. ;;;    [csaba@vuse.vanderbilt.edu]
  9. ;;;
  10. ;;;  This program is free software; you can redistribute it and/or modify
  11. ;;;  it under the terms of the GNU General Public License as published by
  12. ;;;  the Free Software Foundation.
  13. ;;;
  14. ;;;  This program is distributed in the hope that it will be useful,
  15. ;;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ;;;  GNU General Public License for more details.
  18. ;;;
  19. ;;;  You should have received a copy of the GNU General Public License
  20. ;;;  along with this program; if not, write to the Free Software
  21. ;;;  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. ;;;
  23.  
  24. _TEXT    segment byte public 'CODE'
  25. _TEXT    ends
  26.  
  27. _TEXT    segment byte public 'CODE'
  28.     assume  cs:_TEXT,ds:NOTHING
  29.  
  30. ;;
  31. ;; mouse interrupt routine -- called by the mouse handler callback mechanism
  32. ;;
  33. __ev_mouseint    proc    far
  34.     pushf
  35.     cli
  36.     push    cx
  37.     push    dx
  38.     mov    cx,sp
  39.     mov    dx,ss
  40.     mov    ss,WORD PTR cs:__ev_interss
  41.     mov    sp,WORD PTR cs:__ev_msintsp
  42.     sti
  43.     push    ax
  44.     push    bx
  45.     push    cx
  46.     push    dx
  47.     push    es
  48.     push    ds
  49.     mov    ds,WORD PTR cs:__ev_interds
  50.     push    di
  51.     push    si
  52.     push    bx
  53.     push    ax
  54.     call    FAR PTR __ev_mousehandler
  55.     add    sp,8
  56.     pop    ds
  57.     pop    es
  58.     pop    dx
  59.     pop    cx
  60.     pop    bx
  61.     pop    ax
  62.     cli
  63.     mov    ss,dx
  64.     mov    sp,cx
  65.     pop    dx
  66.     pop    cx
  67.     popf
  68.     ret
  69. __ev_mouseint    endp
  70.  
  71. ;;
  72. ;; keyboard interrupt handler -- replaces the int 9 vector
  73. ;;
  74. __ev_keybdint    proc    far
  75.     inc    WORD PTR cs:__ev_kbinter
  76.     jz    kbint_proceed
  77.     dec    WORD  PTR cs:__ev_kbinter
  78.     jmp    DWORD PTR cs:__ev_oldkbint
  79. kbint_proceed:
  80.     cli
  81.     push    cx
  82.     push    dx
  83.     mov    cx,sp
  84.     mov    dx,ss
  85.     mov    ss,WORD PTR cs:__ev_interss
  86.     mov    sp,WORD PTR cs:__ev_kbintsp
  87.     pushf
  88.     call    DWORD PTR cs:__ev_oldkbint
  89.     sti
  90.     push    ax
  91.     push    bx
  92.     push    cx
  93.     push    dx
  94.     push    es
  95.     push    ds
  96.     mov    ds,WORD PTR cs:__ev_interds
  97.     call    FAR PTR __ev_keybdhandler
  98.     pop    ds
  99.     pop    es
  100.     pop    dx
  101.     pop    cx
  102.     pop    bx
  103.     pop    ax
  104.     cli
  105.     mov    ss,dx
  106.     mov    sp,cx
  107.     pop    dx
  108.     pop    cx
  109.     dec    WORD PTR cs:__ev_kbinter
  110.     iret
  111. __ev_keybdint    endp
  112.  
  113. __ev_oldkbint    label    dword
  114.     db    4 dup (?)
  115. __ev_kbinter    label    word
  116.     db    2 dup (?)
  117. __ev_interss    label    word
  118.     db    2 dup (?)
  119. __ev_kbintsp    label    word
  120.     db    2 dup (?)
  121. __ev_msintsp    label    word
  122.     db    2 dup (?)
  123. __ev_interds    label    word
  124.     db    2 dup (?)
  125. _TEXT    ends
  126.  
  127.     public  __ev_keybdint
  128.     public  __ev_mouseint
  129.     public  __ev_msintsp
  130.     public  __ev_kbintsp
  131.     public  __ev_interss
  132.     public  __ev_interds
  133.     public  __ev_kbinter
  134.     public  __ev_oldkbint
  135.  
  136.     extrn    __ev_keybdhandler:far
  137.     extrn    __ev_mousehandler:far
  138.  
  139.     end
  140.  
  141.