home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / MOUSE / CMOUSE2.ZIP / HANDLER.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-04-16  |  1.1 KB  |  65 lines

  1.     include model.inc
  2.  
  3.     include farnear.inc            ; define far or near call sequence
  4.     include smalhuge.inc            ; define far or near data access
  5.  
  6. ; Our program will read the mouse data by referring to addresses relative
  7. ; to the procedure MouseData(). This must be declared as:
  8. ;
  9. ;        void far MouseData();
  10. ;
  11. ; After this, execute this code
  12. ;
  13. ; MOUSTRAP far *data
  14. ; data = (MOUSETRAP far *)MouseData;
  15. ;
  16. ; And now refs like data->what, data->buttons will work.
  17. ;
  18.  
  19.     PUBLIC    _MouseData
  20.  
  21. ; the data structure
  22.  
  23. DGROUP    group        _DATA
  24.  
  25. _DATA        segment  word public 'DATA'
  26. _MouseData    LABEL    FAR        ; creates a fake procedure
  27.  
  28. What            DW        0
  29. Buttons        DW        0
  30. X_pos            DW        0
  31. Y_pos            DW        0
  32. X_mickeys    DW        0
  33. Y_mickeys    DW        0
  34.  
  35. _DATA        ends
  36.  
  37. _TEXT    segment  word public 'CODE'
  38.  
  39.         assume    cs:_TEXT,ds:DGROUP
  40.  
  41. ; the interrupt handler
  42.  
  43.     PUBLIC    _handler
  44. _handler        PROC    FAR
  45.     cli
  46.     push    ds
  47.     push    ax
  48.     mov    ax,DGROUP
  49.     mov    ds,ax
  50.     pop    ax
  51.     mov    What,ax
  52.     mov    Buttons,bx
  53.     mov    X_pos,cx
  54.     mov    Y_pos,dx
  55.     mov    X_mickeys,di
  56.     mov    Y_mickeys,si
  57.     pop    ds
  58.     sti
  59.     ret
  60.  
  61. _handler    ENDP
  62. _TEXT        ends
  63.  
  64.     END
  65.