Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Protected Mode Mouse

Posted on 2000-02-23
8
Medium Priority
?
412 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

618 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