Ran cargo fmt, clippy fixes, suppressed some warns
I will start working on stack traces tonight and tomorrow. We need to be able to 'unwind' by finding calling functions.
This commit is contained in:
@@ -2,14 +2,17 @@ use core::fmt;
|
||||
use spin::{Lazy, Mutex};
|
||||
use x86_64::instructions::interrupts;
|
||||
|
||||
use crate::arch::x86_64::drivers::framebuffer::{colour::Colour, display::FRAMEBUFFER_WRITER};
|
||||
use crate::arch::x86_64::drivers::framebuffer::{
|
||||
colour::Colour, display::FRAMEBUFFER_WRITER,
|
||||
};
|
||||
|
||||
use crate::resources::font::{FONT_SPLEEN_8X16, Font};
|
||||
|
||||
static FONT_WIDTH: u32 = 8;
|
||||
static FONT_HEIGHT: u32 = 16;
|
||||
|
||||
pub static WRITER: Lazy<Mutex<Writer>> = Lazy::new(|| Mutex::new(Writer::new()));
|
||||
pub static WRITER: Lazy<Mutex<Writer>> =
|
||||
Lazy::new(|| Mutex::new(Writer::new()));
|
||||
|
||||
pub fn screensize_chars() -> (u32, u32) {
|
||||
let writer = WRITER.lock();
|
||||
@@ -71,21 +74,31 @@ impl Writer {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the character data from the font array. -- each byte is a row of pixels
|
||||
// Get the character data from the font array. -- each byte is a row of
|
||||
// pixels
|
||||
let data: &[u8] = self.font.glyph_for(c as u16);
|
||||
|
||||
if let Some(writer) = FRAMEBUFFER_WRITER.lock().as_mut() {
|
||||
for (row, line) in data.iter().enumerate().take(16) {
|
||||
for col in 0..8 {
|
||||
let pixel_x: u32 = self.text_col * FONT_WIDTH + col;
|
||||
let pixel_y: u32 = self.text_line * FONT_HEIGHT + row as u32;
|
||||
let pixel_y: u32 =
|
||||
self.text_line * FONT_HEIGHT + row as u32;
|
||||
|
||||
if line & (0x80 >> col) != 0 {
|
||||
// Write the foreground color
|
||||
writer.write_pixel(pixel_x as usize, pixel_y as usize, self.fg_color);
|
||||
writer.write_pixel(
|
||||
pixel_x as usize,
|
||||
pixel_y as usize,
|
||||
self.fg_color,
|
||||
);
|
||||
} else {
|
||||
// Write the background color
|
||||
writer.write_pixel(pixel_x as usize, pixel_y as usize, self.bg_color);
|
||||
writer.write_pixel(
|
||||
pixel_x as usize,
|
||||
pixel_y as usize,
|
||||
self.bg_color,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,8 +130,8 @@ impl Writer {
|
||||
}
|
||||
}
|
||||
|
||||
/// Handles the backspace character. TODO: Implement VT-100 style terminal control
|
||||
/// codes alongside a shell. Not simple.
|
||||
/// Handles the backspace character. TODO: Implement VT-100 style terminal
|
||||
/// control codes alongside a shell. Not simple.
|
||||
pub fn backspace(&mut self) {
|
||||
if self.text_col > 0 {
|
||||
self.text_col -= 1;
|
||||
|
||||
Reference in New Issue
Block a user