Solved

Protected Mode Mouse

Posted on 2000-02-23
8
361 Views
Last Modified: 2006-11-17
Hi. I am used to programming the mouse in real mode with int 33h. Can I still use int 33h when I am in Protected mode ? Would I still use function 14h to install an interrupt handler and how do I handle the interrupt if I get it ? Does it come in real mode(v86) or in Protected mode ?
0
Comment
Question by:Walluce
  • 5
  • 3
8 Comments
 
LVL 4

Expert Comment

by:nils pipenbrinck
ID: 2550679
all interrupts, that don't pass a segment/offset pair work well under dpmi.

That means, if you want to read the mouse position or enable/disable the mouse pointer nothing changes.

if you however want to install a custom mouse handler you have to install a realmode callback function. that's tricky but possible.

I don't have the information here.. but I can look up that stuff at home.

which compiler do you use btw?

Nils Pipenbrinck

0
 

Author Comment

by:Walluce
ID: 2553307
I use MASM. I have DGJPP but I wish to do this in assembler. There is no assembler group/forum/thingy so I posted the question here. I am not really using any DPMI server like dos4gw. My friend is writing something like that, but in order to do that, he needs to know how interrupts work in PM.
0
 
LVL 4

Expert Comment

by:nils pipenbrinck
ID: 2553336
argh..

ok. I understand... you do it the hard way...

in this case you can tell your friend the the following:

he should put a function into his realmode  code section (I'm pretty sure he has some realmode code in his extender.. if not it's time to do so).

then in this code he should far-call your protected mode mouse handler.

when you want to install your mouse-handler you should pass the segment/offset pair of his realmode handler. The far-call in the realmode segment will automatically do the switch to pm for you..

is that a solution?

Nils
0
 

Author Comment

by:Walluce
ID: 2553359
Ok. So I install the handler in V86 mode. This handler then does a far call to a PM handler that I have set up. This will make my handler run in PM, and then return to the V86 mode handler. Do I understand this correctly ?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Expert Comment

by:nils pipenbrinck
ID: 2553373
exactly.

since your pm-code selector is marked as 32 bit your code will be executed in 32 bit mode.. when you return to the 16 bit segment (with a ret) it will return to 16 bit protected mode or v86 mode (if there is any difference.. I don't know). at least it works this way.

Nils
0
 
LVL 4

Expert Comment

by:nils pipenbrinck
ID: 2553382
another thing:

make sure, that you load a usefull stack segment.. I allocate one k of memory in the 16 bit bss section and load it into ss:sp before I call the pm handler..

just to make sure you have enough stack when you switch from pm to v86.

Nils

0
 

Author Comment

by:Walluce
ID: 2553394
Ok. You can have the points, but please tell me what a callback function is.
0
 
LVL 4

Accepted Solution

by:
nils pipenbrinck earned 200 total points
ID: 2553545
hm. callback function is not the correct word. a callback function is a function which is called by a library or the os. for example you could have a graphics library where you can install a callback function which will be called every time the user changes the display settings or stuff like that.

your mouse-handler is a callback function, and it'll be called by the dos-mousedriver.

the difference between an interrupt handler and a callback function is, that a interrupt handler is called directly from the hardware, while a callback function is usually called from a software-library or os.

what you need is a v86->pmode gateway, that makes it possible to install a protected mode callback function for a service that expects a v86 function.

hope that helps,
  nils
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now