• 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

    • Meta (Facebook) tends to make horribly designed apps, which not sure if its deliberate or just plain poor design, maybe due to incompetence. For a huge internationally and well known company, this is baffling, they are getting bad PR but I guess they are tok big and super popular and seemingly can get away from any gov thus they are getting away with these blunders. Example their Facebook Stories, when mobile OS uses gestures for years to go back to previous menu, it just tends to swipe to previous or next stories instead of exiting the UI. I have to make sure I swipe from the very edge. This really bad UX but Facebook doesnt car about the bad UI practices. Is this deliberate, malice? Idk, maybe for force engagement, or just somebody never tested their products well about the issue, maybe they think user should know better and just arrogant to thing we are using it wrong?
    • This is insane for a tech focused site tbh. I cant understand anyone who would want this let alone anyone interested in tech or pc's. I understand the want to push stack deals but this is a terrible deal. I have bought a few deals through neowins stack before, they were good deals but this....
    • Its really apparent that these features and how they treat new Outlook now to be only web based to call these features "Offline mode". Like before we just gain features without them being called offline mode feature, but now here it is. It feels like if these codes bugged, we might left with app that is just useless liece kf codes when PC isnt connected to internet, especially laptops and tablets/convertibles.
    • Amazon Deal: Sony 65 inch 4K Bravia 5 2025 Mini LED TV with Dolby Vision/Atmos is $200 off by Sayan Sen Recently, we covered soundbar home theatre deals from Samsung and JBL for under $1000. Those are still selling for their best prices and you can check them out in their respective articles linked above. Obviously, for a home theatre, you also need a display, and depending on the kind of setup and room you have, you could choose a fairly premium projector like Valerion's StreamMaster Plus2 4K that is currently $300 off on Amazon US, or you could look for a TV. If you are looking for something for under $1500 then Sony has a great deal at the moment. The company's Bravia 5 mini LED 65-inch TV is on sale for $1298 thanks to a $200 discount (purchase link under the specs list below). Mini LEDs, unlike LEDs, promise much better precision in terms of backlighting which should lead to better contrasts with deeper blacks and brighter whites without being overblown either way. The full specs of the Bravia 5 are given below: Display Resolution: 3840 x 2160 (4K UHD) Panel Type: LCD with Mini LED backlight Backlight Dimming: XR Backlight Master Drive with local dimming for enhanced contrast Panel Refresh Rate: 120 Hz HDR Compatibility: Supports HDR10, HLG, and Dolby Vision Color & Image Processing: XR Triluminos Pro™ with Live Color™ technology, XR Clear Image, and XR Motion Clarity™ Connectivity & Ports: HDMI Inputs: 4 side-mounted (supports HDMI 2.1 features including 4K at 120Hz, eARC, VRR, ALLM, and SBTM) HDCP: Version 2.3 on all HDMI ports USB Ports: 2 side ports (supports FAT16, FAT32, exFAT, and NTFS formats) Other Ports: RS-232C Input: 1 (side) Digital Audio Output: 1 (side) RF (Terrestrial/Cable) Input: 1 (side) LAN Input: 1 (side) Wireless & Smart Features: Wi‑Fi: Dual‑band (2.4 GHz/5 GHz) with support for Wi‑Fi Certified 802.11 and Wi‑Fi 6 Bluetooth: Version 5.3 (compatible with A2DP, HID, HOGP, SPP, and AVRCP) Built‑in Chromecast: Yes Operating Platform: Google TV Smart Connectivity: Features BRAVIA Sync (with HDMI‑CEC), Apple HomeKit, and Apple AirPlay Get it at the link below: Sony BRAVIA 5 65 Inch TV, Mini LED, 4K120hz Television with Dolby Vision/Atmos, Exclusive Features for PlayStation®5, K-65XR50, 2025 Model: $1298.00 (Shipped and Sold by Amazon US) This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
  • Recent Achievements

    • Explorer
      Case_f went up a rank
      Explorer
    • Conversation Starter
      Jamie Smith earned a badge
      Conversation Starter
    • First Post
      NeoToad777 earned a badge
      First Post
    • Week One Done
      JoeV earned a badge
      Week One Done
    • One Month Later
      VAT Services in UAE earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      523
    2. 2
      ATLien_0
      231
    3. 3
      +FloatingFatMan
      150
    4. 4
      +Edouard
      142
    5. 5
      Michael Scrip
      109
  • Tell a friend

    Love Neowin? Tell a friend!