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 \ -enable-kvm \
-m 1337M \ -m 1337M \
-curses \ -curses \
-serial mon:stdio \
-append "Hello" \ -append "Hello" \
-kernel ${KERNEL} -kernel ${KERNEL}
# -device virtio-net,netdev=network0 -netdev tap,id=network0,ifname=tap0,script=no,downscript=no \ # -device virtio-net,netdev=network0 -netdev tap,id=network0,ifname=tap0,script=no,downscript=no \
# build/kernel.iso # build/kernel.iso
"$@" "$@"
# this allows this switch to monitor with ^a-c, but doesn't
# play nice with irqs apparently...
# -serial mon:stdio \
} }
monitor() { 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].flags = flags;
idt[n].zero = 0; idt[n].zero = 0;
idt[n].selector = gdt.KERNEL_CODE; 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 for interrupt handling.
KERNEL_STACK = 0x80000 KERNEL_STACK = 0x800000
// GDT selectors. // GDT selectors.
KERNEL_DS = 0x10 KERNEL_DS = 0x10

View file

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

View file

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