Changed gitignore, changed color struct to work better cross-arch
This commit is contained in:
parent
e39bd7bf6e
commit
bdc41230f9
5 changed files with 20 additions and 15 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -22,12 +22,12 @@ Cargo.lock
|
||||||
|
|
||||||
# Generated grub files
|
# Generated grub files
|
||||||
kernel/grub/
|
kernel/grub/
|
||||||
aphrodite-grub.iso
|
kernel/aphrodite-grub.iso
|
||||||
aphrodite.iso
|
kernel/aphrodite.iso
|
||||||
|
|
||||||
# Generated files
|
# Generated files
|
||||||
kernel.flat
|
kernel/kernel.flat
|
||||||
config.aphro.tmp
|
config.aphro.tmp
|
||||||
|
|
||||||
# Per-developer files
|
# Per-developer files
|
||||||
config.aphro
|
kernel/config.aphro
|
Binary file not shown.
|
@ -25,15 +25,18 @@ pub const ERR_INVALID_X: i16 = -1;
|
||||||
/// Returned when the provided position is invalid in the Y direction.
|
/// Returned when the provided position is invalid in the Y direction.
|
||||||
pub const ERR_INVALID_Y: i16 = -2;
|
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 {
|
impl crate::TextDisplay for FramebufferInfo {
|
||||||
/// Writes a character to the screen.
|
/// Writes a character to the screen.
|
||||||
fn write_char(&self, mut pos: (u32, u32), char: u8, color: Color) -> Result<(), crate::Error<'static>> {
|
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 {
|
if pos.0>self.width {
|
||||||
return Err(crate::Error::new("Invalid X position", ERR_INVALID_X));
|
return Err(crate::Error::new("Invalid X position", ERR_INVALID_X));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
//! General traits. Mostly implemented in arch/*.
|
//! General traits. Mostly implemented in arch/*.
|
||||||
|
|
||||||
/// A type used for color in the functions of [TextDisplay].
|
/// 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.
|
/// 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.
|
/// Should be whatever color commonly used for status messages.
|
||||||
/// Generally should be white-on-black. Value is one.
|
/// 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.
|
/// Some form of display that can be written too with text.
|
||||||
pub trait TextDisplay {
|
pub trait TextDisplay {
|
||||||
|
|
|
@ -12,7 +12,6 @@ use aphrodite::boot::BootInfo;
|
||||||
use aphrodite::multiboot2::{FramebufferInfo, MemoryMap, MemorySection, RawMemoryMap, RootTag, Tag};
|
use aphrodite::multiboot2::{FramebufferInfo, MemoryMap, MemorySection, RawMemoryMap, RootTag, Tag};
|
||||||
use aphrodite::arch::output::*;
|
use aphrodite::arch::output::*;
|
||||||
use aphrodite::arch::egatext as egatext;
|
use aphrodite::arch::egatext as egatext;
|
||||||
use egatext::*;
|
|
||||||
use aphrodite::output::*;
|
use aphrodite::output::*;
|
||||||
|
|
||||||
#[cfg(not(CONFIG_DISABLE_MULTIBOOT2_SUPPORT))]
|
#[cfg(not(CONFIG_DISABLE_MULTIBOOT2_SUPPORT))]
|
||||||
|
@ -248,7 +247,7 @@ extern "C" fn _start() -> ! {
|
||||||
|
|
||||||
let ega: &dyn aphrodite::TextDisplay = &framebuffer_info;
|
let ega: &dyn aphrodite::TextDisplay = &framebuffer_info;
|
||||||
framebuffer_info.disable_cursor();
|
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();
|
tdebugsln("Testing EGA Text framebuffer...", ega).unwrap();
|
||||||
tdebugsln("Testing EGA Text framebuffer...", ega).unwrap();
|
tdebugsln("Testing EGA Text framebuffer...", ega).unwrap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue