home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / pointer / finger.asm next >
Assembly Source File  |  1993-03-16  |  6KB  |  130 lines

  1. ;-----------------------------------------------------------------------------
  2. ;;
  3. ;; HOW TO CHANGE THE GRAPHICS MOUSE POINTER USING INTERRUPT 33H SERVICE 09H
  4. ;;
  5. ;;      This service defines the mouse pointer shape and hot spot in graphics
  6. ;; mode. It does not affect the text mode pointer.  The image pointer buffer
  7. ;; consists of two 32-byte sections for a total length of 64-bytes. The first
  8. ;; 32-byte secton contains a bit image that the mouse driver ANDs with the
  9. ;; screen image.  The second 32-byte secton contains a bit image that the 
  10. ;; mouse driver XORs with the screen image.  The mouse driver uses the hot 
  11. ;; spot to determine mouse position during a button press. The mouse hot spot
  12. ;; values can range from 16 to -16.  The mouse driver uses the upper-left 
  13. ;; corner (0,0) of the mouse pointer bit map as the reference point for the
  14. ;; hot spot.  You must use an even value for horizontal hot spot offset in 
  15. ;; display modes 4 and 5.
  16. ;;
  17. ;;      Register contents on entry:
  18. ;;
  19. ;;              AX - 9
  20. ;;              BX - Hot Spot offset from left.
  21. ;;              CX - Hot Spot offset from top.
  22. ;;              DX - Offset of pointer image buffer
  23. ;;              ES - Segment of pointer image buffer.
  24. ;;
  25. ;;
  26. ;----------------------------------------------------------
  27. ;;
  28. code                    SEGMENT
  29. ASSUME          cs:code, ds:code, es:code
  30. ORG             100h
  31. start:
  32.         jmp     show_new_mouse
  33. ;;
  34. ;----------------------------------------------------------
  35. ;;
  36. ;; If you look closely to the two bit maps below, you can see the finger
  37. ;; pointing hand images. The second image is the exact opposite of the first.
  38. ;;
  39. ;; The first 32-byte image is AND with the screen image.
  40. ;;
  41. FINGER_POINTER          DW      1111111111111111b
  42.                         DW      1111001111111111b
  43.                         DW      1111001111111111b
  44.                         DW      1111001111111111b
  45.                         DW      1111001111111111b
  46.                         DW      1111001111111111b
  47.                         DW      1111001001001001b
  48.                         DW      1111001001001001b
  49.                         DW      1001001001001001b
  50.                         DW      1001001001001001b
  51.                         DW      1001001001001001b
  52.                         DW      1000000000000001b
  53.                         DW      1000000000000001b
  54.                         DW      1000000000000001b
  55.                         DW      1000000000000001b
  56.                         DW      1111111111111111b
  57. ;;
  58. ;; The second 32-byte image is XOR with the screen image.
  59. ;;
  60.                         DW      0000000000000000b
  61.                         DW      0000110000000000b
  62.                         DW      0000110000000000b
  63.                         DW      0000110000000000b
  64.                         DW      0000110000000000b
  65.                         DW      0000110000000000b
  66.                         DW      0000110110110110b
  67.                         DW      0000110110110110b
  68.                         DW      0110110110110110b
  69.                         DW      0110110110110110b
  70.                         DW      0110110110110110b
  71.                         DW      0111111111111110b
  72.                         DW      0111111111111110b
  73.                         DW      0111111111111110b
  74.                         DW      0111111111111110b
  75.                         DW      0000000000000000b
  76. ;;
  77. ;----------------------------------------------------------
  78. ;;
  79. SAVED_VIDEO_MODE        DB      0
  80. MESSAGE                 DB      0dh, 0ah, 'Graphic mouse finger pointer.', 0dh, 0ah 
  81.                         DB      0dh, 0ah, 'Press any key to exit program.$'
  82. ;;
  83. ;----------------------------------------------------------
  84. ;;
  85. show_new_mouse          PROC    NEAR
  86.         mov     ah, 0fh                 ; save the current video mode.
  87.         int     10h
  88.         cmp     al, 7                   ; if its 7 then its a monochrome.
  89.         je      not_possible            ; can't do graphics on a mono!
  90.         mov     SAVED_VIDEO_MODE, al    ; looks ok, save video mode.
  91. ;;
  92.         mov     ax, 0                   ; see if there is a mouse driver.
  93.         int     33h
  94.         cmp     ax, 0                   ; is there one installed?
  95.         je      not_possible            ; no - have to exit.
  96. ;;
  97.         mov     ah, 0                   ; everything looks good.
  98.         mov     al, 6                   ; set video to 640x200 graphics.
  99.         int     10h
  100.         mov     ax, 9                   ; service 9 change pointer shape.
  101.         mov     bx, 8                   ; place the Hot Spot in the
  102.         mov     cx, 16                  ; center of the finger pointer.
  103.         lea     dx, FINGER_POINTER      ; get the offset of image.
  104.         push    cs                      ; push segment of image
  105.         pop     es                      ; into the ES register.
  106.         int     33h
  107. ;;
  108.         mov     ax, 1                   ; show the modified mouse pointer.
  109.         int     33h
  110. ;;
  111.         mov     ah, 9                   ; display the how to exit message.
  112.         lea     dx, MESSAGE
  113.         int     21h
  114. ;;
  115.         mov     ah, 0                   ; wait for user to press key.
  116.         int     16h
  117. ;;
  118.         mov     ah, 0                   ; restore original video mode.
  119.         mov     al, SAVED_VIDEO_MODE
  120.         int     10h
  121. ;;
  122. not_possible:
  123.         int     20h                     ; return to DOS prompt.
  124. show_new_mouse          ENDP
  125. ;;
  126. ;-----------------------------------------
  127. ;;
  128. code                    ENDS
  129. END             start
  130.