print[ln] macros in place
This commit is contained in:
parent
2503fdb96d
commit
3f2068de99
3 changed files with 31 additions and 32 deletions
|
|
@ -19,6 +19,7 @@ pub fn kbd_callback() {
|
||||||
}
|
}
|
||||||
Some(ascii) => {
|
Some(ascii) => {
|
||||||
CONTEXT.current_term().keypress(*ascii);
|
CONTEXT.current_term().keypress(*ascii);
|
||||||
|
CONTEXT.current_term().flush();
|
||||||
},
|
},
|
||||||
None =>{},
|
None =>{},
|
||||||
// None => println!("nokey ctrl {:x}", control),
|
// None => println!("nokey ctrl {:x}", control),
|
||||||
|
|
|
||||||
|
|
@ -22,24 +22,21 @@ pub extern fn kmain() -> ! {
|
||||||
// use vga::color::Color;
|
// use vga::color::Color;
|
||||||
// use vga::color::ColorCode;
|
// use vga::color::ColorCode;
|
||||||
|
|
||||||
// WRITER.lock().reset_screen();
|
println!(r#" ,--, "#);
|
||||||
// WRITER.lock().color_code = ColorCode::new(Color::Yellow, Color::Black);
|
println!(r#" ,--.'| ,----, "#);
|
||||||
// println!(r#" ,--, "#);
|
println!(r#" ,--, | : .' .' \ "#);
|
||||||
// println!(r#" ,--.'| ,----, "#);
|
println!(r#",---.'| : ' ,----,' | "#);
|
||||||
// println!(r#" ,--, | : .' .' \ "#);
|
println!(r#"; : | | ; | : . ; "#);
|
||||||
// println!(r#",---.'| : ' ,----,' | "#);
|
println!(r#"| | : _' | ; |.' / "#);
|
||||||
// println!(r#"; : | | ; | : . ; "#);
|
println!(r#": : |.' | `----'/ ; "#);
|
||||||
// println!(r#"| | : _' | ; |.' / "#);
|
println!(r#"| ' ' ; : / ; / "#);
|
||||||
// println!(r#": : |.' | `----'/ ; "#);
|
println!(r#"\ \ .'. | ; / /-, "#);
|
||||||
// println!(r#"| ' ' ; : / ; / "#);
|
println!(r#" `---`: | ' / / /.`| "#);
|
||||||
// println!(r#"\ \ .'. | ; / /-, "#);
|
println!(r#" ' ; |./__; : "#);
|
||||||
// println!(r#" `---`: | ' / / /.`| "#);
|
println!(r#" | : ;| : .' "#);
|
||||||
// println!(r#" ' ; |./__; : "#);
|
println!(r#" ' ,/ ; | .' "#);
|
||||||
// println!(r#" | : ;| : .' "#);
|
println!(r#" '--' `---' "#);
|
||||||
// println!(r#" ' ,/ ; | .' "#);
|
println!(">> Kernel startup...");
|
||||||
// println!(r#" '--' `---' "#);
|
|
||||||
// WRITER.lock().color_code = ColorCode::new(Color::White, Color::Black);
|
|
||||||
// println!(">> Kernel startup...");
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
keyboard::kbd_callback();
|
keyboard::kbd_callback();
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use super::{Color, ColorCode};
|
use super::{Color, ColorCode};
|
||||||
|
use ::context::CONTEXT;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -16,21 +17,21 @@ struct ScreenChar {
|
||||||
color_code: ColorCode,
|
color_code: ColorCode,
|
||||||
}
|
}
|
||||||
|
|
||||||
// macro_rules! print {
|
macro_rules! print {
|
||||||
// ($($arg:tt)*) => ({
|
($($arg:tt)*) => ({
|
||||||
// $crate::vga_buffer::print(format_args!($($arg)*));
|
$crate::vga::buffer::print(format_args!($($arg)*));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// 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)*));
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn print(args: fmt::Arguments) {
|
pub fn print(args: fmt::Arguments) {
|
||||||
// use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
// context.current_screen().write_fmt(args).unwrap();
|
unsafe { CONTEXT.current_term().write_fmt(args).unwrap() };
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
extern crate core;
|
extern crate core;
|
||||||
|
|
@ -87,7 +88,6 @@ impl Writer {
|
||||||
self.buffer[self.position] = b' ';
|
self.buffer[self.position] = b' ';
|
||||||
self.buffer[self.position + 1] = ColorCode::new(Color::LightGray, Color::LightGray).0;
|
self.buffer[self.position + 1] = ColorCode::new(Color::LightGray, Color::LightGray).0;
|
||||||
|
|
||||||
self.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn flush(&mut self) {
|
pub fn flush(&mut self) {
|
||||||
|
|
@ -119,6 +119,7 @@ impl fmt::Write for Writer {
|
||||||
for byte in s.bytes() {
|
for byte in s.bytes() {
|
||||||
self.write_byte(byte)
|
self.write_byte(byte)
|
||||||
}
|
}
|
||||||
|
self.flush();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue