YAHOO!! Keyboard driver is working! lol
Posted: Mon Sep 23, 2002 9:36 pm
;D ;D ;D
hey! well, i finally got it working and i wish to thank dronkit and if any moderators read this, give him props or something lol, but yes, it works now.
my problem:
every keyboard driver i had crashed my computer (reboots) but now, after testing and talking and testing, it works great now, at least its a loop which tells me when a key is pressed and released... yahoo! heh, its in differnt colors too! oh yes
solution for people who need help:
everyone keyboard thing tried to enable the interrupts, sti, but i tried it, removed it, changed some of the worlds features, and now it works:
static void KeyboardInterruptHandler()
{
int scanCode; /* Storage for scan code */
register int i; /* Register is desirable */
//enable(); /* Enable CPU interrupts immediately */
/* Substitute 'asm sti;' for enable() if this does not compile */
scanCode = inp(0x60); /* Read the key board scan code */
/* Acknowledge the reading of the scan code to the keyboard controller */
i = inp(0x61); /* Get keyboard control register */
outp(0x61, i | 0x80); /* Toggle acknowledge bit high */
outp(0x61, i); /* Toggle acknowledge bit low */
/* Acknowledge the interrupt to the programmable interrupt controller */
outp(0x20, 0x20); /* Signal non specific end of interrupt */
/* Set the appropriate flags in the state tables */
if (scanCode & 0x80)
{
keyIsPressed[scanCode & 0x7F] = 0;
prints("pressed!", WHITE, 4 );
}
else
{
keyIsPressed[scanCode] = keyWasPressed[scanCode] = 1;
prints("RELEASED!", BLUE, 4 );
}
}
--with these functions for the outp inp:
#define outp(value,port) \
__asm__ ("outb %%al,%%dx"::"a" (value),"d" (port))
#define inp(port) ({ \
unsigned char _v; \
__asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \
_v; \
})
I hope this helps someone else out there! Thank you all on this board, you rock! ;D ;D ;D and special thanks to dronkit!
peace, Alan
hey! well, i finally got it working and i wish to thank dronkit and if any moderators read this, give him props or something lol, but yes, it works now.
my problem:
every keyboard driver i had crashed my computer (reboots) but now, after testing and talking and testing, it works great now, at least its a loop which tells me when a key is pressed and released... yahoo! heh, its in differnt colors too! oh yes
solution for people who need help:
everyone keyboard thing tried to enable the interrupts, sti, but i tried it, removed it, changed some of the worlds features, and now it works:
static void KeyboardInterruptHandler()
{
int scanCode; /* Storage for scan code */
register int i; /* Register is desirable */
//enable(); /* Enable CPU interrupts immediately */
/* Substitute 'asm sti;' for enable() if this does not compile */
scanCode = inp(0x60); /* Read the key board scan code */
/* Acknowledge the reading of the scan code to the keyboard controller */
i = inp(0x61); /* Get keyboard control register */
outp(0x61, i | 0x80); /* Toggle acknowledge bit high */
outp(0x61, i); /* Toggle acknowledge bit low */
/* Acknowledge the interrupt to the programmable interrupt controller */
outp(0x20, 0x20); /* Signal non specific end of interrupt */
/* Set the appropriate flags in the state tables */
if (scanCode & 0x80)
{
keyIsPressed[scanCode & 0x7F] = 0;
prints("pressed!", WHITE, 4 );
}
else
{
keyIsPressed[scanCode] = keyWasPressed[scanCode] = 1;
prints("RELEASED!", BLUE, 4 );
}
}
--with these functions for the outp inp:
#define outp(value,port) \
__asm__ ("outb %%al,%%dx"::"a" (value),"d" (port))
#define inp(port) ({ \
unsigned char _v; \
__asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \
_v; \
})
I hope this helps someone else out there! Thank you all on this board, you rock! ;D ;D ;D and special thanks to dronkit!
peace, Alan