Keyboard Input Problem
Posted: Thu May 28, 2009 2:57 pm
Hi everybody!
I'm having a problem with my keyboard driver affecting how my PIT is functioning and causes it so that the timer only runs when there is text being written to the screen or input being taken from the keyboard, i have debugged and traced the problem to the following method:
I know its not commented at all but the above determines if a shift key is being pressed and sets the shift variable accordingly and also gets the raw scancode from the keyboard for the key being pressed with or without shift.
I know with some certainty that it is this method causing the problem, so you'll just have to trust me on that.
My current guess is that somehow, this runs on a loop and that it only breaks out of that loop when a key is pressed,
I'm pretty new to OS development and not that great with C at the moment so it may be a very basic error I have missed.
I need some advice on what exactly may be causing this problem and how it could be fixed, any help with fixing this is appreciated, thanks.
I'm having a problem with my keyboard driver affecting how my PIT is functioning and causes it so that the timer only runs when there is text being written to the screen or input being taken from the keyboard, i have debugged and traced the problem to the following method:
Code: Select all
unsigned char getrawkey()
{
int scancode;
while (1)
{
scancode = inportb(0x60);
if (scancode & KEYPRESS)
{
scancode &= 0x7F;
if (scancode == KRLEFT_SHIFT || scancode == KRRIGHT_SHIFT)
shift = 0;
continue;
}
if (scancode == KRLEFT_SHIFT || scancode == KRRIGHT_SHIFT)
{
shift = 1;
continue;
}
return scancode;
}
}
I know with some certainty that it is this method causing the problem, so you'll just have to trust me on that.
My current guess is that somehow, this runs on a loop and that it only breaks out of that loop when a key is pressed,
I'm pretty new to OS development and not that great with C at the moment so it may be a very basic error I have missed.
I need some advice on what exactly may be causing this problem and how it could be fixed, any help with fixing this is appreciated, thanks.