Mouse Routines in QBasic

Ben
Ben

August 1st, 2009, 6:01 am #1

I wanted to see some source code of the mouse driver that uses a standard mouse that would be used with a DOS computer. I'm interested about the mouse clock but most importantly the drawing of the mouse on screen and how it works for many screen modes and doesn't flicker and is fast and stuff. But I don't want to see the works of the mouse clock because I must find a way to convert the frequency of the little spinning sticks to on-screen coordinates myself because of my troubles with the parallel port. Where can I find example of mouse driver that is clear also.
Quote
Share

Nick
Nick

August 1st, 2009, 6:28 am #2

i THINK i know where your getting at, and funnyly enough i just worked on that verry problem today, and solved it too :) (if i understood your question)

http://www.petesqbsite.com/sections/tut ... tutor4.txt

^ that page should have everything you need... i think. at least it was for me, and i used my allready existing graphic knowledge to make a drawing program

and as for flicker

check out
http://www.petesqbsite.com/sections/tut ... aphics.txt

it's a bit simplistic, and doesn't really go into depth at all, but the main thing is, if you use pages and just load up the page needed (all the other pages are hidden) you can get rig of/or severly reduce flicker (instead of cls'ing every loop cycle)
Quote
Share

Joined: February 2nd, 2006, 10:38 pm

August 1st, 2009, 7:22 am #3

I wanted to see some source code of the mouse driver that uses a standard mouse that would be used with a DOS computer. I'm interested about the mouse clock but most importantly the drawing of the mouse on screen and how it works for many screen modes and doesn't flicker and is fast and stuff. But I don't want to see the works of the mouse clock because I must find a way to convert the frequency of the little spinning sticks to on-screen coordinates myself because of my troubles with the parallel port. Where can I find example of mouse driver that is clear also.
* Mouse clock? Spinning sticks? Parallel port?
Quote
Like
Share

Joined: March 24th, 2004, 5:02 am

August 1st, 2009, 12:06 pm #4

I wanted to see some source code of the mouse driver that uses a standard mouse that would be used with a DOS computer. I'm interested about the mouse clock but most importantly the drawing of the mouse on screen and how it works for many screen modes and doesn't flicker and is fast and stuff. But I don't want to see the works of the mouse clock because I must find a way to convert the frequency of the little spinning sticks to on-screen coordinates myself because of my troubles with the parallel port. Where can I find example of mouse driver that is clear also.
Unfortunately I can't remember the finer details.

I know I used
http://www.computer-engineering.org/ps2mouse/

Actually,
http://www.computer-engineering.org/ps2keyboard/
is also quite important because the PS/2 mouse is controlled by the keyboard controller. When that page refers to the "auxiliary device" it's really talking about the mouse.

>>but most importantly the drawing of the mouse on screen

It would just use the usual VGA tricks, very similar to GET/PUT, but hand-optimised for the very small graphic that the mouse cursor is. As you know, VGA breaks each row into groups of 8 pixels. I wouldn't be surprised if the mouse driver stores 8 versions of the mouse cursor graphic in memory, for each possible pixel-alignment, though maybe it doesn't need to.

I think there's no flicker simply because the image is so small.
Quote
Like
Share

Ben
Ben

August 2nd, 2009, 2:28 am #5

Thanks for the information. I think in screen 12 the mouse is 8 pixels wide so you can probably store it in the 16bit and shift it without carrying.

Do you have explaination for the fact that even if program is busy inside a loop or something, the mouse cursor is still movable? How exactly does that work?
Quote
Share

Joined: February 2nd, 2006, 10:38 pm

August 2nd, 2009, 4:01 am #6


If QB is in a window (0) then that is the Windows mouse which is independant of the program. To use a mouse in fullscreen QB, you need to include a mouse read (AX = 3)  to allow movements in every loop.

 
Quote
Like
Share

Joined: March 24th, 2004, 5:02 am

August 2nd, 2009, 11:49 pm #7

Thanks for the information. I think in screen 12 the mouse is 8 pixels wide so you can probably store it in the 16bit and shift it without carrying.

Do you have explaination for the fact that even if program is busy inside a loop or something, the mouse cursor is still movable? How exactly does that work?
The operating system (be it Windows or DOS) sets up some code to be run when the keyboard/mouse/hard disk/network device etc. signals that something has happened that needs to be dealt with.

The processor stops executing the current program, and runs this "interrupt handler". The interrupt handler will resume the program that was interrupted when it has finished doing whatever needs doing.

Apart from the time it takes to execute the interrupt handler, the interrupted program isn't affected in any way.

The "multikey" ASM things in the FAQ replace the ordinary keyboard handler with a custom one.
Quote
Like
Share