From 15b0890ad3a7e9e80e6f963caf9cc132db098765 Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Fri, 9 Feb 2018 17:07:47 +0100 Subject: [PATCH] stuff --- kernel-rs/src/lib.rs | 23 +++++++++++++++++++++-- kernel-rs/src/vga_buffer.rs | 6 ------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/kernel-rs/src/lib.rs b/kernel-rs/src/lib.rs index 168d3651..d82ba782 100644 --- a/kernel-rs/src/lib.rs +++ b/kernel-rs/src/lib.rs @@ -1,6 +1,7 @@ #![feature(lang_items)] #![feature(const_fn)] #![feature(ptr_internals)] +#![feature(asm)] #![no_std] extern crate spin; @@ -10,6 +11,10 @@ extern crate rlibc; #[macro_use] mod vga_buffer; +#[allow(dead_code)] +mod cpuio; +mod keyboard; + #[no_mangle] pub extern fn kmain() -> ! { use vga_buffer::WRITER; @@ -27,13 +32,27 @@ pub extern fn kmain() -> ! { WRITER.lock().color_code = ColorCode::new(Color::Red, Color::Green); println!(">> Kernel startup..."); + print!("\n"); println!(">> Kernel startup..."); + print!("\n"); println!(">> Kernel startup..."); + print!("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); - WRITER.lock().color_code = ColorCode::new(Color::White, Color::Black); + // WRITER.lock().color_code = ColorCode::new(Color::White, Color::Black); loop { - + 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); + // unsafe { cpuio::outb(28, 0x64) }; + }, + None =>{}, + // None => println!("nokey ctrl {:x}", control), + } + } } } diff --git a/kernel-rs/src/vga_buffer.rs b/kernel-rs/src/vga_buffer.rs index 6b65d081..5217ea6b 100644 --- a/kernel-rs/src/vga_buffer.rs +++ b/kernel-rs/src/vga_buffer.rs @@ -27,12 +27,6 @@ pub struct Writer { vgabuffer: Unique, } -struct VScreen { - column_position: usize, - pub color_code: ColorCode, - buffer: Buffer, -} - macro_rules! println { ($fmt:expr) => (print!(concat!($fmt, "\n"))); ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*));