home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / mouse / mouse2 / mouse.pas next >
Encoding:
Pascal/Delphi Source File  |  1991-05-02  |  26.1 KB  |  870 lines

  1. {
  2.                                
  3. Msg #:  590                       PASCAL Subboard
  4.  From:  RON PRITCHETT             Sent: 04-30-91 20:58
  5.    Re:  MOUSE UNIT
  6.  * Origin: Ronnue's Realm - Columbia, SC (803)781-2440
  7.  
  8. }
  9.  
  10. UNIT Mouse;
  11. { Mouse unit for Turbo Pascal.
  12.   The comments in this unit were basically copied directly
  13.   from the Advanced MS Dos Programing book, the section on
  14.   the Microsoft Mouse Driver, which was the source of all
  15.   the mouse interrupt functions and their parameters.
  16. }
  17.  
  18.  
  19. INTERFACE
  20.  
  21. USES
  22.   Dos;
  23.  
  24. CONST
  25.   LeftButton = 1;
  26.   RightButton = 2;
  27.   CenterButton = 4;
  28.   AnyButton = 7;
  29.  
  30. PROCEDURE InitMouse(VAR Buttons : word; VAR Err : boolean);
  31. { Initializes the mouse driver.
  32.   Call:    nothing
  33.   Returns: Buttons = number of mouse buttons
  34.     Err     = false if mouse support is available, true otherwise
  35.    Note:    * After a call to this function the driver is initialized to
  36.               the following state:
  37.       - Mouse pointer at screen center and hidden.
  38.       - Display page is set to zero.
  39.       - Mouse pointer shape set to default arrow shape in graphics modes,
  40.         or reverse block in text modes.
  41.       - User mouse event handlers are disabled.
  42.       - Light pen emulation enabled.
  43.       - Mouse sensitivity set to default vales (see SetMouseSense)
  44.       - Pointer limits set to entire screen.
  45. }
  46.  
  47. PROCEDURE ShowPointer;
  48. { Displays the mouse pointer, and cancels any pointer exclusion area.
  49.   Call:    nothing
  50.   Returns: nothing
  51.   Note:    * A counter is maintained which is decremented by HidePointer
  52.              and is incremented (if nonzero) by this function.  The mouse
  53.              pointer is displayed any time the counter is zero.  The
  54.              counter is set to -1 when the mouse driver is reset.
  55. }
  56.  
  57. PROCEDURE HidePointer;
  58. { Removes the mouse pointer from the screen, but continues to track the
  59.   position of the mouse.
  60.   Call:    nothing
  61.   Returns: nothing
  62.   Note:    * see ShowPointer
  63. }
  64.  
  65. FUNCTION ButtonPressed(Mask : word) : boolean;
  66. { Returns a true value if the specified button(s) is pressed.
  67.   Call:    Mask = bit mask of desired button(s)
  68.     bit(s)  Significance(if set)
  69.     0       left button
  70.     1       right button
  71.     2       center button
  72.     3-15    reserved(0)
  73.   Returns: True is button is pressed, false otherwise.
  74.   Note:    * The constants LeftButton, RightButton, CenterButton, and
  75.              AnyButton can be used for the bit masking.  They equal 1, 2,
  76.              4, and 7 respectivly.
  77. }
  78.  
  79. PROCEDURE GetMousePosition(VAR Buttons, Horiz, Vert : word);
  80. { Returns the current mouse button status and pointer position.
  81.   Call:    nothing
  82.   Returns: Buttons = mouse button status
  83.     Horiz   = horizontal (X) coordinate
  84.     Vert    = vertical (Y) coordinate
  85.    Note:    * Coordinates are in pixels regardless of the current
  86.               display mode.
  87.       Position (0,0) is the upper left corner of the screen.
  88. }
  89.  
  90. FUNCTION MouseIn(x1,y1,x2,y2: word):boolean;
  91. { Returns true if mouse is within rectangle with upper-left
  92.   corner (x1,y1) and lower-right corner (x2,y2).
  93. }
  94.  
  95. PROCEDURE SetPointerPosition(Horiz, Vert : word);
  96. { Set the position of the pointer.  The pointer is displayed in the new
  97.   position unless it has been hidden using HidePointer or it is an
  98.   exclusion area defined by SetPointerExcl.
  99.   Call:    Horiz = horizontal (X) coordinate
  100.            Vert  = vertical (Y) coordinate
  101.   Returns: nothing
  102.   Notes:   * Coordinates are in pixels regardless of the current
  103.              display mode.
  104.       Position (0,0) is the upper left corner of the screen.
  105.     * The position is adjusted if necessary to lie within the pointer
  106.       limits set by SetLimits.
  107. }
  108.  
  109. PROCEDURE GetPressInfo(Button : word;
  110.          VAR Stat, Count, Horiz, Vert : word);
  111. { Returns the current status of all mouse buttons, and the number of
  112.   presses and position of the last press for a specifed mouse button
  113.   since the last call to this procedure for that button.  The press
  114.   counter for the button is reset to zero.
  115.   Call:    Button = button identifier
  116.       0 = left button
  117.       1 = right button
  118.       2 = center button
  119.   Returns: Stat   = button status
  120.       bit(s)  Significance(if set)
  121.       0       left button is down
  122.       1       right button is down
  123.       2       center button is down
  124.       3-15    reserved(0)
  125.     Count  = button press counter
  126.     Horiz  = horizontal (X) coordinate of last button press
  127.     Vert   = vertical (Y) coordinate of last button press
  128. }
  129.  
  130. PROCEDURE GetReleaseInfo(Button : word;
  131.     VAR Stat, Count, Horiz, Vert : word);
  132. { Returns the current status of all mouse buttons, and the number of
  133.   releases and position of the last release for a specifed mouse
  134.   button since the last call to this procedure for that button.  The
  135.   release counter for the button is reset to zero.
  136.   Call:    Button = button identifier
  137.       0 = left button
  138.       1 = right button
  139.       2 = center button
  140.   Returns: Stat   = button status
  141.       bit(s)  Significance(if set)
  142.       0       left button is down
  143.       1       right button is down
  144.       2       center button is down
  145.       3-15    reserved(0)
  146.     Count  = button release counter
  147.     Horiz  = horizontal (X) coordinate of last button release
  148.     Vert   = vertical (Y) coordinate of last button release
  149. }
  150.  
  151. PROCEDURE SetLimits(HorMin, HorMax, VerMin, VerMax : word);
  152. { Limits the mouse pointer to stay within a certain area.
  153.   Call:    HorMin = Minimum horizontal (X) coordinate
  154.     HorMax = Maximum horizontal (X) coordinate
  155.     VerMin = Minimum vertical (Y) coordinate
  156.     VerMax = Maximum vertical (Y) coordinate
  157.   Returns: nothing
  158.   Note:    * If both HorMin and HorMax are zero then then the previous
  159.              horizontal limits remain unchanged; the same is true for
  160.              VerMin and VerMax.
  161. }
  162.  
  163. PROCEDURE SetPointerShape(Horiz, Vert : word; Buffer : pointer);
  164. { Defines the shape, color, and hot spot of the pointer in graphics
  165.   modes.
  166.   Call:    Horiz  = hot spot offset from the left
  167.            Vert   = hot spot offset from the top
  168.            Buffer = pointer to mouse pointer image buffer
  169.   Returns: nothing
  170.   Note:    * The pointer image buffer is 64 bytes long.  The first 32
  171.              bytes contain a bit mask which is ANDed with the screen
  172.              image, and the remaining 32 bytes are then XORed with the
  173.              screen image.
  174.     * The hot spot is relative to the upper left corner of the pointer
  175.       image, and each offset must be in the range -16 to 16.  In display
  176.       modes 4 and 5, the horizontal offset must be an even number.
  177. }
  178.  
  179. PROCEDURE SetTextPointer(PtrTyp, AND_Str, XOR_End : word);
  180. { Defines the shape and attributes of the mouse pointer in text modes.
  181.   Call:    PtrTyp  = pointer type
  182.        0 = software cursor
  183.        1 = hardware cursor
  184.     AND_Str = AND mask value (if PtrTyp = 0) or starting line for
  185.        cursor (if PtrTyp = 1)
  186.     XOR_End = XOR mask value (if PtrTyp = 0) or ending line for
  187.        cursor (if PtrTyp = 1)
  188.   Returns: nothing
  189.   Notes:   * If the software text cursor is selected, the masks in
  190.              AND_Str and XOR_End are mapped as follows:
  191.       Bit(s)   Significance
  192.       0-7      character code
  193.       8-10     foreground color
  194.       11       intensity
  195.       12-14    background color
  196.       15       blink
  197.       For Example, the following call would yeild a software cursor
  198.       that inverts the foreground and background colors:
  199.       SetTextPointer(0, $77FF, $7700);
  200.     * When the hardware text cursor is selected, the values in AND_Str
  201.       and XOR_End are the starting and ending lines for the blinking
  202.       cursor generated by the video adapter.  The maximum scan line
  203.       depends on the type of adapter and the current display mode.
  204. }
  205.  
  206. PROCEDURE GetMotionCount(VAR Horiz, Vert : word);
  207. { Returns the net mouse displacement since the last call to this
  208.   procedure.  The returned value is in mickeys; a positive number
  209.   indicates travel to the right or downwards, a negative number
  210.   indicates travel to the left or upwards.  One mickey represents
  211.   approximately 1/200 of an inch of mouse movement.
  212.   Call:    nothing
  213.   Returns: Horiz = horizontal (X) mickey count
  214.     Vert  = vertical (Y) mickey count
  215. }
  216.  
  217. PROCEDURE SetEventHandler(EventMask : word; Handler : pointer);
  218. { Sets the address and event mask for an application program's mouse
  219.   event handler.  The handler is called by the mouse driver whenever
  220.   the specifed mouse events occur.
  221.   Call:    EventMask = event mask
  222.          Bit(s)  Significance(if set)
  223.          0       mouse movement
  224.          1       left button pressed
  225.          2       left button released
  226.          3       right button pressed
  227.          4       right button released
  228.          5       center button pressed
  229.          6       center button released
  230.          7-15    reserved(0)
  231.     Handler   = Pointer to the handler procedure
  232.   Returns: nothing
  233.   Notes:   * The user-defined handler is entered from the mouse driver
  234.              by a far call with the registers set up as follows:
  235.       AX       mouse event flags (see event mask)
  236.       BX       button state
  237.         Bit(s)  Significance(if set)
  238.         0       left button is down
  239.         1       right button is down
  240.         2       center button is down
  241.         3-15    reserved(0)
  242.       CX       horizontal (X) pointer coordinate
  243.       DX       vertical (Y) pointer coordinate
  244.       SI       last raw vertical mickey count
  245.       DI       last raw horizontal mickey count
  246.       DS       mouse driver data segment
  247.     * If an event does not generate a call to the user-defined handler
  248.       because its bit is not set in the event mask, it is still reported
  249.       in the event falgs during calls to the handler for events which
  250.       are enabled.
  251. }
  252.  
  253. PROCEDURE SetLightPen(On_Off : word);
  254. { Turns the light pen emulation by the mouse driver for IBM BASIC on or
  255.   off.  A "pen down" condition is created by pressing the left and right
  256.   mouse buttons simultaneosly.
  257.   Call:    On_Off = true to enable or false to disable emulation.
  258.   Returns: nothing
  259. }
  260.  
  261. PROCEDURE SetPointerExcl(HorMin, VerMin, HorMax, VerMax : word);
  262. { Defines an exclusion area for the mouse pointer.  When the mouse
  263.   pointer lies within the specified area, it is not displayed.
  264.   Call:    HorMin = upper left X coordinate
  265.     VerMin = upper left Y coordinate
  266.     HorMax = lower right X coordinate
  267.     VerMax = lower right Y coordinate
  268.   Returns: nothing
  269.   Note:    *  The exclusion area is replaced by another call to this
  270.        procdure or cancelled by InitMouse and ShowPointer.
  271. }
  272.  
  273. PROCEDURE SwapEventHandlers(VAR Mask : word; VAR Buffer : pointer);
  274. { Set the address and event mask for an application program's mouse
  275.   event handler and returns the address and event mask for the previous
  276.   handler.  The newly installed handler is called by the mouse driver
  277.   whenever the specified mouse events occur.
  278.   Call:    Mask    = event mask
  279.        Bit(s)  Significance(if set)
  280.        0       mouse movement
  281.        1       left button pressed
  282.        2       left button released
  283.        3       right button pressed
  284.        4       right button released
  285.        5       center button pressed
  286.        6       center button released
  287.        7-15    reserved(0)
  288.     Handler = Pointer to the handler procedure
  289.   Returns: Mask    = previous event mask
  290.            Handler = pointer to previous handler
  291.   Notes:   * The notes for SetEventHandler describe the information
  292.              passed to the user-defined event handler.  Also see
  293.              SetAltEventHandler.
  294.     * Calls to the event handler are disabled with InitMouse or by
  295.       setting an event mask of zero.
  296. }
  297.  
  298. FUNCTION GetSaveStateSize : word;
  299. { Returns the size of the buffer required to store the current state of
  300.   the mouse driver.
  301.   Note:    * also see SaveDrvrState and RestoreDrvrState.
  302. }
  303.  
  304. PROCEDURE SaveDrvrState(Buffer : pointer);
  305. { Saves the mouse driver state in a user buffer.  THe minimum size for
  306.   the buffer must be determined by GetSaveStateSize.
  307.   Call:    Buffer = pointer to the user defined buffer.
  308.   Returns: nothing
  309.   Note:    * Use this procedure before executing a child program
  310.              (Exec), in case the child also uses the mouse. After
  311.              the Exec call, restore the previous mouse driver state
  312.              using RestoreDrvrState.
  313. }
  314.  
  315. PROCEDURE RestoreDrvrState(Buffer : pointer);
  316. { Restores the mouse driver state from a user buffer.
  317.   Call:    Buffer = pointer to the user defined buffer.
  318.   Returns: nothing
  319.   Note:    * The mouse driver state must have been previously saved
  320.              into the same buffer with SaveDrvrState.  The format of
  321.              the data in the buffer in undocumented and subject to
  322.              change.
  323. }
  324.  
  325. PROCEDURE SetAltEventHandler(Mask : word; Handler : pointer; VAR Err:
  326. boolean);
  327.  
  328. { Sets the address and event mask for an application program's mouse
  329.   event handler.  As many as three handlers with distinct event masks
  330.   can be registered with this function.  When an event occurs that
  331.   matches one of the masks, the corresponding handler is called by
  332.   the mouse driver.
  333.   Call:    Mask    = event mask
  334.        Bit(s)  Significance(if set)
  335.        0       mouse movement
  336.        1       left button pressed
  337.        2       left button released
  338.        3       right button pressed
  339.        4       right button released
  340.        5       Shift key pressed during button press or release
  341.        6       Ctrl key pressed during button press or release
  342.        7       Alt key pressed during button press or release
  343.        8-15    reserved(0)
  344.     Handler = Pointer to the handler procedure
  345.   Returns: Err     = false if successful, true otherwise
  346.   Notes:   * When this procedure is called, at least one of the bits 5,
  347.              6, and 7 must be set in Mask.
  348.     * The user-defined handler is entered from the mouse driver by a
  349.       far call with the registers set up as follows:
  350.       AX       mouse event flags (see event mask)
  351.       BX       button state
  352.         Bit(s)  Significance(if set)
  353.         0       left button is down
  354.         1       right button is down
  355.         2       center button is down
  356.         3-15    reserved(0)
  357.       CX       horizontal (X) pointer coordinate
  358.       DX       vertical (Y) pointer coordinate
  359.       SI       last raw vertical mickey count
  360.       DI       last raw horizontal mickey count
  361.       DS       mouse driver data segment
  362.     * If an event does not generate a call to the user-defined handler
  363.       because its bit is not set in the event mask, it is still reported
  364.       in the event falgs during calls to the handler for events which
  365.       are enabled.
  366.     * Calls to the handler are disabled with InitMouse.
  367.     * Also see SetEventHandler and SwapEventHandlers.
  368. }
  369.  
  370. PROCEDURE GetAltEventAdrs(VAR Mask : word; VAR Handler : pointer;
  371.      VAR Err : boolean);
  372. { Returns the address for the mouse event handler matching the specified
  373.   event mask.
  374.   Call:    Mask    = event mask
  375.        (see SetAltEventHandler)
  376.   Returns: Mask    = event mask
  377.     Handler = pointer to the alternate event handler
  378.     Err     = false if successful, true if not successful (no handler
  379.        installed or event mask does not match any installed
  380.        handler.
  381.   Note:    * SetAltEventHandler allows as many as three event handler with
  382.       distinct event masks to be installed.  This procedure can be
  383.       called to search for a handler that matches a specific event, so
  384.       that it can be replaced or disabled.
  385. }
  386. PROCEDURE SetMouseSense(Horiz, Vert, Double : word);
  387. { Set the number of mickeys per 8 pixels for horizontal and vertical mouse
  388.   motion and the threshold speed for doubleing pointer motion on the screen.
  389.   One mickey represents approximately 1/200 of an inch of mouse travel.
  390.   Call:    Horiz  = horizontal mickeys (1-32,767; default=8)
  391.     Vert   = vertical mickeys (1-32,767; default=16)
  392.     Double = double speed threshold in mickeys/second (default=64);
  393.   Returns: nothing
  394. }
  395.  
  396. PROCEDURE GetMouseSense(VAR Horiz, Vert, Double : word);
  397. { Return the current mickeys to pixels ratios for vertical and horizontal
  398.   screen movement and the threshold speed for doubling of pointer motion.
  399.   Call:    nothing
  400.   Returns: Horiz  = horizontal mickeys (1-32,767; default=8)
  401.     Vert   = vertical mickeys (1-32,767; default=16)
  402.     Double = double speed threshold in mickeys/second (default=64);
  403. }
  404.  
  405. PROCEDURE SetMouseIntr(Flags : word);
  406. { Sets the rate at which the mouse driver polls the status of the mouse.
  407.   Faster rates provide better resolution in graphics mode but may degrade
  408.   the performance of application programs.
  409.   Call:    Flags = interrupt rate flags
  410.      Bit(s)    Significance(if set)
  411.      0         no interrupts allowed
  412.      1         30 interrupts/second
  413.      2         50 interrupts/second
  414.      3         100 interrupts/second
  415.      4         200 interrupts/second
  416.      5-15      reserved(0)
  417.   Returns: nothing
  418.   Notes:   * This procedure is applicable for the InPort Mouse only.
  419.     * In more than one bit is set in Flags, the lowest order bit
  420.       prevails.
  421. }
  422.  
  423. PROCEDURE SetPointerPage(Page : word);
  424. { Selects the display page for the mouse pointer.
  425.   Call:    Page = display page
  426.   Returns: nothing
  427.   Note:    * The valid page numbers depend on the current display mode.
  428. }
  429.  
  430. FUNCTION GetPointerPage : word;
  431. { Returns the current display page for the mouse pointer.
  432. }
  433.  
  434. PROCEDURE DisableMouseDrvr(VAR Handler : pointer; VAR Err : boolean);
  435. { Disables the mouse driver and returns the address of the previous Int 33H
  436.   handler.
  437.   Call:    nothing
  438.   Returns: Handler = pointer to previous Int 33H handler
  439.     Err     = false if successful, true otherwise
  440.   Notes:   * When this procedure is called, the mouse driver releases any
  441.       interrupt vectors it hase captured OTHER than Int 33H (which may
  442.       be Int 10H, Int 71H, and/or Int 74H).  The application program
  443.       can COMPLETE the process of logically removing the mouse driver
  444.       by restoring the original contents of the Int 33H vector with
  445.       SetIntVec using the pointer returned by the procedure.
  446.     * Also see EnableMouseDrvr.
  447. }
  448.  
  449. PROCEDURE EnableMouseDrvr;
  450. { Enables the mouse driver and the servicing fo mouse interrupts.
  451.   Call:    nothing
  452.   Returns: nothing
  453.   Note:    * Also see DisableMouseDrvr
  454. }
  455.  
  456. PROCEDURE ResetMouseDrvr(VAR Buttons : word; VAR Err : boolean);
  457. { Resets the mouse driver and returns driver status.  If the mouse pointer was
  458.   previously visible, is is removed trom the screen, and any presoiusly
  459.   installed user event handlers for mouse events are disabled.
  460.   Call:    nothing
  461.   Returns: Buttons = number of mouse buttons
  462.     Err     = false if mouse support is available, true otherwise
  463.   Note:    * This procedure differ from InitMouse in that there is no
  464.       initialization of the mouse hardware.
  465. }
  466.  
  467. PROCEDURE SetMouseLang(LangNumber : word);
  468. { Selects the language that will be used by the mouse driver for prompts and
  469.   error messages.
  470.   Call:    LangNumber = language number
  471.    0 = English
  472.    1 = French
  473.    2 = Dutch
  474.    3 = German
  475.    4 = Swedish
  476.    5 = Finnish
  477.    6 = Spanish
  478.    7 = Portuguese
  479.    8 = Italian
  480.   Returns: nothing
  481.   Note:    * This procedure is only functional in international versions of
  482.       the Microsoft Mouse drive.
  483. }
  484.  
  485. FUNCTION GetMouseLang : word;
  486. { Returns the number of the language that is used by the mouse driver for
  487.   prompts and error messages.
  488.   Call:    nothing
  489.   Returns: language number (see above)
  490.   Note:    * This procedure is only functional in international versions of
  491.       the Microsoft Mouse drive.
  492. }
  493.  
  494. PROCEDURE GetMouseInfo(VAR MajVer, MinVer, MouseType, IRQ : word);
  495. { Returns the mouse driver version number, mouse type, and the IRQ number of
  496.   the interrupt used by the mouse adapter.
  497.   Call:    nothing
  498.   Returns: MajVer    = major version number (6 for version 6.10, etc.)
  499.     MinVer    = minor version number (10 for version 6.10, etc.)
  500.     MouseType = mouse type
  501.          1 = bus mouse
  502.          2 = serial mouse
  503.          3 = InPort mouse
  504.          4 = PS/2 mouse
  505.          5 = HP mouse
  506.     IRQ       = IRQ number
  507.          0                = PS/2
  508.          2, 3, 4, 5, or 7 = IRQ number
  509. }
  510.  
  511.  
  512. IMPLEMENTATION
  513.  
  514. CONST
  515.   MouseInt = $33;
  516.  
  517. VAR
  518.   Reg : Registers;
  519.  
  520.  
  521. PROCEDURE InitMouse(VAR Buttons : word; VAR Err : boolean);
  522. { Iniialize the mouse driver, if present, and return the number of
  523. buttons. }
  524.  
  525. BEGIN
  526.   Reg.AX := 0;
  527.   intr(MouseInt, Reg);
  528.   Buttons := Reg.BX;
  529.   IF (Reg.AX = 0) THEN
  530.     Err := true
  531.   ELSE
  532.     Err := false;
  533. END;
  534.  
  535.  
  536. PROCEDURE ShowPointer;
  537.  
  538. BEGIN
  539.   Reg.AX := 1;
  540.   intr(MouseInt, Reg);
  541. END;
  542.  
  543. PROCEDURE HidePointer;
  544.  
  545. BEGIN
  546.   Reg.AX := 2;
  547.   intr(MouseInt, Reg);
  548. END;
  549.  
  550. FUNCTION ButtonPressed(Mask : word) : boolean;
  551.  
  552. BEGIN
  553.   Reg.AX := 3;
  554.   intr(MouseInt, Reg);
  555.   IF (Reg.BX > 0) THEN
  556.     ButtonPressed := true
  557.   ELSE
  558.     ButtonPressed := false;
  559. END;
  560.  
  561. PROCEDURE GetMousePosition(VAR Buttons, Horiz, Vert : word);
  562.  
  563. BEGIN
  564.   Reg.AX := 3;
  565.   intr(MouseInt, Reg);
  566.   Buttons := Reg.BX;
  567.   Horiz := Reg.CX;
  568.   Vert := Reg.DX;
  569. END;
  570.  
  571. FUNCTION MouseIn(x1,y1,x2,y2: word):boolean;
  572. VAR b,x,y: word;
  573. BEGIN
  574.   GetMousePosition(b,x,y);
  575.   MouseIn:=(x>=x1) AND (x<=x2) AND (y>=y1) AND (y<=y2)
  576. END;
  577.  
  578. PROCEDURE SetPointerPosition(Horiz, Vert : word);
  579.  
  580. BEGIN
  581.   Reg.AX := 4;
  582.   Reg.CX := Horiz;
  583.   Reg.DX := Vert;
  584.   intr(MouseInt, Reg);
  585. END;
  586.  
  587. PROCEDURE GetPressInfo(Button : word;
  588.          VAR Stat, Count, Horiz, Vert : word);
  589.  
  590. BEGIN
  591.   Reg.AX := 5;
  592.   Reg.BX := Button;
  593.   intr(MouseInt, Reg);
  594.   Stat := Reg.AX;
  595.   Count := Reg.BX;
  596.   Horiz := Reg.CX;
  597.   Vert := Reg.DX;
  598. END;
  599.  
  600.  
  601. PROCEDURE GetReleaseInfo(Button : word;
  602.     VAR Stat, Count, Horiz, Vert : word);
  603.  
  604. BEGIN
  605.   Reg.AX := 6;
  606.   Reg.BX := Button;
  607.   intr(MouseInt, Reg);
  608.   Stat := Reg.AX;
  609.   Count := Reg.BX;
  610.   Horiz := Reg.CX;
  611.   Vert := Reg.DX;
  612. END;
  613.  
  614. PROCEDURE SetLimits(HorMin, HorMax, VerMin, VerMax : word);
  615.  
  616. BEGIN
  617.   IF (HorMin > 0) AND (HorMax > 0) THEN
  618.     BEGIN
  619.       Reg.AX := 7;
  620.       Reg.CX := HorMin;
  621.       Reg.DX := HorMax;
  622.       intr(MouseInt, Reg);
  623.     END;
  624.   IF (VerMin > 0) AND (VerMax > 0) THEN
  625.     BEGIN
  626.       Reg.AX := 8;
  627.       Reg.CX := VerMin;
  628.       Reg.DX := VerMax;
  629.       intr(MouseInt, Reg);
  630.     END;
  631. END;
  632.  
  633. PROCEDURE SetPointerShape(Horiz, Vert : word; Buffer : pointer);
  634.  
  635. BEGIN
  636.   Reg.AX := 9;
  637.   Reg.BX := Horiz;
  638.   Reg.CX := Vert;
  639.   Reg.ES := Seg(Buffer);
  640.   Reg.DX := Ofs(Buffer);
  641.   intr(MouseInt, Reg);
  642. END;
  643.  
  644. PROCEDURE SetTextPointer(PtrTyp, AND_Str, XOR_End : word);
  645.  
  646. BEGIN
  647.   Reg.AX := 10;
  648.   Reg.BX := PtrTyp;
  649.   Reg.CX := AND_Str;
  650.   Reg.DX := XOR_End;
  651.   intr(MouseInt, Reg);
  652. END;
  653.  
  654. PROCEDURE GetMotionCount(VAR Horiz, Vert : word);
  655.  
  656. BEGIN
  657.   Reg.AX := 11;
  658.   intr(MouseInt, Reg);
  659.   Horiz := Reg.CX;
  660.   Vert := Reg.DX;
  661. END;
  662.  
  663. PROCEDURE SetEventHandler(EventMask : word; Handler : pointer);
  664.  
  665. BEGIN
  666.   Reg.AX := 12;
  667.   Reg.CX := EventMask;
  668.   Reg.ES := seg(Handler);
  669.   Reg.DX := ofs(Handler);
  670.   intr(MouseInt, Reg);
  671. END;
  672.  
  673. PROCEDURE SetLightPen(On_Off : word);
  674.  
  675. BEGIN
  676.   IF (On_Off = 0) THEN
  677.     Reg.AX := 14
  678.   ELSE
  679.     Reg.AX := 13;
  680.   intr(MouseInt, Reg);
  681. END;
  682.  
  683. PROCEDURE SetPointerExcl(HorMin, VerMin, HorMax, VerMax : word);
  684.  
  685. BEGIN
  686.   Reg.AX := 16;
  687.   Reg.CX := HorMin;
  688.   Reg.SI := HorMax;
  689.   Reg.DX := VerMin;
  690.   Reg.DI := VerMax;
  691.   intr(MouseInt, Reg);
  692. END;
  693.  
  694. PROCEDURE SwapEventHandlers(VAR Mask : word; VAR Buffer : pointer);
  695.  
  696. BEGIN
  697.   Reg.AX := 20;
  698.   Reg.CX := Mask;
  699.   Reg.ES := Seg(Buffer);
  700.   Reg.DX := Ofs(Buffer);
  701.   intr(MouseInt, Reg);
  702.   Mask := Reg.CX;
  703.   Buffer := Ptr(Reg.ES, Reg.DX);
  704. END;
  705.  
  706. FUNCTION GetSaveStateSize : word;
  707.  
  708. BEGIN
  709.   Reg.AX := 21;
  710.   intr(MouseInt, Reg);
  711.   GetSaveStateSize := Reg.BX;
  712. END;
  713.  
  714. PROCEDURE SaveDrvrState(Buffer : pointer);
  715.  
  716. BEGIN
  717.   Reg.AX := 22;
  718.   Reg.ES := Seg(Buffer);
  719.   Reg.DX := Ofs(Buffer);
  720.   intr(MouseInt, Reg);
  721. END;
  722.  
  723. PROCEDURE RestoreDrvrState(Buffer : pointer);
  724.  
  725. BEGIN
  726.   Reg.AX := 23;
  727.   Reg.ES := Seg(Buffer);
  728.   Reg.DX := Ofs(Buffer);
  729.   intr(MouseInt, Reg);
  730. END;
  731.  
  732. PROCEDURE SetAltEventHandler(Mask : word; Handler : pointer; VAR Err:
  733. boolean);
  734.  
  735. BEGIN
  736.   Reg.AX := 24;
  737.   Reg.CX := Mask;
  738.   Reg.ES := Seg(Handler);
  739.   Reg.DX := Ofs(Handler);
  740.   intr(MouseInt, Reg);
  741.   IF (Reg.AX = 24) THEN
  742.     Err := false
  743.   ELSE
  744.     Err := true;
  745. END;
  746.  
  747. PROCEDURE GetAltEventAdrs(VAR Mask : word; VAR Handler : pointer;
  748.      VAR Err : boolean);
  749.  
  750. BEGIN
  751.   Reg.AX := 25;
  752.   Reg.CX := Mask;
  753.   intr(MouseInt, Reg);
  754.   IF (Reg.CX > 0) THEN
  755.     BEGIN
  756.       Mask := Reg.CX;
  757.       Handler := Ptr(Reg.ES, Reg.DX);
  758.       Err := false;
  759.     END
  760.   ELSE
  761.     Err := true;
  762. END;
  763.  
  764. PROCEDURE SetMouseSense(Horiz, Vert, Double : word);
  765.  
  766. BEGIN
  767.   Reg.AX := 26;
  768.   Reg.BX := Horiz;
  769.   Reg.CX := Vert;
  770.   Reg.DX := Double;
  771.   intr(MouseInt, Reg);
  772. END;
  773.  
  774. PROCEDURE GetMouseSense(VAR Horiz, Vert, Double : word);
  775.  
  776. BEGIN
  777.   Reg.AX := 27;
  778.   intr(MouseInt, Reg);
  779.   Horiz := Reg.BX;
  780.   Vert := Reg.CX;
  781.   Double := Reg.DX;
  782. END;
  783.  
  784. PROCEDURE SetMouseIntr(Flags : word);
  785.  
  786. BEGIN
  787.   Reg.AX := 28;
  788.   Reg.BX := Flags;
  789.   intr(MouseInt, Reg);
  790. END;
  791.  
  792. PROCEDURE SetPointerPage(Page : word);
  793.  
  794. BEGIN
  795.   Reg.AX := 29;
  796.   Reg.BX := Page;
  797.   intr(MouseInt, Reg);
  798. END;
  799.  
  800.  
  801. FUNCTION GetPointerPage : word;
  802.  
  803. BEGIN
  804.   Reg.AX := 30;
  805.   intr(MouseInt, Reg);
  806.   GetPointerPage := Reg.BX;
  807. END;
  808.  
  809. PROCEDURE DisableMouseDrvr(VAR Handler : pointer; VAR Err : boolean);
  810.  
  811. BEGIN
  812.   Reg.AX := 31;
  813.   intr(MouseInt, Reg);
  814.   IF (Reg.AX = 31) THEN
  815.     BEGIN
  816.       Handler := ptr(Reg.ES, Reg.DX);
  817.       Err := false;
  818.     END
  819.   ELSE
  820.     Err := true;
  821. END;
  822.  
  823. PROCEDURE EnableMouseDrvr;
  824.  
  825. BEGIN
  826.   Reg.AX := 32;
  827.   intr(MouseInt, Reg);
  828. END;
  829.  
  830. PROCEDURE ResetMouseDrvr(VAR Buttons : word; VAR Err : boolean);
  831.  
  832. BEGIN
  833.   Reg.AX := 33;
  834.   intr(MouseInt, Reg);
  835.   IF (Reg.AX = $FFFF) THEN
  836.     BEGIN
  837.       Buttons := Reg.BX;
  838.       Err := false;
  839.     END
  840.   ELSE
  841.     Err := true;
  842. END;
  843.  
  844. PROCEDURE SetMouseLang(LangNumber : word);
  845.  
  846. BEGIN
  847.   Reg.AX := 34;
  848.   Reg.BX := LangNumber;
  849.   intr(MouseInt, Reg);
  850. END;
  851.  
  852. FUNCTION GetMouseLang : word;
  853.  
  854. BEGIN
  855.   Reg.AX := 35;
  856.   intr(MouseInt, Reg);
  857.   GetMouseLang := Reg.BX;
  858. END;
  859.  
  860. PROCEDURE GetMouseInfo(VAR MajVer, MinVer, MouseType, IRQ : word);
  861.  
  862. BEGIN
  863.   Reg.AX := 36;
  864.   intr(MouseInt, Reg);
  865.   MajVer := Reg.BH;
  866.   MinVer := Reg.BL;
  867.   MouseType := Reg.CH;
  868.   IRQ := Reg.CL;
  869. END;
  870.  
  871. END.
  872.