• 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

    • They are always there, available third week every month, not fully public tho
    • Lol, sounds like you're not up to date with reality and are just repeating what the salesman told ya. Here's a little insight for you: Electric Cars Are Way Less Reliable Than ICE Cars, Says Consumer Reports. Alas, you're entitled to your wrong opinion.
    • misleading its one word to describe what M$ have done, windows 10 perform better on older hardware and even on new hardware sometimes, windows 11 its a mess and no one want to use it for many good reasons, until they listen its customers read the feedback hub comments and maybe backoff its forced requiremens, they are having a vista and 8 moment.
    • Media Player Classic - Home Cinema 2.5.0 by Razvan Serea Media Player Classic - Home Cinema (MPC-HC) is a free and open-source video and audio player for Windows. MPC-HC is based on the original Guliverkli project (which is no longer maintained) and contains many additional features and bug fixes. As the continuation of the original Media Player Classic, MPC-HC isn’t flashy but it works with nearly any media format. MPC-HC uses DXVA technology to pass decoding operations to your modern video card, enhancing your viewing experience. And MPC-HC supports both physical and software DVDs with menus, chapter navigation, and subtitles. Overview of features A lot of people seem to be unaware of some of the awesome features that have been added to MPC-HC in the past years. Here is a list of useful options and features that everyone should know about: Dark interface Menu > View > Dark Theme When using dark theme it is also possible to change the height of the seekbar and size of the toolbar buttons. Options > Advanced Video preview on the seekbar Options > Tweaks > Show preview on seek bar Adjust playback speed Menu > Play > Playback rate The buttons in the player that control playback rate take a 2x step by default. This can be customized to smaller values (like 10%): Options > Playback > Speed step Adjusting playback speed works best with the internal audio renderer. This also has automatic pitch correction. Options > Playback > Output > Audio Renderer MPC-HC can remember playback position, so you can resume from that point later Options > Player > History You can quickly seek through a video with Ctrl + Mouse Scrollwheel. You can jump to next/previous file in a folder by pressing PageUp/PageDown. You can perform automatic actions at end of file. For example to go to next file or close player. Options > Playback > After Playback (permanent setting) Menu > Play > After Playback (for current file only) A-B repeat - You can loop a segment of a video. Press [ and ] to set start and stop markers. You can rotate/flip/mirror/stretch/zoom the video Menu > View > Pan&Scan This is also easily done with hotkeys (see below). There are lots of keyboard hotkeys and mouse actions to control the player. They can be customized as well. Options > Player > Keys Tip: there is a search box above the table. You can stream videos directly from Youtube and many other video websites You can stream videos directly from Youtube and many other video websites Put yt-dlp.exe or youtube-dl.exe in the MPC-HC installation folder. Then you can open website URLs in the player: Menu > File > Open File/URL You can even download those videos: Menu > File > Save a copy Tip: to be able to download in best quality with yt-dlp/youtube-dl, it is recommended to also put ffmpeg.exe in the MPC-HC folder. Several YDL configuration options are found here: Options > Advanced This includes an option to specify the location of the .exe in case you don't want to put it in MPC-HC folder. Play HDR video This requires using madVR or MPC Video Renderer. After installation these renderers can be selected here: Options > Playback > Output Ability to search for and download subtitles, either automatically or manually (press D): Options > Subtitles > Misc Besides all these (new) features, there have also been many bugfixes and internal improvements in the player in the past years that give better performance and stability. It also has updated internal codecs. Support was added for CUE sheets, WebVTT subtitles, etc. Media Player Classic - Home Cinema 2.5.0 changelog: Updated LAV Filters to version 0.80-1-gb9116 Updated MPC Video Renderer to version 0.9.9.2400 Several small fixes and improvements. Graphics Designers Wanted for New Toolbar Buttons A new toolbar is planned for implementation in the player, featuring optional extra buttons and fully customizable layouts. As a result, existing custom toolbar designs will no longer be supported in the future. New button designs are needed, and contributions from graphics designers are welcome. Those interested in helping create the new toolbar are encouraged to read the dedicated information page. Download: MPC-HC 2.5.0 (x64) | Standalone | ~20.0 MB (Open Source) Download: MPC-HC 2.5.0 (x86) | Standalone Links: MPC-HC Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Then don't put it on an IoT VLAN but put it on your main, trusted, VLAN. If you put it on a different VLAN you lose printer discovery.
  • Recent Achievements

    • Week One Done
      emptyother earned a badge
      Week One Done
    • Week One Done
      DarkWun earned a badge
      Week One Done
    • Very Popular
      valkyr09 earned a badge
      Very Popular
    • Week One Done
      suprememobiles earned a badge
      Week One Done
    • Week One Done
      Marites earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      570
    2. 2
      ATLien_0
      182
    3. 3
      +FloatingFatMan
      173
    4. 4
      Xenon
      124
    5. 5
      Michael Scrip
      117
  • Tell a friend

    Love Neowin? Tell a friend!