jnc100 wrote:Your problem (as alluded to by others) is that you ignore the e0 scancode. The line 'if (scancode & 0x80) { }' will ignore the e0 code as 0xe0 & 0x80 evaluates to true, thus the only code of a two byte scancode you read will be the second byte.
Regards,
John.
I don't think so, it just checks if the key was released(right?).
By the way, I cut that part of code just to test if it works and put it in the main function:
Code: Select all
int fail_safe=200000;
while ((inportb(0x64)&2)!=0 && fail_safe>0) fail_safe--;
outportb (0x60, 0xf0);
fail_safe=200000;
while ((inportb(0x64)&2)!=0 && fail_safe>0) fail_safe--;
outportb (0x60, 2);
It doesn't work, I still get the same scancodes.
SparrowOS wrote:Code: Select all
U8 GetChar()
{
U8 b=InPort(0x60);
if (b==0xE0)
return 0x80+(InPort(0x60)&0x7F);
else
return b&0x7F;
}
then some keys(e.g. insert, home, page up, delete, end, page down, arrays) aren't recognised.
_______________________________________
IGNORE EVERYTHING TEMPORARY
. I've got another problem, I think I should fix it first. So, here is an example:
if I put this function in keyboard.c file:
Code: Select all
uint8 GetChar()
{
uint8 b=inportb(0x60);
if (b==0xE0)
return 0x80+(inportb(0x60)&0x7F);
else
return b&0x7F;
}
then I get error from GRUB, it says "Invalid or unsupported executable format". Compiler doesn't show anything bad.
if I put this function in
main file - I don't get error. Why(it's not because of only that function)
?