QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: Pete on November 28, 2018, 08:11:57 pm
-
Because there was some Assembly required!
Just in time for the holidays,
Pete
-
Yes, I can remember that mouse is the hardware not necessary for DOS but for Windows...
and QB is born in DOS' time and for DOS' programs.... so only in specific performance mouse was required (think about Drawing...)
who does remember Norton Utilities or PcTools? :-) Some times ago...
QB borning as BASIC language has no implementation for mouse but have keywords for PEN and Joystick.... on the thread of BASICA and GWBASIC each user can be a programmer for little applications and games until he need more power to switch to QuickC. :-)
-
Was it assembly, or was it a PEEK or POKE thing?
It was a PEEK and POKE thing for changing the pointer image, if I recall.
-
I'm no expert on how things work under the hood, but I recall QBasic used 3 libraries, which I believe were written in Assembly. They helped expand user capabilities for certain added features such as a mouse.
CALL ABSOLUTE
CALL INTERRUPT
CALL INTERRUPTX
Those are the three I remember. I Never used CALL INTERUPTX, so I can't remember what it was good for. ABSOLUTE and INTERRUPT libraries both had ways to incorporate mouse routines in your program. Of the two, I liked INTERRUPT best. Rob was able to incorporate those routines into QB64, and I still use them in the utilities I make today. I have also used QB64 mouse statements, which are a bit different but work great and since Rob added the positioning ability of the mouse pointer a few years back.
Michael Calkins was very adept at assembly and has some code posted at The QBasic Forum and at the former [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] that incorporated Assembly in QB programs. I bought a book to understand the mouse and some other Assembly programs, but never got very far. I need a more plain English way of understanding code.
Pete
Pete
-
@Pete
about mouse library you can see how to use CALL ABSOLUTE pointing to the string which brings ASSEMBLY code...
A magistral example is the CHESS program of the great Bob.... This code is in the packeage of the code travelling as examples into QB64 folder....as path
\programs\samples\thebob\chess
the file is Chessubs.bas, but on first you must create the images for that program by running the CHESS.BAS that is in the same folder!
As many of us know, code doesn't work well in QB64 for parsing error.... you can get error in calling that routine that uses CALL ABSOLUTE for parameters... and if you put the right number at the place of the variable that brings the number of service of Interrupt you get another error.... :-) parsing error that IMHO closes an open door for clever assembly programmers, and this is the cause because also CALL INTERRUPT is emulated... only for Mouse interrupt and only for few service...
Time ago both I both Ashish, for different ways, have made a QB64 version of Bob's programs and in different times we have posted these translation in QB64 on [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]
Some years ago in the library section of the [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] I posted a my library using CALL INTERRUPT for mouse and some services more than that implemented in QB64 as _Mouse...... but with the evolution of programming world, those more services are rare to use following the standard of programming and if someone needs them they can be built using the basic functions that are in QB64...
an example is the code posted some time on this forum to catch the mouse into a window... (please not see Inform example because it is wrong because it interfer with inner manager of mouse of Inform)
@Bplus
I think you're right saying that by PEEK and POKE (and more over INP and OUT) you can manage mouse in QBASIC
while IMHO in QB64 this is only theorically possible because also PEEK and POKE (and INP and OUT) are emulated...
but you have _MEM if you like to play with Assembly ;-)
but be careful for OS services and security programs.... a low level action is suspicious for guardians of OS!
IMHO if you need more power for your purposes you can use an exernal library as DLL (if you are clever in assembly or C or C++ you can make an your DLL) or if you need that your program runs only into an OS you can use API OS library!
Not only for mouse but also for driver for other kind of external hardware, see Pen (not implemented in QB64), tablet to draw or write by hand, scanner, fax or whatyouhavetomanage.
This is not the time of Far West DOS! You are not so free to manage and to use your machine as you desire!
But surfing under the API of an OS is not for all!
For example QB64 does this into managing the mouse but then it (QB64) looses the setting of OS for mouse... see if you invert mouse's input in the OS (right click for select and left click for menu floating).
Thanks to read and sorry for many words
-
Ah! CALL INTERRUPT rings a bell!
-
No, no, no! You need SOUND for that.
Pete :D
-
No, there was no need for assembly. Coders just had to call an interrupt, and the parameter going in determined whether you'd get back the X or Y position of the pointer, or the button state.
http://www.petesqbsite.com/sections/tutorials/zines/basix/3-mouse.txt
-
Well I know that... but how would, Because some "CALL INTERRUPT was required" be funny?
Anyway, are you from that "other" Pete's site? That Pete just registered recently at my old N54 QBasic Forum, which is now hosted by Tapatalk. It's good to see him back after several years away.
Welcome to the forum here, and I hope you'll have a fun stay.
Pete