home *** CD-ROM | disk | FTP | other *** search
- ;-----------------------------------------------------------------------------
- ;;
- ;; HOW TO CHANGE THE GRAPHICS MOUSE POINTER USING INTERRUPT 33H SERVICE 09H
- ;;
- ;; This service defines the mouse pointer shape and hot spot in graphics
- ;; mode. It does not affect the text mode pointer. The image pointer buffer
- ;; consists of two 32-byte sections for a total length of 64-bytes. The first
- ;; 32-byte secton contains a bit image that the mouse driver ANDs with the
- ;; screen image. The second 32-byte secton contains a bit image that the
- ;; mouse driver XORs with the screen image. The mouse driver uses the hot
- ;; spot to determine mouse position during a button press. The mouse hot spot
- ;; values can range from 16 to -16. The mouse driver uses the upper-left
- ;; corner (0,0) of the mouse pointer bit map as the reference point for the
- ;; hot spot. You must use an even value for horizontal hot spot offset in
- ;; display modes 4 and 5.
- ;;
- ;; Register contents on entry:
- ;;
- ;; AX - 9
- ;; BX - Hot Spot offset from left.
- ;; CX - Hot Spot offset from top.
- ;; DX - Offset of pointer image buffer
- ;; ES - Segment of pointer image buffer.
- ;;
- ;;
- ;----------------------------------------------------------
- ;;
- code SEGMENT
- ASSUME cs:code, ds:code, es:code
- ORG 100h
- start:
- jmp show_new_mouse
- ;;
- ;----------------------------------------------------------
- ;;
- ;; If you look closely to the two bit maps below, you can see the finger
- ;; pointing hand images. The second image is the exact opposite of the first.
- ;;
- ;; The first 32-byte image is AND with the screen image.
- ;;
- FINGER_POINTER DW 1111111111111111b
- DW 1111001111111111b
- DW 1111001111111111b
- DW 1111001111111111b
- DW 1111001111111111b
- DW 1111001111111111b
- DW 1111001001001001b
- DW 1111001001001001b
- DW 1001001001001001b
- DW 1001001001001001b
- DW 1001001001001001b
- DW 1000000000000001b
- DW 1000000000000001b
- DW 1000000000000001b
- DW 1000000000000001b
- DW 1111111111111111b
- ;;
- ;; The second 32-byte image is XOR with the screen image.
- ;;
- DW 0000000000000000b
- DW 0000110000000000b
- DW 0000110000000000b
- DW 0000110000000000b
- DW 0000110000000000b
- DW 0000110000000000b
- DW 0000110110110110b
- DW 0000110110110110b
- DW 0110110110110110b
- DW 0110110110110110b
- DW 0110110110110110b
- DW 0111111111111110b
- DW 0111111111111110b
- DW 0111111111111110b
- DW 0111111111111110b
- DW 0000000000000000b
- ;;
- ;----------------------------------------------------------
- ;;
- SAVED_VIDEO_MODE DB 0
- MESSAGE DB 0dh, 0ah, 'Graphic mouse finger pointer.', 0dh, 0ah
- DB 0dh, 0ah, 'Press any key to exit program.$'
- ;;
- ;----------------------------------------------------------
- ;;
- show_new_mouse PROC NEAR
- mov ah, 0fh ; save the current video mode.
- int 10h
- cmp al, 7 ; if its 7 then its a monochrome.
- je not_possible ; can't do graphics on a mono!
- mov SAVED_VIDEO_MODE, al ; looks ok, save video mode.
- ;;
- mov ax, 0 ; see if there is a mouse driver.
- int 33h
- cmp ax, 0 ; is there one installed?
- je not_possible ; no - have to exit.
- ;;
- mov ah, 0 ; everything looks good.
- mov al, 6 ; set video to 640x200 graphics.
- int 10h
- mov ax, 9 ; service 9 change pointer shape.
- mov bx, 8 ; place the Hot Spot in the
- mov cx, 16 ; center of the finger pointer.
- lea dx, FINGER_POINTER ; get the offset of image.
- push cs ; push segment of image
- pop es ; into the ES register.
- int 33h
- ;;
- mov ax, 1 ; show the modified mouse pointer.
- int 33h
- ;;
- mov ah, 9 ; display the how to exit message.
- lea dx, MESSAGE
- int 21h
- ;;
- mov ah, 0 ; wait for user to press key.
- int 16h
- ;;
- mov ah, 0 ; restore original video mode.
- mov al, SAVED_VIDEO_MODE
- int 10h
- ;;
- not_possible:
- int 20h ; return to DOS prompt.
- show_new_mouse ENDP
- ;;
- ;-----------------------------------------
- ;;
- code ENDS
- END start
-