home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / basic / QBSCR20.ZIP / MOUSE.BAS < prev    next >
Encoding:
BASIC Source File  |  1992-07-08  |  29.3 KB  |  776 lines

  1. '┌────────────────────────────────────────────────────────────────────────┐
  2. '│                                                                        │
  3. '│                           M O U S E . B A S                            │
  4. '│                                                                        │
  5. '│                   Supplementary Source Code for the                    │
  6. '│       The QBSCR Screen Routines for QuickBASIC 4.0+ Programmers        │
  7. '│                              Version 2.0                               │
  8. '│                                                                        │
  9. '│                   (C) Copyright 1992 by Tony Martin                    │
  10. '│                                                                        │
  11. '├────────────────────────────────────────────────────────────────────────┤
  12. '│                                                                        │
  13. '│  This source code is copyright 1992 by Tony Martin.  You may change    │
  14. '│  it to suit your programming needs, but you may not distribute any     │
  15. '│  modified copies of the library itself.  I retain all rights to the    │
  16. '│  source code and all library modules included with the QBSCR package,  │
  17. '│  as well as to the example programs.  You may not remove this notice   │
  18. '│  from any copies of the library itself you distribute.                 │
  19. '│                                                                        │
  20. '│  You are granted the right to use this source code for your own pro-   │
  21. '│  grams, without royalty payments or credits to me (though, if you      │
  22. '│  feel so inclined to give me credit, feel free to do so).  You MUST    │
  23. '│  register this software if you release a shareware or commercial       │
  24. '│  program that uses it.  You may use these routines in any type of      │
  25. '│  software you create, as long as it is not a programming toolbox or    │
  26. '│  package of routines OF ANY KIND.                                      │
  27. '│                                                                        │
  28. '│  This package is shareware.  If you find it useful or use it in any    │
  29. '│  software you release, you are requested to send a registration fee of │
  30. '│  $25.00 (U.S. funds only) to:                                          │
  31. '│                                                                        │
  32. '│                            Tony Martin                                 │
  33. '│                       1611 Harvest Green Ct.                           │
  34. '│                          Reston, VA 22094                              │
  35. '│                                                                        │
  36. '│  All registered users receive an 'official' disk set containing the    │
  37. '│  latest verison of the QBSCR routines.  For more information, see      │
  38. '│  the QBSCR documentation.                                              │
  39. '│                                                                        │
  40. '├────────────────────────────────────────────────────────────────────────┤
  41. '│                                                                        │
  42. '│  For information on using these routines and incorporating them into   │
  43. '│  your own programs, see the accompanying documentation.                │
  44. '│                                                                        │
  45. '└────────────────────────────────────────────────────────────────────────┘
  46.  
  47. ' ==========================================================================
  48. ' Include the mouse library CONSTants, TYPEs, and DECLAREs.
  49. ' ==========================================================================
  50.  
  51. REM $INCLUDE: 'mouse.bi'
  52.  
  53. COMMON SHARED mouseExists%, mouseState%
  54.  
  55. SUB Mouse (m1%, m2%, m3%, m4%) STATIC
  56.  
  57.  
  58.     ' ========================================================================
  59.     ' This routine is the routine that calls the mouse interrupt (33h).
  60.     ' All other mouse routines (with one exception) use this routine to make
  61.     ' function calls to the mouse driver.  The four parameters are standard
  62.     ' parameters sent to the mouse, the contents of which depend on the
  63.     ' function desired.  Not all parameters will have useful values.  This
  64.     ' also depends on the function desired.  In any case, you probably will
  65.     ' never have to see or call this routine.  Simply use the top-level mouse
  66.     ' routines provided in this library.
  67.     ' ========================================================================
  68.  
  69.  
  70.     ' ========================================================================
  71.     ' DIMension a pair of register objects (RegType is found in the MOUSE.BI
  72.     ' file). One is to pass in values, the other is to receive information
  73.     ' in return.
  74.     ' ========================================================================
  75.  
  76.     DIM inRegs AS RegType
  77.     DIM outRegs AS RegType
  78.  
  79.  
  80.     ' ========================================================================
  81.     ' Assign the passed-in mouse parameters to the general purpose registers
  82.     ' in the register objects declared only nanoseconds ago.
  83.     ' ========================================================================
  84.  
  85.     inRegs.ax = m1%
  86.     inRegs.bx = m2%
  87.     inRegs.cx = m3%
  88.     inRegs.dx = m4%
  89.  
  90.     ' ========================================================================
  91.     ' Make the call to the mouse interrupt (33h), passing in the mouse
  92.     ' parameters, and receiving information back.
  93.     ' ========================================================================
  94.  
  95.     INTERRUPT &H33, inRegs, outRegs
  96.  
  97.                                                                                                                                                             
  98.     ' ========================================================================
  99.     ' Assign returned information to the mouse parameters, so they may be
  100.     ' passed back to the calling routine.
  101.     ' ========================================================================
  102.  
  103.     m1% = outRegs.ax
  104.     m2% = outRegs.bx
  105.     m3% = outRegs.cx
  106.     m4% = outRegs.dx
  107.  
  108. END SUB
  109.  
  110. SUB MouseButtonPressInfo (button%, numPresses%, x%, y%)
  111.  
  112.  
  113.     ' ========================================================================
  114.     ' This function returns the number of presses for the specified button
  115.     ' (left=0, right=1, center=2) since the last call to this function, as
  116.     ' well as the x and y virtual screen coordinates of the mouse at the time
  117.     ' of the last press.
  118.     '
  119.     ' Parameters:
  120.     ' -----------
  121.     '   button%       the button to be checked (0=left, 1=right, 2=center) *
  122.     '   numPresses%   returns the number of presses since last call
  123.     '   x%            mouse virtual x-coordinate at last button press
  124.     '   y%            mouse virtual y-coordinate at last button press
  125.     '
  126.     '   * NOTE: In the MOUSE.BI file, there are constants named LEFTBUTTON,
  127.     '           RIGHTBUTTON, and CENTERBUTTON, that have respective values of
  128.     '           0, 1, and 2.  You may use these instead of the constants 0, 1,
  129.     '           2 to make your programs more readable.
  130.     ' ========================================================================
  131.  
  132.  
  133.     ' ========================================================================
  134.     ' Assign parameters for call to Mouse interrupt sub.  m1% contains the
  135.     ' mouse function we want to use, in this case function 5, Get Button
  136.     ' Press Information.  m2% contains the button to check.  Call the mouse
  137.     ' interrupt sub.
  138.     ' ========================================================================
  139.  
  140.     m1% = 5
  141.     m2% = button%
  142.     Mouse m1%, m2%, m3%, m4%
  143.  
  144.  
  145.     ' ========================================================================
  146.     ' Prepare data for return to calling routine.  m2% returns the number of
  147.     ' button presses since the last call to the function; m3% contains the
  148.     ' x-coordinate of the mouse at the last button press, and m4% contains the
  149.     ' y-coordinate of the mouse at the last button press.
  150.     ' ========================================================================
  151.  
  152.     numPresses% = m2%
  153.     x% = m3%
  154.     y% = m4%
  155.  
  156.  
  157. END SUB
  158.  
  159. SUB MouseButtonReleaseInfo (button%, numReleases%, x%, y%)
  160.  
  161.  
  162.     ' ========================================================================
  163.     ' This routine returns the number of time the specified button (left=0,
  164.     ' right=1, center=2) was released since the alst call to this function.
  165.     ' Also returned are the x and y coordinates of the virtual screen where
  166.     ' the last release occurred.
  167.     '
  168.     ' Parameters:
  169.     ' -----------
  170.     '   button%       the button to be checked (0=left, 1=right, 2=center) *
  171.     '   numReleases%  returns the number of releases since last call
  172.     '   x%            mouse virtual x-coordinate at last button release
  173.     '   y%            mouse virtual y-coordinate at last button release
  174.     '
  175.     '   * NOTE: In the MOUSE.BI file, there are constants named LEFTBUTTON,
  176.     '           RIGHTBUTTON, and CENTERBUTTON, that have respective values of
  177.     '           0, 1, and 2.  You may use these instead of the constants 0, 1,
  178.     '           2 to make your programs more readable.
  179.     ' ========================================================================
  180.  
  181.  
  182.     ' ========================================================================
  183.     ' Assign parameters for call to Mouse interrupt sub.  m1% contains the
  184.     ' mouse function we want to use, in this case function 6, Get Button
  185.     ' Release Information.  m2% contains the button to check.  Call the mouse
  186.     ' interrupt sub.
  187.     ' ========================================================================
  188.  
  189.     m1% = 6
  190.     m2% = button%
  191.     Mouse m1%, m2%, m3%, m4%
  192.  
  193.  
  194.     ' ========================================================================
  195.     ' Prepare data for return to calling routine.  m2% returns the number of
  196.     ' button releases since the last call to the function; m3% contains the
  197.     ' x-coordinate of the mouse at the last button release, and m4% contains
  198.     ' the y-coordinate of the mouse at the last button release.
  199.     ' ========================================================================
  200.  
  201.     numReleases% = m2%
  202.     x% = m3%
  203.     y% = m4%
  204.  
  205.  
  206. END SUB
  207.  
  208. SUB MouseButtonStatus (bl%, br%, bc%)
  209.  
  210.  
  211.     ' ========================================================================
  212.     ' This function returns the state (up=0, down=1) of each mouse button.
  213.     ' If there is no third button on the mouse, then you can ignore the value
  214.     ' returned by bc% (there isn't one).
  215.     '
  216.     ' Parameters:
  217.     ' -----------
  218.     '   bl%   Returns the state of the left button (0=up, 1=down)
  219.     '   br%   Returns the state of the right button (0=up, 1=down)
  220.     '   bc%   Returns the state of the center button (0=up, 1=down)
  221.     '
  222.     '   Note 1:  None of these parameters need values when the sub is
  223.     '            called.  They will be filled with values so you may use
  224.     '            them when this sub returns.
  225.     '
  226.     '   Note 2:  The file MOUSE.BI contains two constants, UP and DOWN,
  227.     '            which contain the values 0 and 1, respectively.  You may
  228.     '            use these in place of 0 and 1 to make your programs more
  229.     '            readable.
  230.     ' ========================================================================
  231.     
  232.  
  233.     ' ========================================================================
  234.     ' Call mouse function 3, Get Button Status, to obtain (you guessed it) the
  235.     ' status of the mouse buttons.
  236.     ' ========================================================================
  237.  
  238.     m1% = 3
  239.     Mouse m1%, m2%, m3%, m4%
  240.  
  241.  
  242.     ' ========================================================================
  243.     ' The mouse function called above returns the status of all the mouse
  244.     ' buttons in one parameter (m2%).  The first bit position (least-
  245.     ' significant) contains the status for the left button.  The second bit
  246.     ' position contains the status for the right button, and the third bit
  247.     ' position contains the status for the center button.  If the bit at
  248.     ' the correct position is off (0), the button is up; if it is on (1),
  249.     ' the button is down.
  250.     '
  251.     ' To extract these bit values from a single number (stored in m2%), we
  252.     ' must mask the value.  A discussion of bit masking is beyond the scope
  253.     ' of software documentation, but it suffices to say that if any button
  254.     ' is up (off), a value of 0 will be returned.  The values for down vary
  255.     ' depending on the button (left=1, right=2, center=4).  As long as the
  256.     ' value is not 0, the button is down.
  257.     '
  258.     ' The next step is to extract the button statuses by masking the single
  259.     ' returned value.  The object leftButtonMask%, rightButtonMask%, and
  260.     ' centerButtonMask% can be found in the MOUSE.BI file.
  261.     ' ========================================================================
  262.  
  263.     bl% = m2% AND leftButtonMask%
  264.     br% = m2% AND rightButtonMask%
  265.     bc% = m2% AND centerButtonMask%
  266.  
  267.  
  268.     ' ========================================================================
  269.     ' Since (as mentioned above) the values for buttons being down can vary,
  270.     ' and we cannot have three different values for the DOWN object, we now
  271.     ' go thourgh each button status obtained and if the status is not 0
  272.     ' (we know it is down) and set the status value to DOWN.
  273.     ' ========================================================================
  274.  
  275.     IF bl% <> 0 THEN   ' Left button is DOWN
  276.         bl% = BUTTONDOWN
  277.     ELSE               ' Left button is UP
  278.         bl% = BUTTONUP
  279.     END IF
  280.  
  281.  
  282.     IF br% <> 0 THEN   ' Right button is DOWN
  283.         br% = BUTTONDOWN
  284.     ELSE               ' Right button is UP
  285.         br% = BUTTONUP
  286.     END IF
  287.  
  288.  
  289.     IF bc% <> 0 THEN   ' Center button is DOWN
  290.         bc% = BUTTONDOWN
  291.     ELSE               ' Center button is UP
  292.         bc% = BUTTONUP
  293.     END IF
  294.  
  295.  
  296. END SUB
  297.  
  298. SUB MouseGetSensitivity (x%, y%, doubleSpeed%)
  299.  
  300.     ' ========================================================================
  301.     ' This routine allows you to get the current mouse sensitivity for the x
  302.     ' and y directions, as well as set the double speed threshold.  Values
  303.     ' for all these parameters range from 1 to 100, 100 being the most
  304.     ' sensitive.
  305.     '
  306.     ' Parameters:
  307.     ' -----------
  308.     '   x%             horizontal mouse sensitivity
  309.     '   y%             vertical mouse sensitivity
  310.     '   doubleSpeed%   Specifies the threshold for mouse double speed
  311.     '
  312.     '   Note:  These parameters do not require values when the sub is called.
  313.     '          They will contain the requested information when this function
  314.     '          ends and returns to the calling function.
  315.     ' ========================================================================
  316.     
  317.  
  318.     ' ========================================================================
  319.     ' Make the call to the mouse function, asking for driver function 27,
  320.     ' Get Mouse Sensitivity.
  321.     ' ========================================================================
  322.  
  323.     m1% = 27
  324.     Mouse m1%, m2%, m3%, m4%
  325.  
  326.  
  327.     ' ========================================================================
  328.     ' Return the mouse sensitivy values, as well as the double speed thresh-
  329.     ' hold, in the supplied variables.
  330.     ' ========================================================================
  331.  
  332.     x% = m2%
  333.     y% = m3%
  334.     doubleSpeed% = m4%
  335.  
  336.  
  337. END SUB
  338.  
  339. SUB MouseHide
  340.  
  341.  
  342.     ' ========================================================================
  343.     ' This function turns the mouse cursor off.  There are no parameters - it
  344.     ' simply turns off the mouse cursor.
  345.     ' ========================================================================
  346.  
  347.  
  348.     ' ========================================================================
  349.     ' Make the call to the mouse function, requesting driver function 2,
  350.     ' Hide Mouse Cursor.
  351.     ' ========================================================================
  352.  
  353.     IF mouseState% <> MOUSEOFF THEN
  354.         m1% = 2
  355.         Mouse m1%, m2%, m3%, m4%
  356.         mouseState% = MOUSEOFF
  357.     END IF
  358.  
  359. END SUB
  360.  
  361. SUB MouseInfo (driverVersion$, mouseType%, IRQ%)
  362.  
  363.  
  364.     ' ========================================================================
  365.     ' This routine allows you to obtain the version of the mouse driver
  366.     ' currently installed, the type of mouse, and the IRQ in use by the
  367.     ' mouse.  Note that the number in the mouse driver version are hex
  368.     ' values.
  369.     '
  370.     'The mouse type returns the following values:
  371.     '
  372.     '               Value      Mouse type
  373.     '               --------------------------------------
  374.     '                 1        Bus mouse
  375.     '                 2        Serial mouse
  376.     '                 3        InPort mouse
  377.     '                 4        PS/2 mouse
  378.     '                 5        Hewlett Packard mouse
  379.     '
  380.     ' Parameters:
  381.     ' -----------
  382.     '   driverVersion$   Contains the version of the mouse driver software
  383.     '   mouseType%       Contains the type of mouse installed, as detailed
  384.     '                    above
  385.     '   IRQ%             Contains the IRQ port in use by the mouse.
  386.     '
  387.     '   Note: The values for the mouse type are stored in named constants in
  388.     '         the file MOUSE.BI.  The names are BUSMOUSE, SERIALMOUSE,
  389.     '         INPORTMOUSE, PS2MOUSE, and HEWLETTPACKARDMOUSE.
  390.     ' ========================================================================
  391.  
  392.  
  393.     ' ========================================================================
  394.     ' Make the call to the mouse sub, requesting driver function 36, Get
  395.     ' Driver Version, Mouse Type, and IRQ Number.
  396.     ' ========================================================================
  397.  
  398.     m1% = 36
  399.     Mouse m1%, m2%, m3%, m4%
  400.  
  401.  
  402.     ' ========================================================================
  403.     ' Extract the information from the returned data.  m3% contains the mouse
  404.     ' type in the low byte, and the IRQ port in the high byte.  The driver
  405.     ' major version (the left side of the decimal) is stored in the high byte
  406.     ' of m2%, and the minor version (right of decimal) is stored in the low
  407.     ' byte of m2%.
  408.     ' ========================================================================
  409.  
  410.     mouseType% = m3% \ 256
  411.     IRQ% = m3% AND &HFF
  412.     driverVersion$ = LTRIM$(RTRIM$(HEX$(m2% \ 256))) + "." + LTRIM$(RTRIM$(HEX$(m2% AND &HFF)))
  413.  
  414.  
  415. END SUB
  416.  
  417. FUNCTION MouseInit%
  418.  
  419.     ' ========================================================================
  420.     ' If mouse is present, this function returns the number of buttons
  421.     ' the mouse has.  If not, it returns a zero (0).  It also sets the
  422.     ' following mouse values:
  423.     '
  424.     '        Cursor Position: Center of screen
  425.     '           Cursor State: OFF
  426.     '  Graphics Cursor Shape: Arrow
  427.     '            Text Cursor: Reverse Video
  428.     ' Double-speed threshold: 64
  429.     ' ========================================================================
  430.  
  431.  
  432.     ' ========================================================================
  433.     ' Make a call to the mouse sub, requesting driver function 0, Mouse
  434.     ' Initialize.
  435.     ' ========================================================================
  436.     m1% = 0
  437.     Mouse m1%, m2%, m3%, m4%
  438.  
  439.  
  440.     ' ========================================================================
  441.     ' The m1% parameter returns 0 if no mouse available, or -1 if one was
  442.     ' found.  If m1% is not zero (if it is TRUE), then m2% will contain the
  443.     ' number of buttons on the mouse.
  444.     ' ========================================================================
  445.  
  446.     IF m1% <> 0 THEN
  447.         MouseInit% = m2%
  448.     ELSE
  449.         MouseInit% = 0
  450.     END IF
  451.  
  452.     mouseState% = MOUSEOFF
  453.  
  454. END FUNCTION
  455.  
  456. SUB MouseMickeyCount (x%, y%)
  457.  
  458.     ' ========================================================================
  459.     ' This function returns the number of mickeys moved in the x and y
  460.     ' directions since the last call to this function.  A positive value
  461.     ' indicates a movement either to the right or down. A negative value
  462.     ' indicates a movement either to the left or up.  One mickey equals
  463.     ' 1/200th of an inch.
  464.     '
  465.     ' Parameters:
  466.     ' -----------
  467.     '   x%   The number of horizontal mickeys
  468.     '   y%   The number of vertical mickeys
  469.     ' ========================================================================
  470.  
  471.  
  472.     ' ========================================================================
  473.     ' Make a call to the mouse sub requesting driver function 11, Read Mouse
  474.     ' Motion Counters.
  475.     ' ========================================================================
  476.  
  477.     m1% = 11
  478.     Mouse m1%, m2%, m3%, m4%
  479.  
  480.  
  481.     ' ========================================================================
  482.     ' The m3% parameter contains the number of horizontal mickeys, and the
  483.     ' m4% parameter contains the number of vertical mickeys.
  484.     ' ========================================================================
  485.  
  486.     x% = m3%
  487.     y% = m4%
  488.  
  489.  
  490. END SUB
  491.  
  492. SUB MouseOrKeyboardPause
  493.  
  494.     ' ========================================================================
  495.     ' This function waits until either a key is pressed or any mouse button
  496.     ' is pressed.  When this is done, the function will exit.
  497.     '
  498.     ' Parameters:
  499.     ' -----------
  500.     '   None.
  501.     '
  502.     '   * NOTE: This routine assumes a mouse exists.
  503.     '
  504.     ' ========================================================================
  505.  
  506.  
  507.     ' ========================================================================
  508.     ' Clear out all keyboard and mouse button presses that may be sitting in
  509.     ' buffers out there somewhere.
  510.     ' ========================================================================
  511.         ' Keyboard
  512.         WHILE INKEY$ <> ""
  513.         WEND
  514.      
  515.         ' Mouse
  516.         MouseButtonPressInfo LEFTBUTTON, lmCnt%, mx%, my%
  517.         MouseButtonPressInfo RIGHTBUTTON, rmCnt%, mx%, my%
  518.         MouseButtonPressInfo CENTERBUTTON, cmCnt%, mx%, my%
  519.  
  520.     ' ========================================================================
  521.     ' Wait for either a mouse or keyboard press.
  522.     ' ========================================================================
  523.     done% = FALSE
  524.     DO
  525.      
  526.         mCnt% = 0
  527.         key$ = ""
  528.      
  529.         ' Check mouse for button activity.
  530.         MouseButtonPressInfo LEFTBUTTON, lmCnt%, mx%, my%
  531.         MouseButtonPressInfo RIGHTBUTTON, rmCnt%, mx%, my%
  532.         MouseButtonPressInfo CENTERBUTTON, cmCnt%, mx%, my%
  533.  
  534.         IF (lmCnt%) OR (rmCnt%) OR (cmCnt%) THEN
  535.             done% = TRUE
  536.         END IF
  537.  
  538.         ' Check keyboard for activity.
  539.         IF (INKEY$ <> "") THEN
  540.             done% = TRUE
  541.         END IF
  542.  
  543.     LOOP UNTIL done%
  544.  
  545.  
  546. END SUB
  547.  
  548. SUB MousePosition (x%, y%)
  549.  
  550.     ' ========================================================================
  551.     ' This routine returns the current position of the mouse on the virtual
  552.     ' screen in x and y.
  553.     '
  554.     ' Parameters:
  555.     ' -----------
  556.     '   x%   The mouse x-coordinate on the virtual screen
  557.     '   y%   The mouse y-coordinate on the virtual screen
  558.     ' ========================================================================
  559.  
  560.  
  561.     ' ========================================================================
  562.     ' Make a call to the mouse sub requesting driver function 3, Get Button
  563.     ' Status and Mouse Position.
  564.     ' ========================================================================
  565.  
  566.     m1% = 3
  567.     Mouse m1%, m2%, m3%, m4%
  568.  
  569.  
  570.     ' ========================================================================
  571.     ' Mouse parameter m3% contains the x-coordinate, while m4% contains the
  572.     ' y-coordinate.
  573.     ' ========================================================================
  574.  
  575.     x% = m3%
  576.     y% = m4%
  577.  
  578.  
  579. END SUB
  580.  
  581. SUB MouseSelectTextCursor (cursorType%, topScan%, botScan%, scrMask%, curMask%)
  582.  
  583.  
  584.     ' ========================================================================
  585.     ' This function allows you to select one of two types of mouse text
  586.     ' cursors.  The hardware cursor (cursorType%=1) will let you also
  587.     ' specify the top and bottom scan lines of the cursor.  The software
  588.     ' cursor (cursorType%=0) instead allows you to specify the screen and
  589.     ' cursor masks.  See the documentation for more details on this.
  590.     '
  591.     ' Parameters:
  592.     ' -----------
  593.     '   cursorType%   Type of mouse cursor (0=software, 1=hardware)
  594.     '   topScan%      Top scan line for hardware cursor
  595.     '   botScan%      Bottom scan line for hardware cursor
  596.     '   scrMask%      Screen mask for software cursor
  597.     '   curMask%      Cursor mask for software cursor
  598.     '
  599.     '   Note: If you are specifying a hardware cursor, then only the botScan%
  600.     '         and topScan% parameters need meaningful values.  If you select
  601.     '         a software cursor, then only the scrMask% and curMask% need
  602.     '         meaningful values.  You must still pass in all the parameters,
  603.     '         but only need to place real values in the parameters relevant
  604.     '         to the type of cursor you are selecting.
  605.     ' ========================================================================
  606.  
  607.  
  608.     ' ========================================================================
  609.     ' Set parameters in preparation for the call to the mouse sub.  The m2%
  610.     ' parameter contains the type of cursor requested (0=software, 1=hardware)
  611.     ' ========================================================================
  612.  
  613.     m1% = 10
  614.     m2% = cursorType%
  615.  
  616.  
  617.     ' ========================================================================
  618.     ' If you are requesting a hardware cursor, then the m3% parameter contains
  619.     ' the topScan% value and the m4% parameter contains the botScan% value.
  620.     ' If you are requesting a software cursor, then m3% contains the scrMask%
  621.     ' value and m4% contains the curMask% value.
  622.     ' ========================================================================
  623.  
  624.     IF cursorType% = 1 THEN      ' Hardware cursor
  625.         m3% = topScan%
  626.         m4% = botScan%
  627.     ELSE                         ' Software cursor
  628.         m3% = scrMask%
  629.         m4% = curMask%
  630.     END IF
  631.  
  632.  
  633.     ' ========================================================================
  634.     ' Make the call to the mouse sub with the preset parameters.
  635.     ' ========================================================================
  636.  
  637.     Mouse m1%, m2%, m3%, m4%
  638.  
  639.  
  640. END SUB
  641.  
  642. SUB MouseSetMinMaxX (minX%, maxX%)
  643.  
  644.  
  645.     ' ========================================================================
  646.     ' This routine allows you to specify the minimum and maximum horizontal
  647.     ' coordinates of the virtual screen on which the mouse cursor is allowed
  648.     ' to move.
  649.     '
  650.     ' Parameters:
  651.     ' -----------
  652.     '   minX%   The left-most x-coordinate in which the mouse can move
  653.     '   maxX%   The right-most x-coordinate in which the mouse can move
  654.     ' ========================================================================
  655.  
  656.  
  657.     ' ========================================================================
  658.     ' Make a call to the mouse sub requesting driver function 7, Set Min/Max
  659.     ' Horizontal Cursor Position.  The m3% parameter contains the minimum
  660.     ' x passed in, and m4% contains the maximum x.  There is no return value.
  661.     ' ========================================================================
  662.  
  663.     m1% = 7
  664.     m3% = minX%
  665.     m4% = maxX%
  666.     Mouse m1%, m2%, m3%, m4%
  667.  
  668.  
  669. END SUB
  670.  
  671. SUB MouseSetMinMaxY (minY%, maxY%)
  672.  
  673.     ' ========================================================================
  674.     ' This routine allows you to specify the minimum and maximum vertical
  675.     ' coordinates of the virtual screen on which the mouse cursor is allowed
  676.     ' to move.
  677.     '
  678.     ' Parameters:
  679.     ' -----------
  680.     '   minY%   The left-most y-coordinate in which the mouse can move
  681.     '   maxY%   The right-most y-coordinate in which the mouse can move
  682.     ' ========================================================================
  683.  
  684.  
  685.     ' ========================================================================
  686.     ' Make a call to the mouse sub requesting driver function 8, Set Min/Max
  687.     ' Vertical Cursor Position.  The m3% parameter contains the minimum y
  688.     ' passed in, and m4% contains the maximum y.  There is no return value.
  689.     ' ========================================================================
  690.  
  691.     m1% = 8
  692.     m3% = minY%
  693.     m4% = maxY%
  694.     Mouse m1%, m2%, m3%, m4%
  695.  
  696.  
  697. END SUB
  698.  
  699. SUB MouseSetPosition (x%, y%)
  700.      
  701.  
  702.     ' ========================================================================
  703.     ' This routine allows you to place the mouse cursor on the virtual
  704.     ' screen at coordinates x% and y%.
  705.     '
  706.     ' Parameters:
  707.     ' -----------
  708.     '   x%   The x-coordinate where the mouse cursor will be placed
  709.     '   y%   The y-coordinate where the mouse cursor will be placed
  710.     ' ========================================================================
  711.  
  712.  
  713.     ' ========================================================================
  714.     ' Make a call to the mouse sub requesting driver function 4, Set Mouse
  715.     ' Cursor Position.  The m3% parameter contains the x coordinate, while
  716.     ' the m4% parameter contains the y-coordinate.
  717.     ' ========================================================================
  718.  
  719.     m1% = 4
  720.     m3% = x%
  721.     m4% = y%
  722.     Mouse m1%, m2%, m3%, m4%
  723.  
  724.  
  725. END SUB
  726.  
  727. SUB MouseSetSensitivity (x%, y%, doubleSpeed%)
  728.  
  729.     ' ========================================================================
  730.     ' This routine allows you to set the mouse sensitivity for the x and y
  731.     ' directions, as well as set the double speed threshold.  Values for
  732.     ' all these parameters range from 1 to 100, 100 being the most sensitive.
  733.     '
  734.     ' Parameters:
  735.     ' -----------
  736.     '   x%             horizontal mouse sensitivity
  737.     '   y%             vertical mouse sensitivity
  738.     '   doubleSpeed%   Specifies the threshold for mouse double speed
  739.     ' ========================================================================
  740.  
  741.  
  742.     ' ========================================================================
  743.     ' Make a call to the mouse sub requesting driver function 26, Set Mouse
  744.     ' Sensitivity.
  745.     ' ========================================================================
  746.  
  747.     m1% = 26
  748.     m2% = x%
  749.     m3% = y%
  750.     m4% = doubleSpeed%
  751.     Mouse m1%, m2%, m3%, m4%
  752.  
  753.  
  754. END SUB
  755.  
  756. SUB MouseShow STATIC
  757.                                             
  758.  
  759.     ' ========================================================================
  760.     ' This sub displays the mouse cursor.  There are no parameters.
  761.     ' ========================================================================
  762.  
  763.  
  764.     ' ========================================================================
  765.     ' Make a call to the mouse sub requesting driver function 1, Show Cursor.
  766.     ' ========================================================================
  767.  
  768.     IF mouseState% <> MOUSEON THEN
  769.         m1% = 1
  770.         Mouse m1%, m2%, m3%, m4%
  771.         mouseState% = MOUSEON
  772.     END IF
  773.  
  774. END SUB
  775.  
  776.