Solved

Protected Mode Mouse

Posted on 2000-02-23
8
373 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Converting a float to a string function in c languange 10 209
SQL handling single and double quotes 3 97
Problem to show menu 5 93
delete-remove 14 98
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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
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 while-loops in the C programming language.

821 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