Code: Select all
for(;;)
{
outb(0x20, 0x20);
char c = inb(0x60);
if((!(c&80)))
d_printf("%x", c);
}
Code: Select all
for(;;)
{
outb(0x20, 0x20);
char c = inb(0x60);
if((!(c&80)))
d_printf("%x", c);
}
Yes, this was for debugging, as you could see, if i was to press a key, it should print out a long repeat of the hex scancode for the key, but for those fey keys it doesn't, and i have tried on 2 vms, and will soon try on another computer, is there any other method, similarly easy, to get input from the keyboard?Brendan wrote:Hi,
The keyboard gives you "scancodes", which are not ASCII.
You need to convert the scancodes into ASCII. This is typically done with a set of lookup tables - one normal lookup table, one for when a shift key is held down, one for when capslock is active, etc).
Cheers,
Brendan
Doh - sorry. I thought you meant it worked for printing in hex but not when printing as characters. The only thing I can think of that might cause the problem is a broken "d_printf()".tech2077 wrote:Yes, this was for debugging, as you could see, if i was to press a key, it should print out a long repeat of the hex scancode for the key, but for those fey keys it doesn't, and i have tried on 2 vms, and will soon try on another computer, is there any other method, similarly easy, to get input from the keyboard?
edit: it also doesn't work on the other computer i have tried it on.
Ok, i'll try dirrectly writting to vid memory without the bypass, and i never liked Quake , guess i'll just forget about easy , this is, as you can see, my first attempt into OS dev after a long will used to C api's and asm ontop of the kernel.Brendan wrote:Hi,
Doh - sorry. I thought you meant it worked for printing in hex but not when printing as characters. The only thing I can think of that might cause the problem is a broken "d_printf()".tech2077 wrote:Yes, this was for debugging, as you could see, if i was to press a key, it should print out a long repeat of the hex scancode for the key, but for those fey keys it doesn't, and i have tried on 2 vms, and will soon try on another computer, is there any other method, similarly easy, to get input from the keyboard?
edit: it also doesn't work on the other computer i have tried it on.
For "similarly easy" you could try playing Quake instead. If you want to do something that's actually useful, start by forgetting about "easy"...
Cheers,
Brendan
Code: Select all
if((!(c&80)))
Wow, thank you, i completely forgot to declare it as hex.gerryg400 wrote:The problem is that you're typoed 80 instead of 0x80. Because 80 is 0x50 you are ignoring any key with bit 4 set in its scan code. That includes all the keys that start with 0x1_ (q->],a,s) etc.Code: Select all
if((!(c&80)))
Try putting stuff in an if in only one pair of brackets:tech2077 wrote:Wow, thank you, i completely forgot to declare it as hex.gerryg400 wrote:The problem is that you're typoed 80 instead of 0x80. Because 80 is 0x50 you are ignoring any key with bit 4 set in its scan code. That includes all the keys that start with 0x1_ (q->],a,s) etc.Code: Select all
if((!(c&80)))
Code: Select all
if (!(c & 0x80))
Code: Select all
if ((!(c & 0x80)))