I'm trying to write a keyboard handler but, I can't get it working. When i press a key nothing happens
I use this code..
Code: Select all
From my keyboard.c file
--------------------------------
extern void keyb_ISR();
asm (
".globl _keyb_ISR \n"
"_keyb_ISR: \n"
" pusha \n" /* Save all registers */
" pushw %ds \n" /* Set up the data segment */
" pushw %es \n"
" pushw %ss \n" /* Note that ss is always valid */
" pushw %ss \n"
" popw %ds \n"
" popw %es \n"
" \n"
" call _keyboard_ISR \n"
" \n"
" popw %es \n"
" popw %ds \n" /* Restore registers */
" popa \n"
" iret \n" /* Exit interrupt */
);
void keyboard_ISR(void)
{
kprintf("Key Pressed!",0,0,BLUE_TXT);
}
void enable_kisr()
{
unsigned scancode;
scancode = inportb(0x60);
AddInt(0x21, keyb_ISR, 0);
outportb(0x21, (inportb(0x21) & 0xFD)); // Enable IRQ 1
}
???