keyboard works

This commit is contained in:
Jack Halford 2019-08-13 23:28:24 +02:00
parent e832dede16
commit 97aa541b34
5 changed files with 13 additions and 7 deletions

View file

@ -11,12 +11,15 @@ start() {
-enable-kvm \
-m 1337M \
-curses \
-serial mon:stdio \
-append "Hello" \
-kernel ${KERNEL}
# -device virtio-net,netdev=network0 -netdev tap,id=network0,ifname=tap0,script=no,downscript=no \
# build/kernel.iso
"$@"
# this allows this switch to monitor with ^a-c, but doesn't
# play nice with irqs apparently...
# -serial mon:stdio \
}
monitor() {

View file

@ -48,9 +48,6 @@ pub fn setGate(n: u8, flags: u8, offset: extern fn () void) void {
idt[n].flags = flags;
idt[n].zero = 0;
idt[n].selector = gdt.KERNEL_CODE;
println("offset: 0x{x}", @ptrToInt(offset));
println("low : 0x{x}", idt[n].offset_low);
println("high : 0x{x}", idt[n].offset_high);
}
////

View file

@ -1,5 +1,5 @@
// Kernel stack for interrupt handling.
KERNEL_STACK = 0x80000
KERNEL_STACK = 0x800000
// GDT selectors.
KERNEL_DS = 0x10

View file

@ -22,6 +22,13 @@ pub fn keypress(char: u8) void {
vga.writeString("> ");
command_len = 0;
},
'\x08' => {
//backspace
return;
},
'\x00' => {
return;
},
else => {
if (command_len == 10)
return;

View file

@ -20,7 +20,7 @@ const KEYMAP_US = [_][2]u8{
"0)",
"-_",
"=+",
"\x00\x00", //backspace
"\x08\x08", //backspace
"\x00\x00", //tab
"qQ",
"wW",
@ -85,7 +85,6 @@ fn key_isrelease(scancode: u8) bool {
pub fn keyboard_handler() void {
const scancode = ps2_scancode();
const isrelease = key_isrelease(scancode);
println("keyboard scancode 0b{b}", scancode);
if (isrelease) {
return;
}