Solved

Protected Mode Mouse

Posted on 2000-02-23
8
369 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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.

809 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