home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 1.ddi / MOUSE.ZIP / MOUSE.DOC < prev    next >
Encoding:
Text File  |  1990-07-11  |  8.2 KB  |  214 lines

  1.  
  2.             NOTES ON USING MOUSE
  3.  
  4. First a little backgound on the mouse.  According to the Microsoft mouse
  5. users guide, the mouse supports IBM CGA, EGA, Mono, 3270 and Hercules
  6. graphics adapters.  I have not had a chance to test these routines on all of
  7. these type of monitors, but have tested them on CGA, and some of the routines
  8. on Hercules.  I will be able to finish checking all the routines on the
  9. hercules shortly, but do not anticipate any problems.  The mouse driver
  10. software automatically senses the character cell size of different video
  11. modes.  In text mode, the mouse will always give the characters upper left
  12. pixel as the position.  For example, on a CGA card in 80 column mode, the
  13. character cells are 8 pixels by 8 pixels.  If the mouse cursor is at
  14. 10,5 (starting from 0,0) the mouse will give the position 80,40.
  15.  
  16.      The mouse uses 3 types of cursors:
  17.  
  18.          graphics cursor-a shape that moves over the images on the screen.
  19.  
  20.          software text cursor-a character attribute that moves from
  21.                   character to character.
  22.  
  23.          hardware text cursor - a flashing block or partial block that
  24.                   moves from character to character.
  25.  
  26.      The graphics cursor is used in graphics mode.  Usually, it is
  27. defined as a block of pixels in a 16 x 16 pixel area.  The mouse cursor's
  28. appearance against the background depends on the mask used.  The default
  29. appearance in graphics mode is an arrow.  Mouse function 9 let's you change
  30. the mask.  The mask is defined in an array of 32 integers, the first 16
  31. defining the screen mask, and the second 16 defining the cursor mask.
  32. This table from the users guide shows the effects of the masks.
  33.  
  34. SCREEN MASK     CURSOR MASK           RESULTING SCREEN BIT
  35.        0               0                        0
  36.        0               1                        1
  37.        1               0                        Unchanged
  38.        1               1                        Inverted
  39.  
  40. When defining a graphics cursor, you also define a hot spot, meaning the
  41. individual pixel that the mouse software will use in determining its
  42. location.
  43.  
  44.      The software text cursor also has a mask defining its effect on the
  45. screen.  The screen mask determines which of the characters attributes
  46. are preserved.  The cursor mask defines how the attributes are changed
  47. to show the cursor.  The 16 bits of each mask are:
  48.  
  49.    15- set blinking or nonblinking
  50.    14-12 background color
  51.    11 intensity
  52.    10-8 foreground color
  53.    7-0 ascii value of char
  54.  
  55. The mouse can also use the hardware cursor in text mode, in which case
  56. you can define the start/stop scan lines, to display a partial of full
  57. block blinking cursor.  The number of scan lines depends on the type
  58. of video display.
  59.  
  60. The mouse software keeps some internal counters.  It increments a seperate
  61. counter each time a button is pressed or released, resetting them to 0
  62. after they have been read or after function 0, initialization.  It also
  63. keeps an internal cursor flag, which is always 0 or less.  When the flag
  64. is 0 the mouse cursor is displayed.  Each call to hide the cursor decrements
  65. the flag.  Thus if you call Function 2 twice, you must call Function 1
  66. twice to get it to show again.
  67.  
  68. The mouse measures distance in values called mickey's.  A mickey is
  69. approximately 1/200th of an inch.  There are functions which let you change
  70. the mickey/pixel ration (how far you have to move the
  71. mouse to move the same distance on the screen) and to change the speed
  72. doubling threshold (Default 64 mickeys/second).
  73.  
  74.  
  75. SPECIAL NOTES:
  76. For the mouse graphics cursor to show on a hercules graphics board, my
  77. understanding is that you have to poke 6 into location 40:49 hex for
  78. page 0, or a 5 for page 1.  I have not had a chance to test it yet,
  79. but that is the information I got from the Microsoft forum on CIS.
  80.  
  81. |   When printing to or updating the screen while the mouse cursor is showing,
  82. | the mouse sometimes has problems not obliterating your changes when it moves
  83. | away after you wrote directly across where the mouse cursor was.  It is
  84. | usually best to hide the cursor momentarily while you update the screen.
  85. | sure is slow this way though.
  86.  
  87. MOUSE FUNCTIONS
  88. ---------------
  89.  
  90. Function 0
  91. Initializes the mouse software to its defaults,:
  92. cursor in the center of the screen,
  93. internal cursor flag -1 (not showing),
  94. graphics cursor/arrow, -1, -1 hot spot
  95. text cursor an inverting box,
  96. horizontal mickey/pixel ratio of 8:8,
  97. vertical mickey/pixel ratio of 16:8
  98. minimum and maximum horizontal and vertical positions usually the entire
  99. screen.
  100.  
  101. Returns 0 if mouse software not installed.
  102. Returns 2 if MS-DOS version < 2.0
  103.  
  104.  
  105. Function 1
  106. Show the cursor.  Increments the internal cursor flag.
  107.  
  108.  
  109. Function 2
  110. Hide the cursor.  Decrements the internal cursor flag.
  111.  
  112.  
  113. Function 3
  114. Get mouse position and status.
  115. gives button status and current position.
  116. status: 1=left button pressed, 2=right, 3=both
  117.  
  118.  
  119. Function 4
  120. Position the mouse on the screen.  It wants the pixel coordinates, not just
  121. character positions.
  122.  
  123.  
  124. Function 5
  125. Gets the current status of the button,(0=left,1=right,2=center)
  126. and the number of times the button was pressed since the last call to this
  127. function.  Also returns the position of the mouse the last time the button
  128. was pressed.
  129.  
  130.  
  131. Function 6
  132. Like function 5, but checks button releases instead.
  133.  
  134.  
  135. Function 7
  136. Set the left and right limits for the mouse to travel.
  137.  
  138.  
  139. Function 8
  140. Set the top and bottom limits for the mouse to travel.
  141.  
  142.  
  143. Function 9
  144. Sets the graphics cursor's hot spot and mask which defines what the
  145. graphics cursor will look like.  The cursor hot spot must be within
  146. the range -16 to +16 pixels relative to the cursor.  The mask values
  147. could be something like:
  148.  
  149. int xmask[32]={0x07e0,0x0000,0x0180,0x700e,0x0000,0x1c38,0xc003,0x0660,
  150.                0xf00f,0x03c0,0xc003,0x0660,0x0000,0x1c38,0x0180,0x700e,
  151.                0x07e0,0x0000,0xffff,0x0000,0xffff,0x0000,0xffff,0x0000,
  152.                0xffff,0x0000,0xffff,0x0000,0xffff,0x0000,0xffff,0x0000 };
  153.  
  154. defines a graphics cursor like an x.  See the reference earlier in this
  155. file for the table of the mask values effects on the screen.
  156.  
  157.  
  158. Function 10
  159. sets the mouse text cursor to hardware or software cursor mode.  The first
  160. integer defines the mode, 0= use software cursor, 1=use hardware cursor.
  161. The second 2 integers define either the screen and cursor masks (software
  162. mode) or the start and stop scan lines of the hardware cursor.
  163. Typical mask values might be 0,0xFFFF,0x7700.
  164.  
  165.  
  166. Function 11
  167. This function reads the motion counters since the last call to this function.
  168. Returns the motion in "mickeys", always within the range of -32768 to +32767.
  169.  
  170.  
  171. Function 12
  172. This function sets a subroutine to be conditionally called by the mouse
  173. software.  The condition of execution is defined by the mask.
  174.  
  175. Bit 0          cursor position changes
  176.     1          left button pressed
  177.     2          left button released
  178.     3          right button pressed
  179.     4          right button released
  180.     5          center button pressed
  181.     6          center button released
  182.     7-15       unused
  183.  
  184. To disable an interrupt for a specified condition, call function again
  185. with the corresponding bit set to zero.  Calling mouse Function 0 also
  186. resets everything.
  187.  
  188.      The subroutine to be called must be a far procedure, must save all
  189.      registers, and must not do any dos or bios calls.
  190.  
  191.  
  192. Functions 13,14
  193. These functions turn the light pen emulation mode on or off.  I don't know
  194. of any programs that use light pen emulation, but the functions were easy
  195. to implement and included for completeness.  A zero parameter turns on
  196. emulation, any other parameter turns it off.
  197.  
  198.  
  199. Function 15
  200. Sets the mickey / pixel ratio vertically and horizontally.  Default values
  201. are horizontal 8 mickeys to 8 pixels, vertically 16 to 8.
  202.  
  203.  
  204. Function 16
  205. This function is similar to Function 2, but only turns off the cursor
  206. if it is in the area defined when this function is called.  If this function
  207. hides the cursor, Function 1 must be called again later on to show the
  208. cursor again.
  209.  
  210.  
  211. Function 19
  212. This function sets how fast the mouse must move before its relative cursor
  213. movements on the screen are doubled.  Default value is 64 mickeys per second.
  214.