diff options
| author | Clément Sibille <claymeuns@protonmail.com> | 2021-10-04 22:57:05 +0200 |
|---|---|---|
| committer | Clément Sibille <claymeuns@protonmail.com> | 2021-10-04 22:57:05 +0200 |
| commit | a16a4dc9ed895c3a2934c2e14e1ab515f4899971 (patch) | |
| tree | ea4e0919283e896199130f6ec014afd8206c7a3f /kernel/src/lib.rs | |
| parent | 25a24b8b167a7cb28c622039ea30e4afd166cd83 (diff) | |
Provide an interface for drawing on the screen in VGA text mode
This interface allows the user to write strings and move the cursor in VGA text mode.
This closes #1.
Diffstat (limited to 'kernel/src/lib.rs')
| -rw-r--r-- | kernel/src/lib.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 285ecff..b6bc55f 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -1,23 +1,23 @@ +#![feature(asm)] #![no_std] #![no_main] +use crate::terminal::Terminal; use core::panic::PanicInfo; +mod io; +mod terminal; + #[no_mangle] pub extern "C" fn kmain() -> ! { - let vga_buffer = 0xb8000 as *mut u8; - - for (i, &byte) in b"LisibleOS Hello world".iter().enumerate() { - unsafe { - *vga_buffer.offset(i as isize * 2) = byte; - *vga_buffer.offset(i as isize * 2 + 1) = 0xb; - } - } - + let mut terminal = Terminal::new(); + terminal.clear(); + terminal.put_string(b"LisibleOS\n"); + terminal.put_string(b"> "); loop {} } #[panic_handler] fn panic(_info: &PanicInfo) -> ! { loop {} -}
\ No newline at end of file +} |
