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

  1. ;---------------------------------------------------------------
  2. ; Program:      TST12&20.ASM
  3. ;
  4. ; Description:  Demonstrates mouse functions 12 and 20.
  5. ;
  6. ; To Run:       MASM TST12&20;
  7. ;               LINK TST12&20;
  8. ;               TST12&20
  9. ;
  10. ; Note: Program assumes mouse and mouse driver are installed.
  11. ;
  12. ;---------------------------------------------------------------
  13.  
  14. .MODEL  LARGE
  15. .STACK  100h
  16. .CODE
  17.  
  18. ; This is the subroutine activated by function 12
  19. msub    PROC
  20.         mov ax,4                  ; Function 4, Set Mouse Cursor
  21.         xor cx,cx                 ; Left edge of screen
  22.         mov dx,cx                 ; Top edge of screen
  23.         int 33h                   ; Move the cursor
  24.         ret
  25. msub    ENDP
  26.  
  27. ; This is the replacement subroutine for function 20
  28. msub2   PROC
  29.         mov ax,4                  ; Function 4, Set Mouse Cursor
  30.         mov cx,320                ; Middle of screen
  31.         mov dx,100                ; Middle of screen
  32.         int 33h                   ; Move the cursor
  33.         ret
  34. msub2   ENDP
  35.  
  36.         ; Set up DS for the data segment
  37. start:  mov ax,@DATA
  38.         mov ds,ax
  39.  
  40.         ; Mouse Reset and Status
  41.         xor ax,ax
  42.         int 33h
  43.  
  44.         ; Show Cursor
  45.         mov ax,1
  46.         int 33h
  47.  
  48.         ; Set Interrupt Subroutine Call Mask and Address
  49.         mov ax,SEG msub
  50.         mov es,ax                 ; Segment of sub into ES
  51.         mov ax,12                 ; Mouse function 12
  52.         mov cx,8                  ; Interrupt when right button pressed
  53.         mov dx,OFFSET msub        ; Offset of sub into DX
  54.         int 33h
  55.  
  56.         ; Wait for a key press, allowing testing of mouse
  57.         mov ah,8
  58.         int 21h
  59.  
  60.         ; Swap Interrupt Subroutines
  61.         mov ax,20                 ; Mouse function 20
  62.         mov bx,SEG msub2          ; Offset of sub into BX
  63.         mov cx,4                  ; Interrupt when left button released
  64.         mov dx,OFFSET msub2       ; Segment of sub into DX
  65.         int 33h
  66.  
  67.         ; Wait for a key press, allowing testing of mouse
  68.         mov ah,8
  69.         int 21h
  70.  
  71.         ; Reset the mouse to deactivate the interrupt
  72.         xor ax,ax
  73.         int 33h
  74.  
  75.         ; Exit to DOS
  76.         mov ax,4C00h
  77.         int 21h
  78.  
  79. END     start
  80.         END
  81.