Link to home
Start Free TrialLog in
Avatar of Walluce
Walluce

asked on

Protected Mode Mouse

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 ?
Avatar of nils pipenbrinck
nils pipenbrinck

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

Avatar of Walluce

ASKER

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.
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
Avatar of Walluce

ASKER

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 ?
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
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

Avatar of Walluce

ASKER

Ok. You can have the points, but please tell me what a callback function is.
ASKER CERTIFIED SOLUTION
Avatar of nils pipenbrinck
nils pipenbrinck

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial