home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR3 / MSPROG.ZIP / MOUSE.TXT next >
Text File  |  1993-11-26  |  13KB  |  335 lines

  1. Mouse Programming Reference
  2. ===========================
  3.  
  4. Function Overview
  5. -----------------
  6. 0  - Mouse Installed Flag and Reset
  7. 1  - Show Cursor
  8. 2  - Hide Cursor
  9. 3  - Get Mouse Position and Button Status
  10. 4  - Set Mouse Cursor Position
  11. 5  - Get Button Press Information
  12. 6  - Get Button Release Information
  13. 7  - Set Minimum and Maximum Horizontal Position
  14. 8  - Set Minimum and Maximum Vertical Position
  15. 9  - Set Graphics Cursor Block
  16. 10 - Set Text Cursor
  17. 11 - Read Mouse Motion Counters
  18. 12 - Set User-Defined Subroutine Input Mask
  19. 13 - Light Pen Emulation Mode On
  20. 14 - Light Pen Emulation Mode Off
  21. 15 - Set Mickey/Pixel Ratio
  22. 16 - Conditional Off
  23. 19 - Set Double Speed Threshold
  24.  
  25.  
  26. Given: SUB MouseDriver m1%, m2%, m3%, m4%
  27.  
  28. Function 0: Mouse Installed Flag and Reset
  29. ------------------------------------------
  30. Input:  m1% = 0
  31. Output: m1% = mouse status
  32.         m2% = number of buttons
  33.  
  34. mouse status is 0 (false) if the mouse hardware and software are
  35. not installed, and is -1 (true) if the hardware and software are
  36. installed.
  37.  
  38. Function 1: Show Cursor
  39. -----------------------
  40. Input: m1% = 1
  41.  
  42. Increments the internal cursor flag and, if the flag is 0, displays
  43. the cursor on the screen. The cursor tracks the motion of the
  44. mouse, changing position as the mouse changes position.
  45.  
  46. Function 2: Hide Cursor
  47. -----------------------
  48. Input: m1% = 2
  49.  
  50. Removes the cursor from the screen and decrements the internal
  51. cursor flag. The cursor, even though hidden, still tracks the
  52. motion of the mouse, changing position as the mouse changes
  53. position.
  54.  
  55. Use this function before modifying any portion of the screen
  56. containing the cursor. This prevents the cursor from possibly
  57. affection the data written to the screen.
  58.  
  59. Function 3: Get Mouse Position and Button Status
  60. ------------------------------------------------
  61. Input:  m1% = 3
  62. Output: m2% = button status
  63.         m3% = cursor position (horizontal)
  64.         m4% = cursor position (vertical)
  65.  
  66. Returns the state of the left and right buttons and the horizontal
  67. and vertical positions of the cursor. The button status is a single
  68. integer value. Bits 0 and 1 represent the left and right buttons,
  69. respectively. A bit is 1 if a button is down, and 0 if up.
  70.  
  71. Note: In 320xwhatever screen resolutions the horizontal values will
  72. still range between 0 and 640, so you must divide by 2 to get the
  73. actual pixel location.
  74.  
  75. Function 4: Set Mouse Cursor Position
  76. -------------------------------------
  77. Input: m1% = 4
  78.        m2% = (horizontal) new cursor position
  79.        m3% = (vertical) new cursor position
  80.  
  81. Sets the cursor to the specified horizontal and vertical screen
  82. positions. The new values must be in the horizontal and vertical
  83. ranges of the virtual screen. If the screen is not in high
  84. resolution mode, the values are rounded to the nearest horizontal
  85. or vertical values permitted for the current screen mode.
  86.  
  87. Function 5: Get Button Press Information
  88. ----------------------------------------
  89. Input:  m1% = 5
  90.         m2% = button
  91.  
  92. Output: m1% = button status
  93.         m2% = count of button presses
  94.         m3% = cursor (horizontal) at last press
  95.         m4% = cursor (vertical) at last press
  96.  
  97. Returns current button status, a count of button presses since that
  98. last call to this function, and the horizontal and vertical
  99. position of the cursor at the last press of the button.
  100.  
  101. The parameter m2% specifies which button is checked. If set to 0,
  102. the left button is checked. If 1, the right button is checked.
  103.  
  104. The count of button presses is always in the range 0 to 32767;
  105. overflow is not detected. The count is set to 0 after the call.
  106.  
  107. Function 6: Get Button Release Information
  108. ------------------------------------------
  109. Input:  m1% = 6
  110.         m2% = button
  111. Output: m1% = button status
  112.         m2% = count of button releases
  113.         m3% = cursor (horizontal) at last release
  114.         m4% = cursor (vertical) at last release
  115.  
  116. Returns current button status, a count of button releases since the
  117. last call to this function, and the horizontal and vertical
  118. position of the cursor at the last release of the button.
  119.  
  120. Function 7: Set Minimum and Maximum Horizontal Position
  121. -------------------------------------------------------
  122. Input: m1% = 7
  123.        m3% = minimum position
  124.        m4% = maximum position
  125.  
  126. Sets the minimum and maximum horizontal cursor positions on the
  127. screen. Subsequent cursor motion is restricted to the specified
  128. area. The minimum and maximum values are defined by the virtual
  129. screen. If the minimum value is greater than the maximum, the two
  130. values are swapped.
  131.  
  132. Function 8: Set minimum and Maximum Vertical Position
  133. -----------------------------------------------------
  134. Input: m1% = 8
  135.        m3% = minimum position
  136.        m4% = maximum position
  137.  
  138. Function 9: Set Graphics Cursor Block
  139. -------------------------------------
  140. Input: m1% = 9
  141.        m2% = cursor hot spot (horizontal)
  142.        m3% = cursor hot spot (vertical)
  143.        m4% = pointer to screen and cursor masks
  144.  
  145. Defines the shape, color, and center of the cursor when in graphics
  146. modes. To pass the screen mask and cursor mask in BASIC, assign
  147. their values to an integer array and use the first element of the
  148. array as the fourth parameter in the call.
  149.  
  150. Note: This function is poorly documented, so you may not be able to
  151. get it to work using just the information in this file.
  152.  
  153. Example:
  154.  
  155.      'Create array
  156.      DIM CURSOR(0 TO 15, 0 TO 1)
  157.      
  158.      'Define the screen mask
  159.      CURSOR( 0,0)=&HE1FF  'Binary 1110000111111111
  160.      CURSOR( 1,0)=&HE1FF  'Binary 1110000111111111
  161.      CURSOR( 2,0)=&HE1FF  'Binary 1110000111111111
  162.      CURSOR( 3,0)=&HE1FF  'Binary 1110000111111111
  163.      CURSOR( 4,0)=&HE1FF  'Binary 1110000111111111
  164.      CURSOR( 5,0)=&HE000  'Binary 1110000000000000
  165.      CURSOR( 6,0)=&HE000  'Binary 1110000000000000
  166.      CURSOR( 7,0)=&HE000  'Binary 1110000000000000
  167.      CURSOR( 8,0)=&H0000  'Binary 0000000000000000
  168.      CURSOR( 9,0)=&H0000  'Binary 0000000000000000
  169.      CURSOR(10,0)=&H0000  'Binary 0000000000000000
  170.      CURSOR(11,0)=&H0000  'Binary 0000000000000000
  171.      CURSOR(12,0)=&H0000  'Binary 0000000000000000
  172.      CURSOR(13,0)=&H0000  'Binary 0000000000000000
  173.      CURSOR(14,0)=&H0000  'Binary 0000000000000000
  174.      CURSOR(15,0)=&H0000  'Binary 0000000000000000
  175.  
  176.      'Define the cursor mask
  177.      CURSOR( 0,0)=&H1E00  'Binary 0001111000000000
  178.      CURSOR( 1,0)=&H1200  'Binary 0001001000000000
  179.      CURSOR( 2,0)=&H1200  'Binary 0001001000000000
  180.      CURSOR( 3,0)=&H1200  'Binary 0001001000000000
  181.      CURSOR( 4,0)=&H1200  'Binary 0001001000000000
  182.      CURSOR( 5,0)=&H13FF  'Binary 0001001111111111
  183.      CURSOR( 6,0)=&H1249  'Binary 0001001001001001
  184.      CURSOR( 7,0)=&H1249  'Binary 0001001001001001
  185.      CURSOR( 8,0)=&HF249  'Binary 1111001001001001
  186.      CURSOR( 9,0)=&H9001  'Binary 1001000000000001
  187.      CURSOR(10,0)=&H9001  'Binary 1001000000000001
  188.      CURSOR(11,0)=&H9001  'Binary 1001000000000001
  189.      CURSOR(12,0)=&H8001  'Binary 1000000000000001
  190.      CURSOR(13,0)=&H8001  'Binary 1000000000000001
  191.      CURSOR(14,0)=&H8001  'Binary 1000000000000001
  192.      CURSOR(15,0)=&HFFFF  'Binary 1111111111111111
  193.  
  194. Function 10: Set Text Cursor
  195. ----------------------------
  196. Input: m1% = 10
  197.        m2% = cursor select
  198.        m3% = screen mask value/scan line start
  199.        m4% = cursor mask value/scan line stop
  200.  
  201. Selects the software of hardware text cursor. If the software text
  202. cursor is selected, this function defines the character attributes
  203. of the cursor when in text mode. If the hardware text cursor is
  204. selected, this function defines the first and last scan lines to be
  205. shown on the screen.
  206.  
  207. The value of the parameter m2% selects the cursor type. If the
  208. value is 0, the software text cursor is selected. If the value is
  209. 1, the hardware text cursor is selected.
  210.  
  211. Function 11: Read Mouse Motion Counters
  212. ---------------------------------------
  213. Input:  m1% = 11
  214. Output: m3% = count (horizontal)
  215.         m4% = count (vertical)
  216.  
  217. Returns the horizontal and vertical mickey count since the last
  218. call to this function. The mickey count is the distance in 1/100
  219. inch increments that the mouse has moved.
  220.  
  221. The mickey count is always within the range -32768 to 32767. A
  222. positive horizontal count specifies a motion to the right. A
  223. positive vertical count specifies a motion to the bottom of the
  224. screen. Overflow is ignored.
  225.  
  226. The mickey count is set to 0 after the call is completed.
  227.  
  228. Function 12: Set User-Defined Subroutine Input Mask
  229. ---------------------------------------------------
  230. Input: m1% = 12
  231.        m3% = call mask
  232.        m4% = address offset to subroutine
  233.  
  234. Sets the call mask and subroutine address for the mouse software
  235. interrupts. The mouse software interrupts automatically, stops
  236. execution of your program and calls the specified subroutine
  237. whenever one of more of the conditions defined by the call mask
  238. occur. On completion of the subroutine, your program will continue
  239. execution at the point of interruption.
  240.  
  241. The call mask, a single integer value, defines which conditions
  242. will cause an interrupt. Each bit in the call mask corresponds to
  243. a specific condition as shown here:
  244.  
  245.      Mask bit       Condition
  246.      --------       ---------
  247.      0              cursor position changes
  248.      1              left button pressed
  249.      2              left button released
  250.      3              right button pressed
  251.      4              right button released
  252.      5-15           not used (1984 driver, newer drivers may make
  253.                               use of these bits)
  254.  
  255. To enable an interrupt for a given condition, set the corresponding
  256. call mask bit to 1 and pass the mask as parameter m3%. To disable
  257. a condition, set the corresponding bit to 0 and pass the mask. All
  258. conditions are automatically disabled by Function 0.
  259.  
  260. When the mouse software makes a call to the subroutine, it loads
  261. the following information into the CPU registers:
  262.  
  263. Register  Information
  264. --------  -----------
  265. AX        condition mask (similar to call mask except a bit is set
  266.           only if the condition has occurred)
  267. BX        button state
  268. CX        cursor position (horizontal)
  269. DX        cursor position (vertical)
  270.  
  271. Function 13: Light Pen Emulation Mode On
  272. -----------------------------------------
  273. Input: m1% = 13
  274.  
  275. Enables the light pen emulation by the mouse. When the mouse
  276. emulates the light pen, calls to the PEN function, described in the
  277. BASIC manual, will return the cursor position at the last "pen
  278. down."
  279.  
  280. "Pen down" and "Pen off the screen" are controlled by the mouse
  281. buttons. The pen is down when both buttons are down. The pen os off
  282. the screen when both buttons are up.
  283.  
  284. Function 14: Light Pen Emulation Mode Off
  285. -----------------------------------------
  286. Input: m1% = 14
  287.  
  288. Disables the light pen emulation.
  289.  
  290. Function 15: Set mickey/pixel ratio
  291. -----------------------------------
  292. Input: m1% = 15
  293.        m2% = mickey/pixel ratio (horizontal)
  294.        m3% = mickey/pixel ratio (vertical)
  295.  
  296. Sets the mickey to pixel ratio for mouse motion. The horizontal and
  297. vertical ratios specify a number of mickeys per 8 pixels. The
  298. values must be in the range 1 to 32767.
  299.  
  300. Function 16: Conditional Off
  301. ----------------------------
  302. Note: The manual only gives assembly instructions.
  303.  
  304. Input: AX = 16
  305.        CX = upper x screen coordinate value
  306.        DX = upper y screen coordinate value
  307.        SI = lower x screen coordinate value
  308.        DI = lower y screen coordinate value
  309.  
  310. Function 16 defines a region on the screen for updating. If the
  311. mouse pointer is in or moves into the defined region, Function 16
  312. hides the mouse cursor while the region is being updated. After
  313. calling Function 16, a subsequent call to Function 1 (show cursor)
  314. is needed to show the cursor again.
  315.  
  316. Function 19: Set Double Speed Threshold
  317. ---------------------------------------
  318. Input: m1% = 19
  319.        m4% = Threshold speed in mickeys/second
  320.  
  321. Function 19 sets the threshold speed for doubling the cursor's
  322. motion on the screen. Using Function 19 will make it easier to
  323. point at images widely separate on the screen.
  324.  
  325. Parameter m4% defines the threshold speed of the mouse. If no value
  326. is given, a preset value of 64 mickeys per second is assigned. If
  327. the mouse movement speed exceeds the value in m4%, cursor motion
  328. double in speed. The threshold speed is set until Function 19 is
  329. called again.
  330.  
  331. The speed doubling feature is not turned off in the same sense as
  332. a switch is turned off. It can be disables by setting the value of
  333. m4% to a speed sufficiently higher that the mouse can obtain (10000
  334. for example) and then calling Function 19.
  335.