• 0

QuickBasic Mouse Driver Question


Question

I have a question on the old QuickBasic Mouse Driver.

First, here it is for refrence:

DECLARE SUB MouseDriver (AX%, bx%, CX%, DX%)
DECLARE FUNCTION MouseInit% ()
DECLARE SUB Mouseshow ()
DECLARE SUB Mousestatus (LB%, RB%, Xmouse%, Ymouse%)
DIM SHARED mouse$

RESTORE

SCREEN 13

  mouse$ = SPACE$(57)

FOR I% = 1 TO 57
  READ A$
  H$ = CHR$(VAL("&H" + A$))
  MID$(mouse$, I%, 1) = H$
NEXT I%

DATA 55,89,E5,8B,5E,0C,8B,07,50,8B,5E,0A,8B,07,50,8B
DATA 5E,08,8B,0F,8B,5E,06,8B,17,5B,58,1E,07,CD,33,53
DATA 8B,5E,0C,89,07,58,8B,5E,0A,89,07,8B,5E,08,89,0F
DATA 8B,5E,06,89,17,5D,CA,08,00
CLS

MS% = MouseInit%
IF NOT MS% THEN PRINT "Mouse not found": LET AMOUSE$ = "NO":
PRINT "Mouse found and initialized":
AMOUSE$ = "YES"

Mouseshow

LOCATE 24, 23: PRINT "any key to exit";

DO
  Mousestatus LB%, RB%, Xmouse%, Ymouse%
  LOCATE 5, 1
  PRINT "Mouse STUFF:  LB:"; LB%, "RB:"; RB%, "X:"; Xmouse%, "Y:"; Ymouse%
LOOP WHILE INKEY$ = ""

SUB MouseDriver (AX%, bx%, CX%, DX%)
  DEF SEG = VARSEG(mouse$)
  mouse% = SADD(mouse$)
  CALL Absolute(AX%, bx%, CX%, DX%, mouse%)
END SUB

SUB MouseHide
 AX% = 2
 MouseDriver AX%, 0, 0, 0
END SUB

FUNCTION MouseInit%
  AX% = 0
  MouseDriver AX%, 0, 0, 0
  MouseInit% = AX%

END FUNCTION

SUB MousePut
  AX% = 4
  CX% = X%
  DX% = Y%
  MouseDriver AX%, 0, CX%, DX%
END SUB

SUB Mouseshow
  AX% = 1
  MouseDriver AX%, 0, 0, 0
END SUB

SUB Mousestatus (LB%, RB%, Xmouse%, Ymouse%)
  AX% = 3
  MouseDriver AX%, bx%, CX%, DX%
  LB% = ((bx% AND 1) <> 0)
  RB% = ((bx% AND 2) <> 0)
  Xmouse% = CX%
  Ymouse% = DX%
END SUB

Heres my question, does anyone have any idea or remember what all the DATA is? I've been trying to figure it out myself. Im not sure if it signals a DOS interrupt or what. This really confuses me beacause I have no idea what it is supposted to represent. Anything would be great thanks.

Link to comment
https://www.neowin.net/forum/topic/133759-quickbasic-mouse-driver-question/
Share on other sites

5 answers to this question

Recommended Posts

  • 0

As for what it is, all you can hope to do is hunt down a good reference for i286 or i386.

FOR I% = 1 TO 57
 READ A$
 H$ = CHR$(VAL("&H" + A$))
 MID$(mouse$, I%, 1) = H$
NEXT I%

This is definently all you care about. I'm not sure what MID does anymore, or val.

Why do you care about such things? If you are geniunely interrrested in low-level functions of a computer assembly is much relevant. In either case, you need to download a reference.

  • 0

No, that's definitely machine code. Probably generated from assembler using MS-DOS's DEBUG.EXE.

SUB MouseDriver (AX%, bx%, CX%, DX%)

All this SUB does is load the parameters into their respective registers (AX, BX, etc) and call INT 33h.

The program doesn't set a custom mouse cursor, it just uses the default that the mouse driver provides.

MID$ extracts a substring from a string, sorta like C's substr.

&H mean hexidecimal, like 0x in C.

VAL converts a string like "-123.45" into a double (64 bit float), but it also supports &H for hex values, like this: "&H4A".

The code above the DATA statements just loads the 2 digit hex numbers as strings, prepends "&H" to them, uses VAL to convert them to numbers, and finally stores the numbers as bytes within the resulting string.

The MouseDriver SUB runs the code in the string using CALL ABSOLUTE, which is the closest thing QB has to function pointers.

This code is meant for Qbasic or maybe even QB 4.5, but I wouldn't recommend using it with QB 7.1 because it's approach won't work well with far strings. You'd be better off using a graphics library like Future.Library, UGL, or DirectQB.

You'll probably have better luck with qbasic-related questions at http://forum.qbasicnews.com/ . It's surprisingly active for such an old language.

Edited by Sterling Christensen
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Apple still has two unannounced features for iOS 26 by Hamid Ganji Apple held its WWDC25 event this month to unveil a slew of AI features and its new design for operating systems, known as Liquid Glass. While iOS 26 currently has no shortage of features, the iPhone maker might still have some features under wraps that didn’t make a debut at this month’s WWDC. Bloomberg’s Mark Gurman writes in his weekly Power On newsletter that Apple didn’t announce two iOS 26 features at the WWDC event. The first feature is a live translation of conversations via AirPods, and the latter is the ability to sync your wireless network login information across devices at a hotel or gym. Even though these features were already tipped to arrive in iOS 26, Apple held them from the event, presumably because they’re still not ready to ship. Apple appears to have learned from its experience with Apple Intelligence and aims to break the habit of unveiling new features before they are ready for release. The Live Translation on iOS 26 is currently integrated with popular apps like Messages, FaceTime, and Phone to help users break language barriers and communicate in different languages. The feature is now under development for AirPods, allowing users to hear real-time speech translations. Moreover, the WiFi syncing feature allows you to sync your sign-in information across your entire Apple ecosystem, enabling you to connect to a public WiFi network with ease. This would eliminate the need to sign into a WiFi network separately on each device. While these features haven’t arrived in iOS 26 yet, they’re more likely to be released later this year, in October or December.
    • Intel Level L4 cache has been around for a long time, so AMD Zen 3D Cache is a copy of Intel L4 cache that was introduced with Broadwell i7-5775c, which had 128mb of Level L4 cache. Secondly, Zen 6 is not faster in single-threaded performance than 13900k/14900k. 285k is something new Intel is trying, basically showing us that chiplet design does not work for gaming, just like AMD design does not work for gaming. Throwing more cores at it and having L4 cache won't fix the issue, and that is frame dip and stuttering caused by a very stupid design decision to keep the memory controller outside the compute tile. Might as well put a memory controller by bringing back a south bridge chip. lol
    • Just like AMD Zen, it is not going to work for gaming despite 3D Cache. Frame dip and stuttering are giving, which renders 14900KS the greatest gaming CPU ever released.
    • LG continues to manufacture and sell Windows laptops
  • Recent Achievements

    • Community Regular
      Primey_ went up a rank
      Community Regular
    • Reacting Well
      Gromvar earned a badge
      Reacting Well
    • Dedicated
      BreakingBenjamin earned a badge
      Dedicated
    • Week One Done
      Hartej earned a badge
      Week One Done
    • One Year In
      TsunadeMama earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      519
    2. 2
      +FloatingFatMan
      181
    3. 3
      ATLien_0
      166
    4. 4
      Skyfrog
      100
    5. 5
      Som
      97
  • Tell a friend

    Love Neowin? Tell a friend!