home *** CD-ROM | disk | FTP | other *** search
- ;---------------------------------------------------------------
- ; Program: TST12&20.ASM
- ;
- ; Description: Demonstrates mouse functions 12 and 20.
- ;
- ; To Run: MASM TST12&20;
- ; LINK TST12&20;
- ; TST12&20
- ;
- ; Note: Program assumes mouse and mouse driver are installed.
- ;
- ;---------------------------------------------------------------
-
- .MODEL LARGE
- .STACK 100h
- .CODE
-
- ; This is the subroutine activated by function 12
- msub PROC
- mov ax,4 ; Function 4, Set Mouse Cursor
- xor cx,cx ; Left edge of screen
- mov dx,cx ; Top edge of screen
- int 33h ; Move the cursor
- ret
- msub ENDP
-
- ; This is the replacement subroutine for function 20
- msub2 PROC
- mov ax,4 ; Function 4, Set Mouse Cursor
- mov cx,320 ; Middle of screen
- mov dx,100 ; Middle of screen
- int 33h ; Move the cursor
- ret
- msub2 ENDP
-
- ; Set up DS for the data segment
- start: mov ax,@DATA
- mov ds,ax
-
- ; Mouse Reset and Status
- xor ax,ax
- int 33h
-
- ; Show Cursor
- mov ax,1
- int 33h
-
- ; Set Interrupt Subroutine Call Mask and Address
- mov ax,SEG msub
- mov es,ax ; Segment of sub into ES
- mov ax,12 ; Mouse function 12
- mov cx,8 ; Interrupt when right button pressed
- mov dx,OFFSET msub ; Offset of sub into DX
- int 33h
-
- ; Wait for a key press, allowing testing of mouse
- mov ah,8
- int 21h
-
- ; Swap Interrupt Subroutines
- mov ax,20 ; Mouse function 20
- mov bx,SEG msub2 ; Offset of sub into BX
- mov cx,4 ; Interrupt when left button released
- mov dx,OFFSET msub2 ; Segment of sub into DX
- int 33h
-
- ; Wait for a key press, allowing testing of mouse
- mov ah,8
- int 21h
-
- ; Reset the mouse to deactivate the interrupt
- xor ax,ax
- int 33h
-
- ; Exit to DOS
- mov ax,4C00h
- int 21h
-
- END start
- END