Keyboard input.
Posted: Sat Feb 13, 2016 12:39 pm
Hello, I have searched everywhere but have not found a single good implementation of a keyboard input driver.
I don't care about keyboard leds, control keys.
I have everthing setup, irq, io, I just need help.
Thanks in advance.
I don't care about keyboard leds, control keys.
I have everthing setup, irq, io, I just need help.
Code: Select all
/* KBDUS means US Keyboard Layout. This is a scancode table
* used to layout a standard US keyboard. I have left some
* comments in to give you an idea of what key is what, even
* though I set it's array index to 0. You can change that to
* whatever you want using a macro, if you wish! */
#include "common.h"
#include "isr.h"
#include <stdbool.h>
#include "kb.h"
unsigned char kbdus[] =
{
0, 27, '1', '2', '3', '4', '5', '6', '7', '8', /* 9 */
'9', '0', '-', '=', '\b', /* Backspace */
'\t', /* Tab */
'q', 'w', 'e', 'r', /* 19 */
't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', /* Enter key */
0, /* 29 - Control */
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* 39 */
'\'', '`', 0, /* Left shift */
'\\', 'z', 'x', 'c', 'v', 'b', 'n', /* 49 */
'm', ',', '.', '/', 0, /* Right shift */
..............................
};
char c;
char* buff;
void keyboard_handler()
{
asm volatile("cli");
u8int in = inb(0x60);
c = kbdus[in];
asm volatile("sti");
}
char* getbuff() {
}
void keyboard_init()
{
register_interrupt_handler(IRQ1,keyboard_handler);
}