diff --git a/.gitignore b/.gitignore index 1d1b46b..4ab24a8 100644 --- a/.gitignore +++ b/.gitignore @@ -22,12 +22,12 @@ Cargo.lock # Generated grub files kernel/grub/ -aphrodite-grub.iso -aphrodite.iso +kernel/aphrodite-grub.iso +kernel/aphrodite.iso # Generated files -kernel.flat +kernel/kernel.flat config.aphro.tmp # Per-developer files -config.aphro \ No newline at end of file +kernel/config.aphro \ No newline at end of file diff --git a/kernel/kernel.flat b/kernel/kernel.flat deleted file mode 100755 index 66281f3..0000000 Binary files a/kernel/kernel.flat and /dev/null differ diff --git a/kernel/src/include/arch/x86_asmp/egatext.rs b/kernel/src/include/arch/x86_asmp/egatext.rs index 9c3725d..7027d7e 100644 --- a/kernel/src/include/arch/x86_asmp/egatext.rs +++ b/kernel/src/include/arch/x86_asmp/egatext.rs @@ -25,15 +25,18 @@ pub const ERR_INVALID_X: i16 = -1; /// Returned when the provided position is invalid in the Y direction. pub const ERR_INVALID_Y: i16 = -2; - -/// White text on a black background. -pub const WHITE_ON_BLACK: u8 = 0b00000111; -/// Black text on a black background. -pub const BLACK_ON_BLACK: u8 = 0b00000000; - impl crate::TextDisplay for FramebufferInfo { /// Writes a character to the screen. fn write_char(&self, mut pos: (u32, u32), char: u8, color: Color) -> Result<(), crate::Error<'static>> { + let mut clr = color.0; + if color.1 { + match clr { + 0 => clr = 0, + 1 => clr = 0b00000111, + _ => {} + } + } + let color = clr; if pos.0>self.width { return Err(crate::Error::new("Invalid X position", ERR_INVALID_X)); } diff --git a/kernel/src/include/traits.rs b/kernel/src/include/traits.rs index e9ce602..772aaf7 100644 --- a/kernel/src/include/traits.rs +++ b/kernel/src/include/traits.rs @@ -1,14 +1,17 @@ //! General traits. Mostly implemented in arch/*. /// A type used for color in the functions of [TextDisplay]. -pub type Color = u8; +/// +/// Type alias for (u8, bool). Boolean argument is whether to +/// change the value(i.e. for [COLOR_BLACK] and [COLOR_DEFAULT]). +pub type Color = (u8, bool); /// Black-on-black. -pub const COLOR_BLACK: Color = 0; +pub const COLOR_BLACK: Color = (0, true); /// Should be whatever color commonly used for status messages. /// Generally should be white-on-black. Value is one. -pub const COLOR_DEFAULT: Color = 1; +pub const COLOR_DEFAULT: Color = (1, true); /// Some form of display that can be written too with text. pub trait TextDisplay { diff --git a/kernel/src/internal/arch/x86_asmp/entry.rs b/kernel/src/internal/arch/x86_asmp/entry.rs index ef2e815..9a2315b 100644 --- a/kernel/src/internal/arch/x86_asmp/entry.rs +++ b/kernel/src/internal/arch/x86_asmp/entry.rs @@ -12,7 +12,6 @@ use aphrodite::boot::BootInfo; use aphrodite::multiboot2::{FramebufferInfo, MemoryMap, MemorySection, RawMemoryMap, RootTag, Tag}; use aphrodite::arch::output::*; use aphrodite::arch::egatext as egatext; -use egatext::*; use aphrodite::output::*; #[cfg(not(CONFIG_DISABLE_MULTIBOOT2_SUPPORT))] @@ -248,7 +247,7 @@ extern "C" fn _start() -> ! { let ega: &dyn aphrodite::TextDisplay = &framebuffer_info; framebuffer_info.disable_cursor(); - ega.clear_screen(WHITE_ON_BLACK); + ega.clear_screen(aphrodite::COLOR_DEFAULT); tdebugsln("Testing EGA Text framebuffer...", ega).unwrap(); tdebugsln("Testing EGA Text framebuffer...", ega).unwrap(); tdebugsln("Testing EGA Text framebuffer...", ega).unwrap();