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 `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 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) 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++; tick++;
kprint("Tick: "); kprint("Tick: ");
char *tick_ascii; char tick_ascii[256];
int_to_ascii(tick, tick_ascii); int_to_ascii(tick, tick_ascii);
kprint(tick_ascii); kprint(tick_ascii);
kprint("\n"); kprint("\n");

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

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

Loading…
Cancel
Save