Version 3 Technical Highlights - Mouse_Subs

Published ByDateVersionKnowledge LevelKeywords
Sprezzatura Ltd01 OCT 19923.0+EXPERTMOUSE_SUBS

The Mouse_Subs routine has been fundamentally rewritten (to conform very closely to the published specifications for the Microsoft mouse driver - based around interrupt 33 calls) since it was discussed in Volume 3 Issue 7. It now only takes 4 parameters. As previously the first one is an action code but again, as this is a C or assembler routine the other parameters vary based upon the action code.

CodeDescriptionParam1Param2Param3
0Initialize mouse driver. Code returns 0 if a mouse is not installed or -1 if a mouse is installed and reset.

If the mouse has been lost (due to PCing to DOS or somesuch) it can be restored with a Ctrl-Break OR by calling Mouse_Subs passing it a 0 followed by a 1
Must be null. Returns the number of buttons which is always 2 or Microsoft MouseMust be nullMust be null
1Turns mouse back on after it has been turned off with a code 2Must be nullMust be nullMust be null
2Turns mouse off temporarilyMust be nullMust be nullMust be null
3Returns current location and state of mouseMust be initialised. Returns

0 No key being pressed
1 Left key being pressed
2 Right key being pressed
3 Left and right keys being pressed
Must be initialised. Returns the X position of the mouseMust be initialised. Returns the Y position of the mouse
4Locates mouse at a given X, Y position on screenMust be nullX positionY position
5
6
Returns current location and button press state of mouseMust be initialised. Returns

0 Key released
1 Left key being held down
2 Right key being held down
3 Left and right keys being held down
Must be initialised.Must be initialised.
7Sets the X coordinates within which the mouse can operateMust be nullLeftmost X position or rightmost X positionRightmost X position or leftmost X position
8Sets the Y coordinates within which the mouse can operateMust be nullLeftmost Y position or rightmost Y positionRightmost Y position or leftmost Y position
10Permits the definition of the mouse cursor character and the cursor colour. At the time of going to press the actual values have not been fully understood as it only seems to be used in PAINT when several items are selected by "boxing".Initialise to zeroSet to 32512 if using the third parameter to specify the character to use for the cursor.

Set to 30719 to reset the block cursor.³ Set to the ascii value to use for the mouse cursor, E.G. 2 for a smiley face, 65 for the letter A etc.

Set to 30464 to reset the block cursor.
11Returns a location relative to the last time the mouse was queried. Whilst this information is not stunningly useful on its own it does provide a good way of finding out whether the mouse is moving. If the second parameter returns 0 then the mouse is still, any other value means that the mouse is movingMust be nullMust be initialised. Returns the position of the mouse relative to where it last was as a positive or negative integer.Must be null
15Sets the mickey to pixel ratio, that is, how far the mouse must move before the mouse cursor moves accordingly. The lower the value in Param2 and Param3 the more sensitive the mouse isMust be nullThe horizontal sensitivity of the mouse. The lower the number, the more the mouse cursor moves for a given mouse movement. Experiment with values between 1 and 20.The vertical sensitivity of the mouse. The lower the number, the more the mouse cursor moves for a given mouse movement. Experiment with values between 1 and 20.
21Gets buffer size in bytes required by mouseReturns buffer size.Must be nullMust be null
26Sets mouse sensitivity. The lower the value used the less sensitive the mouse is. The range appears to be 1 to 100.X value. Defaults to 50.Y value. Defaults to 50.Threshold for double speed. Defaults to 50.
27Queries mouse sensitivityX value.Y value.Threshold for double speed.
36Queries the version number and the type of the mouseMust be initialised to null. Returns the version number as what appears to be a decimal string that needs to be converted to a hex string. My mouse version is 7.04, the number returned for this is 1796, which if printed "MXyMD2" gives 7.04Must be initialised to null. Returns the type of mouse multiplied by 256. Thus to get the mouse type divide by 256 and use the figures below taken from the SYSINCLUDE record CONFIGURE.RECORD.EQUS

1 Bus
2 Serial
3 InPort
4 PS/2
5 HP
Must be initialised to null.

Some calls have been omitted from the table above, specifically those which have little practical use for normal AREV programming. Note that several of the calls documented above are not currently used by AREV and thus may not be future proof. (It is considered that if AREV itself uses undocumented routines they are far more likely to stay there!). For further information about the missing calls see the Microsoft Mouse Programmer's Reference.

Codes 7 and 8 are used to construct a box on the screen within which the mouse may move. Normally this would be set to the screen width and depth but there might be times when mouse movement within an area is desirable.

The code 10 can be used to good effect within a loop in a program when you wish to indicate to a user that the mouse is inactive and that input from it will be ignored. The mouse cursor can be changed to another figure, or even as in the following example changed within the loop to give the illusion of a turning bar.

  /* Following code for demonstration purposes only, change the delay loop
  to suit your own computer */

  For z = 1 to 100
    CALL MOUSE_SUBS( 10, 0, 32512, 47 ) ; * "/"
    for x = 1 to 1000 ; next
    CALL MOUSE_SUBS( 10, 0, 32512, 196 ) ; * "-"
    for x = 1 to 1000 ; next
    CALL MOUSE_SUBS( 10, 0, 32512, 92 ) ; * "\"
    for x = 1 to 1000 ; next
    CALL MOUSE_SUBS( 10, 0, 32512, 124 ) ; * "|"
    for x = 1 to 1000 ; next
  next
  CALL MOUSE_SUBS( 10, 0, 30719, 30464 )

(Volume 4, Issue 5, Pages 4-7)

  • tips/revmedia/v4i5a1.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1