This commit is contained in:
Jack Halford 2018-02-13 09:38:25 +01:00
parent 37d51d2afe
commit 864d2dca4e
2 changed files with 40 additions and 56 deletions

View file

@ -82,11 +82,10 @@ pub fn kbd_callback() {
static mut CTRL: bool = false;
static mut ALT: bool = false;
// let terminal_two: vga::terminal::Terminal = vga::Screen::new();
let control = unsafe { cpuio::inb(0x64) };
let control = cpuio::inb(0x64);
if (control & 1) == 1 {
let scancode = unsafe { cpuio::inb(0x60) };
let scancode = cpuio::inb(0x60);
let (is_release, scancode) = check_key_state(scancode);
//TODO implement logic to translate scancode->ascii
unsafe {//TODO remove unsafe
match self::KEYMAP_US.get(scancode as usize) {
Some(b"\0\0") => {
@ -121,9 +120,7 @@ pub fn kbd_callback() {
},
Some(_) => {},
None =>{},
// None => println!("nokey ctrl {:x}", control),
}
}
// current_screen.flush();
}
}

View file

@ -55,10 +55,6 @@ fn shutdown() -> ! {
}
#[no_mangle]
pub extern fn kmain() -> ! {
// use vga::VgaScreen;
// use vga::color::Color;
// use vga::color::ColorCode;
println!(r#" ,--, "#);
println!(r#" ,--.'| ,----, "#);
println!(r#" ,--, | : .' .' \ "#);
@ -78,15 +74,6 @@ pub extern fn kmain() -> ! {
loop {
keyboard::kbd_callback();
}
// let control = unsafe { cpuio::inb(0x64) };
// if (control & 1) == 1 {
// let keycode = unsafe { cpuio::inb(0x60) };
// match keyboard::KEY_CODE_TO_ASCII.get(keycode as usize) {
// Some(ascii) => print!("{}", *ascii as char),
// None =>{},
// // None => println!("nokey ctrl {:x}", control),
// }
// }
}
#[lang = "eh_personality"] #[no_mangle]
@ -96,12 +83,12 @@ pub extern fn eh_personality() {
#[lang = "panic_fmt"] #[no_mangle]
pub extern fn panic_fmt(
// fmt: core::fmt::Arguments, file: &'static str, line: u32
fmt: core::fmt::Arguments, file: &'static str, line: u32
)
-> ! {
// println!("PANIC: {}", fmt);
// println!("FILE: {}", file);
// println!("LINE: {}", line);
println!("PANIC: {}", fmt);
println!("FILE: {}", file);
println!("LINE: {}", line);
loop {}
}