Mouse programming
Mouse programming
Hi all
well
today i have tried to make a mouse driver ( for Pmode):
but now after trying everything i could, it still dont work.
The problem is, that when i read the "data" the mose is suposed to send, i get something unvalid...
I have tryed with both stream mode, and remote mode, but the same problem comes.
the code is attached ( it is the hole test program)
What i do is:
enable aux for mouse,
reset mouse, ( i have also tryed with or without the "IRQ12" option)
set enable data reporting
then i use the comman ("E8") to get the data.
i cant realy figure it out ...
(sorry about the notes, cause they are in danish )
KMt dk
well
today i have tried to make a mouse driver ( for Pmode):
but now after trying everything i could, it still dont work.
The problem is, that when i read the "data" the mose is suposed to send, i get something unvalid...
I have tryed with both stream mode, and remote mode, but the same problem comes.
the code is attached ( it is the hole test program)
What i do is:
enable aux for mouse,
reset mouse, ( i have also tryed with or without the "IRQ12" option)
set enable data reporting
then i use the comman ("E8") to get the data.
i cant realy figure it out ...
(sorry about the notes, cause they are in danish )
KMt dk
- Attachments
-
- mouse.test.asm
- (4.49 KiB) Downloaded 95 times
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
Re: Mouse programming
I don't know much about mouse programming but I can see an error in the first line.
you CAN'T use interrupts in PMode unless you reprogrammed them and even then you can't use int 10 as this is reserved for hardware exceptions
Code: Select all
mov ax,0x0013
int 0x10
xor di,di
mov ax,0xa000
mov es,ax
call print.cursor
Gizmic OS
Currently - Busy with FAT12 driver and VFS
Currently - Busy with FAT12 driver and VFS
Re: Mouse programming
NICE TOPIC
well,I tried mouse programming in my UNEXT/os
it's flat mode kernel,whatever
my question: what is your device
1. serial
2. ps/2
mouse
in most cases your probelm not in implement's -
but in mouse protocol ,
since there is many mouse protocols.
personally i use 3 byte protocol packet for microsoft serial mouse
anyway,as rule to program mouse driver you need
1. detect mouse setting(serial,ps/2)
2. setup mouse protocol well
you can use this link,may be useful for you
http://www.computer-engineering.org/ps2mouse
good luck
well,I tried mouse programming in my UNEXT/os
it's flat mode kernel,whatever
my question: what is your device
1. serial
2. ps/2
mouse
in most cases your probelm not in implement's -
but in mouse protocol ,
since there is many mouse protocols.
personally i use 3 byte protocol packet for microsoft serial mouse
anyway,as rule to program mouse driver you need
1. detect mouse setting(serial,ps/2)
2. setup mouse protocol well
you can use this link,may be useful for you
http://www.computer-engineering.org/ps2mouse
good luck
Distance doesn't make you any smaller,
but it does make you part of a larger picture.
but it does make you part of a larger picture.
Re: Mouse programming
well first: this is the test program, meaning that it is real mode:
secound: the input is valid ( new tests) but it dont chage EVER ;
so the only input is this ( i have tryed with : laser, optical, ps2 , and none worked on bochs)
byte 1 :0x08
byte 2 :0x00
byte 3 :0x00
KMT dk
secound: the input is valid ( new tests) but it dont chage EVER ;
so the only input is this ( i have tryed with : laser, optical, ps2 , and none worked on bochs)
byte 1 :0x08
byte 2 :0x00
byte 3 :0x00
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
Re: Mouse programming
In Real mode, the BIOS handles all the mouse input, AFAIK. It receives all the IRQ12s, and then goes and reads the mouse bytes before you can get them. So you would need to hook the IRQ12 handler. It's much easier to do it in Pmode, I think.
And do you know that you need to "turn on" the mouse in bochs, before it will send you data? You either need to hit F12, or Shift+Lbutton+Rbutton, or something like that.
And do you know that you need to "turn on" the mouse in bochs, before it will send you data? You either need to hit F12, or Shift+Lbutton+Rbutton, or something like that.
Re: Mouse programming
I have a relatively well commented mouse driver for my pet kernel, might have posted it in the past, but could repost when I get back to home, if there's interest... could be useful as reference, supports PS/2 as either basic 2 button, wheel version and 5 button+wheel...
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
Re: Mouse programming
I would be very pleased, to see a driver ;P ( THX )
but after reading what bewing had written, i think i know why ( but i still dont godt it, when in remote mode, since there would not happen eney int's.. )
if "bios" reads the data, useing the command 0xE8 then it resets the count ( the reason why i only get "0" movments" but vaild packets , have not had time enough to test this ideer )
KMT dk
but after reading what bewing had written, i think i know why ( but i still dont godt it, when in remote mode, since there would not happen eney int's.. )
if "bios" reads the data, useing the command 0xE8 then it resets the count ( the reason why i only get "0" movments" but vaild packets , have not had time enough to test this ideer )
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
Re: Mouse programming
well
"my" ideer did not seem to work, so if any can show me a example witch work ( do you have to "chage" the mose's state in order to enable it: what i mean is, do you need to test the mose for 5 buttons, or whell in order to make it usable , or have i missed something)
KMT dk
"my" ideer did not seem to work, so if any can show me a example witch work ( do you have to "chage" the mose's state in order to enable it: what i mean is, do you need to test the mose for 5 buttons, or whell in order to make it usable , or have i missed something)
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
- Masterkiller
- Member
- Posts: 153
- Joined: Sat May 05, 2007 6:20 pm
Re: Mouse programming
Three of four days ago I wrote basic mouse support for unreal mode. It is not a driver, it is just a test code, that create a cursor moved by the mouse. Since it is only a test code, it is neither optimized, nor "correct", rely on it only theoritically. It works only for PS/2 mouse.
If you do not change mouseID after reset you will get 3 bytes packets, else you will get 4. MouseID will not change if does not support it (e.g. no scroller and 4 and 5 buttons).
For protected mode driver you should not wait in the interrupt for bytes to come. If in IRQ12 handler you get one byte from mouse only, and bit 0 in status of the KC is cleared, save that byte, save somewhere that you have 1 byte from mouse and send EOI. When mouse is ready with the second byte of the 3 or 4 byte packet it will interrupt again. So if system is multitasking it will not wait slow Keyboard Controller (KC).
If you do not change mouseID after reset you will get 3 bytes packets, else you will get 4. MouseID will not change if does not support it (e.g. no scroller and 4 and 5 buttons).
For protected mode driver you should not wait in the interrupt for bytes to come. If in IRQ12 handler you get one byte from mouse only, and bit 0 in status of the KC is cleared, save that byte, save somewhere that you have 1 byte from mouse and send EOI. When mouse is ready with the second byte of the 3 or 4 byte packet it will interrupt again. So if system is multitasking it will not wait slow Keyboard Controller (KC).
- Attachments
-
- mouse_test.rar
- (5.45 KiB) Downloaded 102 times
ALCA OS: Project temporarity suspended!
Current state: real-mode kernel-FS reader...
Current state: real-mode kernel-FS reader...
Re: Mouse programming
well
looking at the code, the inti part is 99 % the same
and also the problem (tested on real, and bochs ..), it dont get Any info...
so the mouse never moves, if it was supossed to ..
KMT dk
looking at the code, the inti part is 99 % the same
and also the problem (tested on real, and bochs ..), it dont get Any info...
so the mouse never moves, if it was supossed to ..
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
- Masterkiller
- Member
- Posts: 153
- Joined: Sat May 05, 2007 6:20 pm
Re: Mouse programming
Well, I tested especially that code and to me works on MS Virtual PC, Bochs and real hardware. What type mouse you are using? I use USB mouse, but I have USB-to-PS2 connector. It works only if connected to PS/2.
ALCA OS: Project temporarity suspended!
Current state: real-mode kernel-FS reader...
Current state: real-mode kernel-FS reader...
Re: Mouse programming
well
i have read the USB HID part about the mouse:
It emu a ps/2 mouse until you have tool it to be used as a USB; so of cause i havn not used the ps/2 port, due to the fact, that i dont have one working right now, but i will try it agin. ( Shuld bochs not make the usb to a ps/2 mouse, so i dont have to connect a ps/2 mouse, or im worng ?)
KMT dk
i have read the USB HID part about the mouse:
It emu a ps/2 mouse until you have tool it to be used as a USB; so of cause i havn not used the ps/2 port, due to the fact, that i dont have one working right now, but i will try it agin. ( Shuld bochs not make the usb to a ps/2 mouse, so i dont have to connect a ps/2 mouse, or im worng ?)
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
Re: Mouse programming
everything looks good until here:
You never set the data.
Code: Select all
mouse.set.data:
call keyboard.wait
mov al,0xd4
out 0x64,al
call keyboard.wait
ret
Re: Mouse programming
Bochs translates any mouse into a simulated PS2 mouse.