home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / snip0693.zip / MOUSE.ASM < prev    next >
Assembly Source File  |  1993-02-13  |  5KB  |  224 lines

  1. ;If you have Turbo Assembler or MASM, here's a Clipper callable
  2. ;generic mouse driver interface.
  3. ;
  4. ;You can make *any* mouse call you want via the MsDriver()
  5. ;function and then query the results via the MsAX(), MsBX(),
  6. ;MsCX(), and MsDX() functions (the Microsoft Mouse Programmer's
  7. ;Reference would be handy).  A Clipper 5.0x source code module,
  8. ;containing some useful functions, follows in the next message.
  9. ;
  10. ;The text "-=[ End of Message ]=-" marks the end of each message
  11. ;- if you don't see it, something ate the message.
  12. ; MOUSE.ASM
  13. ;
  14. ; Microsoft Mouse Driver Interface for Clipper.
  15. ;
  16. ; This code is an original work placed into the public domain by
  17. ; the author, Todd C. MacDonald.
  18. ;
  19. ; Assemble with "TASM MOUSE".
  20.  
  21. PUBLIC MsDriver, MsAX, MsBX, MsCX, MsDX
  22.  
  23. EXTRN   __parni         : FAR
  24. EXTRN   __retni         : FAR
  25.  
  26. MS_INT  equ     33H
  27.  
  28. DGROUP GROUP    data
  29.  
  30. data    SEGMENT PUBLIC  'DATA'
  31.  
  32.         ValAX   DW 0
  33.         ValBX   DW 0
  34.         ValCX   DW 0
  35.         ValDX   DW 0
  36.  
  37. data    ENDS
  38.  
  39. code    SEGMENT 'CODE'
  40.         ASSUME cs:code, ds:DGROUP
  41.  
  42.  
  43. ; /-------------------------------------------------------------\
  44. ; | MsDriver                                                    |
  45. ; \-------------------------------------------------------------/
  46.  
  47. MsDriver        PROC    FAR
  48.  
  49.         ; save registers
  50.         push    ds
  51.         push    es
  52.         push    si
  53.         push    di
  54.  
  55.         ; push 4th parameter onto stack
  56.         mov     ax, 4
  57.         push    ax
  58.         call    __parni
  59.         add     sp, 2
  60.         push    ax
  61.  
  62.         ; push 3rd parameter onto stack
  63.         mov     ax, 3
  64.         push    ax
  65.         call    __parni
  66.         add     sp, 2
  67.         push    ax
  68.  
  69.         ; push 2nd parameter onto stack
  70.         mov     ax, 2
  71.         push    ax
  72.         call    __parni
  73.         add     sp, 2
  74.         push    ax
  75.  
  76.         ; put 1st parameter (mouse function number) in ax
  77.         mov     ax, 1
  78.         push    ax
  79.         call    __parni
  80.         add     sp, 2
  81.  
  82.         ; put 2nd, 3rd, 4th parameters into BX, CX, and DX
  83.         pop     bx
  84.         pop     cx
  85.         pop     dx
  86.  
  87.         int     MS_INT
  88.  
  89.         ; store results
  90.         mov     ValAX, ax
  91.         mov     ValBX, bx
  92.         mov     ValCX, cx
  93.         mov     ValDX, dx
  94.  
  95.         ; restore registers
  96.         pop     di
  97.         pop     si
  98.         pop     es
  99.         pop     ds
  100.  
  101.         ret
  102.  
  103. MsDriver        ENDP
  104.  
  105.  
  106. ; /-------------------------------------------------------------\
  107. ; | MsAX                                                        |
  108. ; \-------------------------------------------------------------/
  109.  
  110. MsAX    PROC    FAR
  111.  
  112.         ; save important registers
  113.         push    ds
  114.         push    es
  115.         push    si
  116.         push    di
  117.  
  118.         ; return ValAX to Clipper
  119.         mov     ax, ValAX
  120.         push    ax
  121.         call    __retni
  122.         add     sp, 2
  123.  
  124.         ; restore registers
  125.         pop     di
  126.         pop     si
  127.         pop     es
  128.         pop     ds
  129.  
  130.         ret
  131.  
  132. MsAX    ENDP
  133.  
  134.  
  135. ; /-------------------------------------------------------------\
  136. ; | MsBX                                                        |
  137. ; \-------------------------------------------------------------/
  138.  
  139. MsBX    PROC    FAR
  140.  
  141.         ; save important registers
  142.         push    ds
  143.         push    es
  144.         push    si
  145.         push    di
  146.  
  147.         ; return ValBX to Clipper
  148.         mov     ax, ValBX
  149.         push    ax
  150.         call    __retni
  151.         add     sp, 2
  152.  
  153.         ; restore registers
  154.         pop     di
  155.         pop     si
  156.         pop     es
  157.         pop     ds
  158.  
  159.         ret
  160.  
  161. MsBX    ENDP
  162.  
  163.  
  164. ; /-------------------------------------------------------------\
  165. ; | MsCX                                                        |
  166. ; \-------------------------------------------------------------/
  167.  
  168. MsCX    PROC    FAR
  169.  
  170.         ; save important registers
  171.         push    ds
  172.         push    es
  173.         push    si
  174.         push    di
  175.  
  176.         ; return ValCX to Clipper
  177.         mov     ax, ValCX
  178.         push    ax
  179.         call    __retni
  180.         add     sp, 2
  181.  
  182.         ; restore registers
  183.         pop     di
  184.         pop     si
  185.         pop     es
  186.         pop     ds
  187.  
  188.         ret
  189.  
  190. MsCX    ENDP
  191.  
  192.  
  193. ; /-------------------------------------------------------------\
  194. ; | MsDX                                                        |
  195. ; \-------------------------------------------------------------/
  196.  
  197. MsDX    PROC    FAR
  198.  
  199.         ; save important registers
  200.         push    ds
  201.         push    es
  202.         push    si
  203.         push    di
  204.  
  205.         ; return ValDX to Clipper
  206.         mov     ax, ValDX
  207.         push    ax
  208.         call    __retni
  209.         add     sp, 2
  210.  
  211.         ; restore registers
  212.         pop     di
  213.         pop     si
  214.         pop     es
  215.         pop     ds
  216.  
  217.         ret
  218.  
  219. MsDX    ENDP
  220.  
  221. code    ENDS
  222.  
  223.         END
  224.