Page 1 of 1

Simple mouse Driver

Posted: Sat Jan 12, 2013 8:37 am
by JamesParsons
this kind of goes along with my GUI question but I need mouse support. All I want is a simple driver that can draw a small square at MouseX and MouseY. The only click I want to handle is a left button down. does anyone have a good tutorial or some simple code much prefer it in C/C++ 8-[

Re: Simple mouse Driver

Posted: Sat Jan 12, 2013 10:57 am
by Griwes
The is no such thing like "C/C++", which is just an undefined behavior in both C and C++.

If you want spoonfeeding (and you clearly want, since you're using phrases like "I want" in meaning "do it for me"). Pick up another hobby, maybe jogging* or something. There are tutorials, but you are supposed to find them by yourself (the most important programming skill of all: Googling and using "Search" buttons).



(* yes, I know, a repeated joke ceases to be funny, but the previous usage of it has been deleted :F)

Re: Simple mouse Driver

Posted: Sat Jan 12, 2013 1:45 pm
by bubach
* You need to write your own code to make an operating system.
* Making other people do the work doesn't make it your OS.
* Understanding how to find information and translating it to your own code is vital for OS-dev.

Re: Simple mouse Driver

Posted: Sat Jan 12, 2013 7:08 pm
by JamesParsons
the problem with google is that things get so generic. I tried looking it up, but I got stuff for like windows and Linux with pre-made Libraries for you to use. I don't want to write driver for an existing OS. I want to write it for my OS. when I try to get more specific I get nothing useful :(

Re: Simple mouse Driver

Posted: Sun Jan 13, 2013 12:37 am
by Brendan
Hi,
JamesParsons wrote:the problem with google is that things get so generic. I tried looking it up, but I got stuff for like windows and Linux with pre-made Libraries for you to use. I don't want to write driver for an existing OS. I want to write it for my OS. when I try to get more specific I get nothing useful :(
Start at the main page for the OSdev wiki. Then type in "mouse" into the wiki's search box, and click the first result (a page about mouse input).


Cheers,

Brendan

Re: Simple mouse Driver

Posted: Sun Jan 13, 2013 8:27 am
by JamesParsons
what header file are the outportb, inportb, and irq_install_handler in.

Re: Simple mouse Driver

Posted: Sun Jan 13, 2013 8:35 am
by Brendan
Hi,
JamesParsons wrote:what header file are the outportb, inportb, and irq_install_handler in.
They're in whichever header file you felt like putting them in.


Cheers,

Brendan

Re: Simple mouse Driver

Posted: Sun Jan 13, 2013 8:57 am
by sortie
Remember that this is kernel land. It's a wonderful magical new world where you can construct a whole reality - but it is a void when you start construction. There is nothing there except that you build yourself. So when you ask "where is foo?" you are already making a mistake; you have to build foo yourself and then you have the answer to your question.

When tutorial code use function with a given name, the author didn't expect you to have a function that works exactly like that, but the name is a hint to what kind of function. In this case, the author expects you to have support for reading and writing IO ports and have an interrupt handler (IRQs).

Re: Simple mouse Driver

Posted: Sun Jan 13, 2013 8:59 am
by JamesParsons
OK I can do that with inline assembly :)