• 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

    • Nothing inherently wrong, but why buy 2021 tech in 2025? Assuming you were aiming for 6-10 years of usage, better to buy something current.
    • I have begun using Windows 11 native passkey feature. i have four passkeys set up so far. Three work fine, One has never worked. I have removed it and recreated it several times, still no luck. Anyway, on the websites in which it works, it works geat. No more two 2FA.
    • No, because most people coming into the workforce are already familiar with either MS Office or Google Docs. You know, from schools. Also, OnlyOffice is Russian, which should be a nogo for almost any European government
    • XMedia Recode 3.6.1.3 by Razvan Serea XMedia Recode is a free video and audio converter. XMedia Recode supports nearly all audio and video codecs. With XMedia Recode you can easily convert nearly all film and music files in the format you want. Convert for countless devices, select the predefined profile (iPhone, iPad, iPod Touch, Android-Tablets, Sony PSP, Amazon Kindle, Smartphones Blackberry, Wii und DS, Cowon, Android, HTC, Xbox360, Samsung, LG). XMedia Recode converts: 3GP in AVI, 3GP in FLV, AC3 in MP3, AC3 in WAV, ASF in 3GP, ASF in FLV, ASF in MP4, AVI in FLV, AVI in 3GP, FLAC in MP3, FLAC in WMA, FLV in 3GP, FLV in Mp3, DVD in 3GP, DVD in AC3, DVD in AVI, DVD in MP3, DVD in MP4, DVD in MOV, DVD in SVCD, DVD in VCD, DVD in WMV, OGG in MP3, OGG in WMA, MPEG in AVI, MP2 in MP3, MP4 in FLV, MP4 in AVI, M4P in MP3, MOV in 3GP, MOV in AVI, MOV in FLV, WMA in MP3, WMV in FLV, WAV in MP3. Main functions of XMedia Recode: Extracts audio tracks from DVD, Blu-ray and video files Framework also freely selectable color (Padding) Drag-n-drop of video files directly on the encoder Selection display format (1: 1, 3:2, 4:3, 5:4, 5:6, 11:9,16: 9, 16:10, 2.21: 1) Zoom shot (none, type character box, media, Pan Scan, to screen) ''Direct Stream'' copies the audio stream or video stream into the target format 2-Pass-Encoding Volume correction Can change framerate, bit rate, resolution Can extract audio stream of most video formats Produce DVD copies for mobile phones, various mobile devices Edit Video: Color correction Video cut Cropping Denoise Delogo Deblocking De-interlacing Flip Image Start Time End Time Resolution Rotate Image Sepia Sharpness Padding Video fade in / fade out XMedia Recode 3.6.1.3 changelog: Update of ffmpeg AOM AV1 Codec: Added "Quantization" options Update of x264 (3221) Codec Update of the Italian language file Update of the Korean language file Fixed minor bugs Download: XMedia Recode 64-bit | Portable ~20.0 MB (Freeware) Download: XMedia Recode 32-bit | Portable Download: XMedia Recode for Windows XP SP3, Vista | Portable ~10.0 MB View: XMedia Recode Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • It's not a joke but I think it is pretty hilarious I was searching Fitch for a credit rating on a fund.   I found what Fitch had to say about the fund including this disclarimer.  LOL "This abstract may have been generated in whole or in part using artificial intelligence and is therefore subject to error and inaccuracy, including but not limited to, hallucination" No link posted for privacy reasons.       
  • Recent Achievements

    • Dedicated
      Cole Multipass earned a badge
      Dedicated
    • Week One Done
      Alexander 001 earned a badge
      Week One Done
    • Week One Done
      icecreamconesleeves earned a badge
      Week One Done
    • One Year In
      PAC0 earned a badge
      One Year In
    • One Month Later
      PAC0 earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      564
    2. 2
      +FloatingFatMan
      191
    3. 3
      ATLien_0
      187
    4. 4
      Skyfrog
      114
    5. 5
      Som
      109
  • Tell a friend

    Love Neowin? Tell a friend!