This commit is contained in:
Jack Halford 2018-02-09 17:07:47 +01:00
parent 56c937e620
commit 15b0890ad3
2 changed files with 21 additions and 8 deletions

View file

@ -1,6 +1,7 @@
#![feature(lang_items)] #![feature(lang_items)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(ptr_internals)] #![feature(ptr_internals)]
#![feature(asm)]
#![no_std] #![no_std]
extern crate spin; extern crate spin;
@ -10,6 +11,10 @@ extern crate rlibc;
#[macro_use] #[macro_use]
mod vga_buffer; mod vga_buffer;
#[allow(dead_code)]
mod cpuio;
mod keyboard;
#[no_mangle] #[no_mangle]
pub extern fn kmain() -> ! { pub extern fn kmain() -> ! {
use vga_buffer::WRITER; use vga_buffer::WRITER;
@ -27,13 +32,27 @@ pub extern fn kmain() -> ! {
WRITER.lock().color_code = ColorCode::new(Color::Red, Color::Green); WRITER.lock().color_code = ColorCode::new(Color::Red, Color::Green);
println!(">> Kernel startup..."); println!(">> Kernel startup...");
print!("\n");
println!(">> Kernel startup..."); println!(">> Kernel startup...");
print!("\n");
println!(">> Kernel startup..."); 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 { 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),
}
}
} }
} }

View file

@ -27,12 +27,6 @@ pub struct Writer {
vgabuffer: Unique<Buffer>, vgabuffer: Unique<Buffer>,
} }
struct VScreen {
column_position: usize,
pub color_code: ColorCode,
buffer: Buffer,
}
macro_rules! println { macro_rules! println {
($fmt:expr) => (print!(concat!($fmt, "\n"))); ($fmt:expr) => (print!(concat!($fmt, "\n")));
($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*));