Page 1 of 1

8259

Posted: Fri Sep 01, 2006 2:31 pm
by prbhell
first... I am form Brasil ... i have a bad english
I have some problems ...
I am starting in OS development and i would like to know how can i get the mouse position x and y but not with the "polling" way .... i would like to know how to program the PIC 8259
to ... when i move the mouse .... the computer call an interruption and jump to my routine ....

Re:8259

Posted: Fri Sep 01, 2006 7:24 pm
by João Jerónimo
prbhell wrote: first... I am form Brasil ... i have a bad english
Mas eu vou falar Ingl?s! bahahaahha
prbhell wrote: I have some problems ...
I am starting in OS development and i would like to know how can i get the mouse position x and y but not with the "polling" way .... i would like to know how to program the PIC 8259 to ... when i move the mouse .... the computer call an interruption and jump to my routine ....
I've never programmed a mouse... but it's either:
- for PS/2, catch mouse info in ISR for IRQ 12... I think it's read from the PS/2 keyboard/mouse registers...
- for serial mouses, you have to implement the mouse driver as a serial port ISR (IRQ3/4)... read http://www.cs.york.ac.uk/rtslab/demos/readme/docs/pdf/mouse_hardware.pdf for protocol info...
- and if it's USB, first you need to support USB (obvious!) (parhaps you have to support PCI devices even before...) and then HID, and then... I don't know! (i.e. if it's USB just forget it for now!)

If all you want is to reprogramme the PIC, check http://www.nondot.org/sabre/os/articles/MiscellaneousDevices

JJ

Re:8259

Posted: Sat Sep 02, 2006 3:19 am
by Pype.Clicker
the FAQ has interesting stuff too, among other things, a pointer to SANiK's public domain driver ...
how can i get the mouse position x and y but not with the "polling" way
maybe you should be more precise on what you call "polling way". The mouse typically report moves, not positions. You need to keep track of these movements e.g. (+5, -2) and update the current position accordingly. Everytime you "touch" the mouse, it sends a packet to the PC including button state, and movement vector.
and if it's USB, first you need to support USB
hopefully not. Most motherboards do a nice job in detecting USB mice/keyboard and emulate the PS/2 mouse/keyboard interaction for you. So you can just run it as a PS/2 mouse and voil?.
i would like to know how to program the PIC 8259 too
that's a fairly different issue, but the FAQ has good info here too. Just make sure you know that most of the "alternate configurations" of the PIC are just not possible with a PC (such as using IRQ7 as cascade channel rather than IRQ2, for instance).

Re:8259

Posted: Sat Sep 02, 2006 7:55 am
by João Jerónimo
the FAQ has interesting stuff too, among other things, a pointer to SANiK's public domain driver ...
Hadn't noticed...
how can i get the mouse position x and y but not with the "polling" way
maybe you should be more precise on what you call "polling way". The mouse typically report moves, not positions. You need to keep track of these movements e.g. (+5, -2) and update the current position accordingly. Everytime you "touch" the mouse, it sends a packet to the PC including button state, and movement vector.
Erm... ok!
So, the mouse itself can only detect small movements...
and if it's USB, first you need to support USB
hopefully not. Most motherboards do a nice job in detecting USB mice/keyboard and emulate the PS/2 mouse/keyboard interaction for you. So you can just run it as a PS/2 mouse and voil?.
I didn't know... partly bacause i have no background in programming mouses...
Is there any advantage in directly controling a USB mouse when running on that type of motherboards...

I think USB mouses are stupid... Who needs a high speed general purpose port to use a mouse???

<edit:pype> this is discussed in another thread</edit>
(such as using IRQ7 as cascade channel rather than IRQ2, for instance).
When I wrote my PIC code, I asked that question to myself...
I would have to rewire the PIC chip in order to do that, right?
And with a modern computer it would be impossible to do so, cause the PIC is in the chipset!

JJ