lesson 20 finished: timer + keyboard

pull/6/head
Carlos 9 years ago
parent 46094a0e96
commit 5aaabf189d

@ -34,3 +34,6 @@ created with the definitions.
`keyboard.c` also has a long table to translate scancodes to ASCII keys. For the time
being, we will only implement a simple subset of the US keyboard. You can read
more [about scancodes here](http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html)
I don't know about you, but I'm thrilled! We are very close to building a simple shell.
In the next chapter, we will expand a little bit on keyboard input

@ -9,7 +9,7 @@ static void timer_callback(registers_t regs) {
tick++;
kprint("Tick: ");
char *tick_ascii;
char tick_ascii[256];
int_to_ascii(tick, tick_ascii);
kprint(tick_ascii);
kprint("\n");

@ -197,11 +197,14 @@ void print_letter(u8 scancode) {
break;
default:
/* 'keuyp' event corresponds to the 'keydown' + 0x80
* it may still be a scancode we haven't implemented yet */
if (scancode - 0x80 <= 0x39) {
* it may still be a scancode we haven't implemented yet, or
* maybe a control/escape sequence */
if (scancode <= 0x7f) {
kprint("Unknown key down");
} else if (scancode <= 0x39 + 0x80) {
kprint("key up ");
print_letter(scancode - 0x80);
} else kprint("Unknown");
} else kprint("Unknown key up");
break;
}
}

@ -6,7 +6,7 @@ void main() {
isr_install();
asm volatile("sti");
// init_timer(50);
init_timer(50);
/* Comment out the timer IRQ handler to read
* the keyboard IRQs easier */
init_keyboard();

Loading…
Cancel
Save