pub struct CGAScreen {
pub cga_mem: &'static mut [u8],
cursor_r: usize,
cursor_c: usize,
attr: u8,
}
Fields§
§cga_mem: &'static mut [u8]
§cursor_r: usize
§cursor_c: usize
§attr: u8
Implementations§
Source§impl CGAScreen
impl CGAScreen
const IR_PORT: IOPort
const DR_PORT: IOPort
pub fn new() -> Self
Sourcepub fn show(&mut self, row: usize, col: usize, c: char, attr: u8)
pub fn show(&mut self, row: usize, col: usize, c: char, attr: u8)
put a char at a position, it doesn’t care about the stored cursor location.
Sourcefn putchar(&mut self, ch: char)
fn putchar(&mut self, ch: char)
print a char at the current cursor location and update the cursor. Scroll the screen if needed. This doesn’t sync the on-screen cursor because IO takes time. the print function updates the cursor location in the end.
pub fn backspace(&mut self)
fn move_line(from: usize, to: usize)
fn clearline(line: usize, attr: u8)
Sourcefn advance(&mut self)
fn advance(&mut self)
advance the cga screen’s internal book keeping of the cursor location by 1 char. Scroll up if a newline is required at the last line.
Sourcefn newline(&mut self)
fn newline(&mut self)
move cursor to the start of the next line. Scroll screen if called on the last line.
pub fn scroll(&self, lines: usize)
pub fn clear(&self)
pub fn reset(&mut self)
Sourcepub fn setpos(&mut self, row: usize, col: usize)
pub fn setpos(&mut self, row: usize, col: usize)
the on-screen cursor position is decoupled with the system’s own book keeping, i.e. we update the cursor position based on our own record, but we never read this position back.
fn sync_cursor(&self)
pub fn init_cursor(&self)
pub fn print(&mut self, s: &str)
Sourcepub fn print_at_bottom(&mut self, s: &str, attr: u8)
pub fn print_at_bottom(&mut self, s: &str, attr: u8)
this is helpful for some helper text. this will clear the bottom line this will not update the cursor location.