Page 1 of 1

Keyboard support

Posted: Sat Dec 27, 2008 4:05 am
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

Re: Keyboard support

Posted: Sat Dec 27, 2008 4:21 am
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.

Re: Keyboard support

Posted: Sat Dec 27, 2008 12:30 pm
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:

Re: Keyboard support

Posted: Sat Dec 27, 2008 2:07 pm
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: