Mouse in graphics mo

 BBS: Inland Empire Archive
Date: 12-24-92 (08:57)             Number: 293
From: CORIDON HENSHAW              Refer#: NONE
  To: DIK COATES                    Recvd: NO  
Subj: Mouse in graphics mo           Conf: (2) Quik_Bas
Hello Dik!

In a msg of <22 Dec 92>, Dik Coates writes to Coridon Henshaw:

 CH>> the cursor on call to the driver in graphics mode, and all
 CH>> should be OK provided you aren't using a REALLY OLD version

 DC> I've tried the cursor on stuff... no avail... My is dated
 DC> 12-09-88... will see if Logitec has an update on the driver
 DC> available...

I'm using version 8.0 of the Smallflop (Microsoft) driver, and it gives me the
full return codes.  Here's the BASIC code:

===Chop=== (MOUSE.BAS)
'    MOUSE.BAS - Mouse Support Routines for the User Interface Toolbox in
'           Microsoft BASIC 7.1, Professional Development System
'              Copyright (C) 1987-1990, Microsoft Corporation
' NOTE:     This sample source code toolbox is intended to demonstrate some
'           of the extended capabilities of Microsoft BASIC 7.1 Professional
'           Development system that can help to leverage the professional
'           developer's time more effectively.  While you are free to use,

'           modify, or distribute the routines in this module in any way you
'           find useful, it should be noted that these are examples only and
'           should not be relied upon as a fully-tested "add-on" library.
'  PURPOSE: These routines are required for mouse support in the user
'           interface toolbox, but they may be used independently as well.
'  For information on creating a library and QuickLib from the routines
'  contained in this file, read the comment header of GENERAL.BAS.
'NOTE TO PONTENTAL FLAMERS:  Read the copyright.....



COMMON SHARED /uitools/ GloMenu      AS MenuMiscType
COMMON SHARED /uitools/ GloTitle()   AS MenuTitleType
COMMON SHARED /uitools/ GloItem()    AS MenuItemType

DIM Regs AS RegType
Regs.AX = &HF00
CALL INTERRUPT(&H10, Regs, Regs)
Mode% = (&HFF AND Regs.AX)
IF Mode% < 4 THEN GetMode = FALSE
IF Mode% >= 4 THEN GetMode = TRUE

SUB MouseBorder (row1, col1, row2, col2) STATIC

    ' =======================================================================
    ' Sets max and min bounds on mouse movement both vertically, and
    ' horizontally
    ' =======================================================================

    MouseDriver 7, 0, (col1 - 1) * 8, (col2 - 1) * 8
    MouseDriver 8, 0, (row1 - 1) * 8, (row2 - 1) * 8


SUB MouseDriver (m0, m1, m2, m3) STATIC

    DIM Regs AS RegType

    IF MouseChecked = FALSE THEN
        DEF SEG = 0

        MouseSegment& = 256& * PEEK(207) + PEEK(206)
        MouseOffset& = 256& * PEEK(205) + PEEK(204)

        DEF SEG = MouseSegment&

        IF (MouseSegment& = 0 AND MouseOffset& = 0) OR
PEEK(MouseOffset&) = 207
            MousePresent = FALSE
            MouseChecked = TRUE
            DEF SEG
        END IF
    END IF

    IF MousePresent = FALSE AND MouseChecked = TRUE THEN
        EXIT SUB
    END IF

    ' =======================================================================
    ' Calls interrupt 51 to invoke mouse functions in the MS Mouse Driver.
    ' =======================================================================

    Regs.AX = m0
    Regs.Bx = m1
    Regs.CX = m2
    Regs.DX = m3

    INTERRUPT 51, Regs, Regs

    m0 = Regs.AX
    m1 = Regs.Bx
    m2 = Regs.CX
    m3 = Regs.DX

    IF MouseChecked THEN EXIT SUB

    ' =======================================================================
    ' Check for successful mouse initialization
    ' =======================================================================

    IF m0 AND NOT MouseChecked THEN
        MousePresent = TRUE
        DEF SEG
    END IF

    MouseChecked = TRUE


SUB MouseForce (X%, Y%)
DIM Regs AS RegType
        Regs.DX = 8 * (X% - 1)
        Regs.CX = 8 * (Y% - 1)
        Regs.DX = X%
        Regs.CX = Y%
Regs.AX = 4
CALL INTERRUPT(&H33, Regs, Regs)


SUB MouseHide

    ' =======================================================================
    ' Decrements internal cursor flag
    ' =======================================================================

   MouseDriver 2, 0, 0, 0

Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET