Worked more on EGA text mode output. Made good progress.

This commit is contained in:
Arthur Beck 2025-01-25 11:10:03 -06:00
parent 2df6e24d05
commit c015d443f6
8 changed files with 39 additions and 9 deletions

View file

@ -1,5 +1,5 @@
# config.aphro for aphrodite devel-bc19d1a-out-of-tree # config.aphro for aphrodite devel-2df6e24-out-of-tree
CFG_VERSION=devel-bc19d1a-out-of-tree CFG_VERSION=devel-2df6e24-out-of-tree
CONT_WITH_DIFFERENT_VERSION=false CONT_WITH_DIFFERENT_VERSION=false
# Begin metadata # Begin metadata

Binary file not shown.

View file

@ -1,8 +1,8 @@
set timeout=15 set timeout=15
set default=0 set default=0
menuentry "Aphrodite" --class aphrodite --class kernel --class os $menuentry_id_option 'aphrodite-basic-devel-bc19d1a-out-of-tree' { menuentry "Aphrodite" --class aphrodite --class kernel --class os $menuentry_id_option 'aphrodite-basic-devel-2df6e24-out-of-tree' {
echo 'Loading Aphrodite aphrodite-devel-bc19d1a-out-of-tree ...' echo 'Loading Aphrodite aphrodite-devel-2df6e24-out-of-tree ...'
multiboot2 /boot/aphrodite.kernel multiboot2 /boot/aphrodite.kernel
boot boot
} }

Binary file not shown.

View file

@ -82,4 +82,29 @@ impl FramebufferInfo {
} }
Ok((x, y)) Ok((x, y))
} }
}
/// Disables the cursor.
pub fn disable_cursor(self) {
super::ports::outb(0x3D4, 0x0A);
super::ports::outb(0x3D5, 0x20);
}
/// Enables the cursor.
pub fn enable_cursor(self, start_scan: u8, end_scan: u8) {
super::ports::outb(0x3D4, 0x0A);
super::ports::outb(0x3D5, (super::ports::inb(0x3D5) & 0xC0) | start_scan);
super::ports::outb(0x3D4, 0x0B);
super::ports::outb(0x3D5, (super::ports::inb(0x3D5) & 0xE0) | end_scan);
}
/// Sets the cursor's location.
pub fn set_cursor_location(self, pos: (u32, u32)) {
let addr = pos.1 * self.width + pos.0;
super::ports::outb(0x3D4, 0x0F);
super::ports::outb(0x3D5, (addr & 0xFF) as u8);
super::ports::outb(0x3D4, 0x0E);
super::ports::outb(0x3D5, ((addr >> 8) & 0xFF) as u8);
}
}

View file

@ -123,6 +123,7 @@ macro_rules! message_funcs {
OUTPUT_TERM_POSITION = info.write_str(OUTPUT_TERM_POSITION, $prefix, WHITE_ON_BLACK)?; OUTPUT_TERM_POSITION = info.write_str(OUTPUT_TERM_POSITION, $prefix, WHITE_ON_BLACK)?;
OUTPUT_TERM_POSITION = info.write_str(OUTPUT_TERM_POSITION, s, WHITE_ON_BLACK)?; OUTPUT_TERM_POSITION = info.write_str(OUTPUT_TERM_POSITION, s, WHITE_ON_BLACK)?;
OUTPUT_TERM_POSITION.1 += 1; OUTPUT_TERM_POSITION.1 += 1;
OUTPUT_TERM_POSITION.0 = 0;
} }
Ok(()) Ok(())
} }
@ -147,6 +148,7 @@ macro_rules! message_funcs {
OUTPUT_TERM_POSITION = info.write_str(OUTPUT_TERM_POSITION, $prefix, WHITE_ON_BLACK)?; OUTPUT_TERM_POSITION = info.write_str(OUTPUT_TERM_POSITION, $prefix, WHITE_ON_BLACK)?;
OUTPUT_TERM_POSITION = info.write_bytes(OUTPUT_TERM_POSITION, s, WHITE_ON_BLACK)?; OUTPUT_TERM_POSITION = info.write_bytes(OUTPUT_TERM_POSITION, s, WHITE_ON_BLACK)?;
OUTPUT_TERM_POSITION.1 += 1; OUTPUT_TERM_POSITION.1 += 1;
OUTPUT_TERM_POSITION.0 = 0;
} }
Ok(()) Ok(())
} }
@ -188,6 +190,7 @@ macro_rules! message_funcs {
} }
OUTPUT_TERM_POSITION = info.write_str(OUTPUT_TERM_POSITION, s, WHITE_ON_BLACK)?; OUTPUT_TERM_POSITION = info.write_str(OUTPUT_TERM_POSITION, s, WHITE_ON_BLACK)?;
OUTPUT_TERM_POSITION.1 += 1; OUTPUT_TERM_POSITION.1 += 1;
OUTPUT_TERM_POSITION.0 = 0;
} }
Ok(()) Ok(())
} }
@ -210,6 +213,7 @@ macro_rules! message_funcs {
} }
OUTPUT_TERM_POSITION = info.write_bytes(OUTPUT_TERM_POSITION, s, WHITE_ON_BLACK)?; OUTPUT_TERM_POSITION = info.write_bytes(OUTPUT_TERM_POSITION, s, WHITE_ON_BLACK)?;
OUTPUT_TERM_POSITION.1 += 1; OUTPUT_TERM_POSITION.1 += 1;
OUTPUT_TERM_POSITION.0 = 0;
} }
Ok(()) Ok(())
} }

View file

@ -26,7 +26,7 @@ pub fn inb(port: u16) -> u8 {
let out; let out;
unsafe { unsafe {
asm!( asm!(
"in {}, {1:x}", out(reg_byte) out, in(reg) port "in al, dx", out("al") out, in("dx") port
) )
} }
out out

View file

@ -278,10 +278,11 @@ extern "C" fn _start() -> ! {
bpp: framebuffer_info.bpp bpp: framebuffer_info.bpp
}; };
ega.clear_screen(BLACK_ON_BLACK); ega.clear_screen(BLACK_ON_BLACK);
ega.enable_cursor(14, 15);
ega.set_cursor_location((0, 0));
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();
for _ in 0..100000000 {
asm!("nop");
}
}, },
_ => { _ => {
unreachable!(); unreachable!();