home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / MOUSE / MSMOUSE1.ZIP / C&QC.ZIP / M20SUB.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-02-10  |  2.1 KB  |  42 lines

  1. ;******************************************************************
  2. ;*  M20SUB.ASM                                                    *
  3. ;*                                                                *
  4. ;*  Macro Assembler subroutine for C/QuickC program PENCIL.C      *
  5. ;*                                                                *
  6. ;*  _NewMouseHardwareSub:                                         *
  7. ;*  Description: Passes the mouse variables to the C routine      *
  8. ;*               when a mouse interrupt occurs                    *
  9. ;*                                                                *
  10. ;*  This code is to be linked with PENCIL.C                       *
  11. ;*  Example:                                                      *
  12. ;*  masm /Ml m20sub;                                              *
  13. ;*  cl /AM pencil.c m20sub.obj -link mouse                        *
  14. ;******************************************************************
  15.  
  16. EXTRN _ButtonState:WORD            ; Mouse button state
  17. EXTRN _HorizCursCoord:WORD         ; Current horizontal cursor position
  18. EXTRN _VertCursCoord:WORD          ; Current vertical cursor position
  19. EXTRN _MouseConditionBits:WORD     ; Condition that resulted
  20.                                    ; in calling this routine.
  21.  
  22. code SEGMENT para public 'code'
  23.         assume cs:code
  24.         public _NewMouseHardwareSub
  25.  
  26. _NewMouseHardwareSub PROC far      ; Far procedure
  27.         push DS                    ; Save current data segment
  28.         push AX                    ; Save condition mask
  29.         mov AX,SEG _ButtonState    ; Load data segment
  30.         mov DS,AX
  31.         pop AX                     ; Restore condition mask
  32.         mov _MouseConditionBits,ax ; Pass condition to C routine
  33.         mov _ButtonState,BX        ; Pass button state to C routine
  34.         mov _HorizCursCoord,CX     ; Pass cursor coordinates to C routine
  35.         mov _VertCursCoord,DX
  36.         pop DS                     ; Restore data segment
  37.         RET                        ; Far return
  38. _NewMouseHardwareSub ENDP
  39.  
  40. code ENDS
  41. end                                ; End of NewMouseHardwareSub
  42.