PS/2 mouse driver
PS/2 mouse driver
I set up unreal mode (with A20), drew a desktop and now I'm working on a mouse driver. Since I'm in unreal mode I was wondering if it might be possible to do a good mouse driver using BIOS inturrupts (Int 33)? I already wrote one, but I'm not even gonna test it it's so bad.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:PS/2 mouse driver
int 33h is not at all a BIOS interrupt. It's something provided by a DOS driver (mouse.sys in most of the case) that stay resident and provide a standardized interface that abstracts mouse protocol decoding ...
Re:PS/2 mouse driver
Like pype said, it's just an interrupt made by a mouse driver.
So you have to write your own mouse driver for your OS.
I know a book, which can help you.
But I don't remember the english version of it, (could someone translate this to a proper title ):
"PC Hardware dl. 4 by Hans Messmer" (I don't know the author that well )
So you have to write your own mouse driver for your OS.
I know a book, which can help you.
But I don't remember the english version of it, (could someone translate this to a proper title ):
"PC Hardware dl. 4 by Hans Messmer" (I don't know the author that well )
Re:PS/2 mouse driver
The Indispensable PC Hardware Book, Hans-Peter Messmer. ISBN 0-201-59616-4.DennisCGc wrote: But I don't remember the english version of it, (could someone translate this to a proper title ):
"PC Hardware dl. 4 by Hans Messmer" (I don't know the author that well )
If you can find the 3rd ed. buy that. It has 13 appendices as opposed to 6, as well as more pages & more chapters. I'm lucky enough to have both
Re:PS/2 mouse driver
Thanks for translatingCandy wrote:The Indispensable PC Hardware Book, Hans-Peter Messmer. ISBN 0-201-59616-4.DennisCGc wrote: But I don't remember the english version of it, (could someone translate this to a proper title ):
"PC Hardware dl. 4 by Hans Messmer" (I don't know the author that well )
If you can find the 3rd ed. buy that. It has 13 appendices as opposed to 6, as well as more pages & more chapters. I'm lucky enough to have both
Re:PS/2 mouse driver
Sorry, I meant Int 15:
Int 15/AX=C200h (http://www.ctyme.com/intr/rb-1596.htm)
Int 15/AX=C209h (http://www.ctyme.com/intr/rb-1605.htm)
Things like that?
Int 15/AX=C200h (http://www.ctyme.com/intr/rb-1596.htm)
Int 15/AX=C209h (http://www.ctyme.com/intr/rb-1605.htm)
Things like that?
Re:PS/2 mouse driver
http://www.hut.fi/~then/mytexts/mouse.html
http://alexfru.narod.ru/emiscdocs.html -look at: "Mouse Programming (specs, docs)"
/ Christoffer
http://alexfru.narod.ru/emiscdocs.html -look at: "Mouse Programming (specs, docs)"
/ Christoffer
Re:PS/2 mouse driver
Why should you use that ?St8ic wrote: Sorry, I meant Int 15:
Int 15/AX=C200h (http://www.ctyme.com/intr/rb-1596.htm)
Int 15/AX=C209h (http://www.ctyme.com/intr/rb-1605.htm)
Things like that?
That's a lot more difficult than programming via the I/O ports.
(At least, I think it is, looking at the registers and format of the packets )
Re:PS/2 mouse driver
I could use the ports, but I was wondering if, since I was in unreal mode, it might be easier to do it via BIOS ints. An example for either one would be good.
Bubach:The first link was handy, but offered no code. The second one only offered code that relied on DOS. Thanks anyways.
Bubach:The first link was handy, but offered no code. The second one only offered code that relied on DOS. Thanks anyways.
Re:PS/2 mouse driver
it took me about 2 min to find that info on google, u will have to try searching a bit on your own then..
/ Christoffer
/ Christoffer
Re:PS/2 mouse driver
Maybe I'm just terrible at searching .
Could you please just look at Int 15/AX=C209h (http://www.ctyme.com/intr/rb-1605.htm) and tell me how to decode the three bytes returned by the pointer port? It couldn't be that hard, right? I suck at assembly.
I also need routines for drawing and moving the mouse...;D
Could you please just look at Int 15/AX=C209h (http://www.ctyme.com/intr/rb-1605.htm) and tell me how to decode the three bytes returned by the pointer port? It couldn't be that hard, right? I suck at assembly.
I also need routines for drawing and moving the mouse...;D
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:PS/2 mouse driver
then don't do it in assembly! Hah... You take the risk of being flamed by asking things that way.St8ic wrote: Maybe I'm just terrible at searching .
Could you please just look at Int 15/AX=C209h (http://www.ctyme.com/intr/rb-1605.htm) and tell me how to decode the three bytes returned by the pointer port? It couldn't be that hard, right? I suck at assembly.
Those won't be any different from drawing a sprite with transparent color ... Check some game programming tutorial (programmersheaven.com or something alike): any decent one should have the information you request.I also need routines for drawing and moving the mouse...;D
Re:PS/2 mouse driver
WHY SHOULD YOU USE IT ?St8ic wrote: Maybe I'm just terrible at searching .
Could you please just look at Int 15/AX=C209h (http://www.ctyme.com/intr/rb-1605.htm) and tell me how to decode the three bytes returned by the pointer port? It couldn't be that hard, right? I suck at assembly.
I also need routines for drawing and moving the mouse...;D
IT GIVES NOT A BETTER RESULT USING THE BIOS </capsmode>
using i/o ports will be faster, and it would be easier ;D
Re:PS/2 mouse driver
Here's that code I told you about that I'm possitive wouldn't work. Can you list off a couple reasons why? I'm very sorry that the syntax is so bad it's almost offensive. I'm not sure how the 8-bit X and Y movement indicators are calculated from the bits. Here I just add them all together
Code: Select all
_mouse: mov ax,C200h ; enable the mouse
int 15
mov ax,C205h ; initialize the mouse
int 15
.loop: mov ax,C209h ; read 3 bytes from mouse into bl, cl and dl
int 15
cmp byte [bl+3],1 ; is the left button pressed?
mov byte [lbpress],1 ; if it is
mov byte [lbpress],0 ; if it isn't
cmp byte [bl+4],1 ; is the right button pressed?
mov byte [rbpress],1 ; if it is
mov byte [rbpress],0 ; if it isn't
add byte [cl+8],[xmovement] ; get 8-bit X-movement indicator
add byte [cl+7],[xmovement]
add byte [cl+6],[xmovement]
add byte [cl+5],[xmovement]
add byte [cl+4],[xmovement]
add byte [cl+3],[xmovement]
add byte [bl+8],[xmovement]
add byte [bl+7],[xmovement]
add [xmovement],[xlocation] ; add movement to current location to get new location
add byte [dl+8],[ymovement] ; get 8-bit Y-movement indicator
add byte [dl+7],[ymovement]
add byte [dl+6],[ymovement]
add byte [dl+5],[ymovement]
add byte [dl+4],[ymovement]
add byte [dl+3],[ymovement]
add byte [bl+6],[ymovement]
add byte [bl+5],[ymovement]
add [ymovement],[ylocation] ; add movement to current location to get new location
LOOP .loop
lbpress db 1
rbpress db 1
xmovement db 0
ymovement db 0
xlocation db 0
ylocation db 0
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:PS/2 mouse driver
it looks like you're messing up the access of memory region based at BX plus an offset with accessing the ith bit of a register.
The docs says that BL is the 2nd octet. Obviously the value of interrest is in BL itself, not at a memory location starting at BL. So you shouldn't write
but rather
The docs says that BL is the 2nd octet. Obviously the value of interrest is in BL itself, not at a memory location starting at BL. So you shouldn't write
Code: Select all
cmp [bl+3],1
Code: Select all
test bl,2<<3