diff --git a/Cargo.lock b/Cargo.lock index 86bd5083..1f5e1fab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -987,8 +987,7 @@ dependencies = [ [[package]] name = "vga" version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cbcb7bfff998d176ffb8f2c3dfd6cb0fe62740e36dee6c64fc3928c01001bf" +source = "git+https://git.ablecorp.us/able/vga.git#9e72fa603927983e359c8a7c56cb110a81eb161e" dependencies = [ "bitflags", "conquer-once", diff --git a/ableos/Cargo.toml b/ableos/Cargo.toml index 91c57bcd..f458a930 100644 --- a/ableos/Cargo.toml +++ b/ableos/Cargo.toml @@ -145,5 +145,5 @@ uart_16550 = "0.2.0" volatile = "0.2.6" x86_64 = "0.14.8" pc-beeper = { git = "https://github.com/AbleOS/pc-beeper" } -vga = "0.2.7" acpi = "4.1.0" +vga = { git = "https://git.ablecorp.us:443/able/vga.git" } diff --git a/ableos/assets/balloon.txt b/ableos/assets/balloon.txt new file mode 100644 index 00000000..cc015bc4 --- /dev/null +++ b/ableos/assets/balloon.txt @@ -0,0 +1,11 @@ + ,-""""-. OS: AbleOS + ,'\ _ _`. Host: ??? + / \)_)-)_)-\ Kernel: AKern-{}-v{} +: : Uptime: {} +\ / Packages: None + \ / Shell: RhaiShell + `. ,' Resolution: 640x480 + `. ,' Terminal: VGABuffer + `.,' CPU: {} + /\`. ,-._ GPU: VGA Compatible + `-' Memory: {}/{} \ No newline at end of file diff --git a/ableos/src/scratchpad.rs b/ableos/src/scratchpad.rs index fd650240..7180b463 100644 --- a/ableos/src/scratchpad.rs +++ b/ableos/src/scratchpad.rs @@ -1,4 +1,7 @@ +use crate::arch::drivers::sysinfo::master; use crate::arch::interrupts::{reset_pit_for_cpu, set_pit_2}; +use crate::systeminfo::{KERNEL_VERSION, RELEASE_TYPE}; +use crate::time::fetch_time; use crate::{ arch::shutdown, filesystem::FILE_SYSTEM, rhai_shell::KEYBUFF, vterm::Term, wasm_jumploader::run_program, @@ -9,7 +12,9 @@ use cpuio::{inb, outb}; use ext2::fs::sync::{DirectoryEntry, Synced}; use ext2::{fs::Ext2, sector::Size1024}; use genfs::{Fs, OpenOptions}; +use kernel::allocator::ALLOCATOR; use spin::Lazy; +use x86_64::instructions::interrupts::{disable, enable}; // TODO: move to a better place #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -53,6 +58,30 @@ impl Path { /// Experimental scratchpad for testing. pub fn scratchpad() { // bruh(); + // panic!(":>"); + + disable(); + let tick_time = fetch_time(); + + let allocator = ALLOCATOR.lock(); + let size = allocator.size(); + let used = allocator.used(); + drop(allocator); + enable(); + + println!( + include_str!("../assets/balloon.txt"), + // kstate.hostname, + RELEASE_TYPE, + KERNEL_VERSION, + tick_time, + master().unwrap().brand_string().unwrap(), + // "", + // mem + used, + size + ); + real_shell(); } @@ -212,7 +241,10 @@ pub fn sound_off() { reset_pit_for_cpu(); } -pub fn list_files_in_dir(fs: &Synced>>, _path: &[u8]) -> Vec { +pub fn list_files_in_dir( + fs: &Synced>>, + _path: &[u8], +) -> Vec { let mut entry_list = vec![]; let dirr = fs.read_dir(b"/").unwrap(); diff --git a/ableos/src/vterm.rs b/ableos/src/vterm.rs index 32f49aab..d5d3da2c 100644 --- a/ableos/src/vterm.rs +++ b/ableos/src/vterm.rs @@ -2,7 +2,7 @@ use crate::{hardware::MOUSE, vga_e::VGAE}; use vga::{colors::Color16, writers::GraphicsWriter}; const TERM_MINUS_ONE_LINE: usize = 4720; -// const CURSOR_COLOR: Color16 = Color16::Cyan; +const CURSOR_COLOR: Color16 = Color16::Cyan; #[derive(Debug)] pub struct Term { @@ -75,11 +75,10 @@ impl Term { pub fn draw_term(&mut self) { if self.is_dirty() { trace!("Redrawing"); + use Color16::*; let mode = VGAE.lock(); - mode.clear_screen(Color16::Black); + mode.clear_screen(DarkGrey); - // /* - const CURSOR_COLOR: Color16 = Color16::Red; let mouse_coord = x86_64::instructions::interrupts::without_interrupts(|| { let cursor = MOUSE.lock(); @@ -102,12 +101,11 @@ impl Term { CURSOR_COLOR, ); - // */ let mut x = 0; let mut y = 0; for c in self.term { - mode.draw_character(x * 8, y * 8, c, Color16::White); + mode.draw_character(x * 8, y * 8, c, White); if x == 79 { y += 1; x = 0; @@ -115,6 +113,7 @@ impl Term { x += 1 } } + self.set_dirty(false); trace!("Finished drawing"); }