Keyboard support

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
tariban
Posts: 3
Joined: Sat Dec 27, 2008 3:55 am
Location: New Zealand

Keyboard support

Post by tariban »

Well i stumbled across this site yesterday and went straight to the Basic Bones tutorial. I modified it a bit (made a printf function and a function to clear the screen), and the next thing i want to do is add keyboard support. I looked through the section on Keyboard Controllers and attempted to hack together a keyboard controller to no avail. This is mainly because im not to great at asm. So i was wondering if anyone could explan to me how to modify the loader from the basic bones tutorial to make it call a function in my C source file ( keyboardHandler() ) when a key is pressed.

Cheers. :D
dosfan
Member
Member
Posts: 65
Joined: Tue Oct 14, 2008 1:18 pm
Location: Scotland

Re: Keyboard support

Post by dosfan »

I just had a quick look over the bare bones tutorial on the wiki and see nothing in it regarding the IDT (interrupt descriptor table).

I'll keep this short. The keyboard controller raises an interrupt when you press a key. You need to tell the CPU what to call when the keyboard interrupt occurs. (you could do it via polling but that's just nuts :) )

I recommend reading tutorials on GDT,IDT and the PIC.

Hope that helps..

EDIT: Oh and welcome to the forum! Good luck.
All your base are belong to us.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Keyboard support

Post by Troy Martin »

dosfan wrote:(you could do it via polling but that's just nuts :) )
Agreed. I tried doing a keyboard driver in asm via polling but it failed miserably. As well as taking 100% CPU! :evil:
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
dosfan
Member
Member
Posts: 65
Joined: Tue Oct 14, 2008 1:18 pm
Location: Scotland

Re: Keyboard support

Post by dosfan »

My old kernel used to drop to a built in kernel debugger when it panic'ed. I used to poll the keyboard because it ran with interrupts disabled (for obvious reasons) :lol:
All your base are belong to us.
Post Reply