Simple mouse Driver

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
JamesParsons
Posts: 17
Joined: Sat Jan 12, 2013 7:37 am

Simple mouse Driver

Post 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-[
REAL programmers aren't afraid to use goto's
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: Simple mouse Driver

Post 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)
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: Simple mouse Driver

Post 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.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
JamesParsons
Posts: 17
Joined: Sat Jan 12, 2013 7:37 am

Re: Simple mouse Driver

Post 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 :(
REAL programmers aren't afraid to use goto's
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Simple mouse Driver

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
JamesParsons
Posts: 17
Joined: Sat Jan 12, 2013 7:37 am

Re: Simple mouse Driver

Post by JamesParsons »

what header file are the outportb, inportb, and irq_install_handler in.
REAL programmers aren't afraid to use goto's
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Simple mouse Driver

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Simple mouse Driver

Post 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).
JamesParsons
Posts: 17
Joined: Sat Jan 12, 2013 7:37 am

Re: Simple mouse Driver

Post by JamesParsons »

OK I can do that with inline assembly :)
REAL programmers aren't afraid to use goto's
Post Reply