rustubs::machine::cgascr

Struct CGAScreen

Source
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

Source

const IR_PORT: IOPort

Source

const DR_PORT: IOPort

Source

pub fn new() -> Self

Source

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.

Source

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.

Source

pub fn backspace(&mut self)

Source

fn move_line(from: usize, to: usize)

Source

fn clearline(line: usize, attr: u8)

Source

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.

Source

fn newline(&mut self)

move cursor to the start of the next line. Scroll screen if called on the last line.

Source

pub fn scroll(&self, lines: usize)

Source

pub fn clear(&self)

Source

pub fn reset(&mut self)

Source

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.

Source

fn sync_cursor(&self)

Source

pub fn init_cursor(&self)

Source

pub fn print(&mut self, s: &str)

Source

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.

Source

pub fn setattr(&mut self, attr: u8)

Trait Implementations§

Source§

impl Write for CGAScreen

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a [char] into this writer, returning whether the write succeeded. Read more
1.0.0§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the [write!] macro with implementors of this trait. Read more

Auto Trait Implementations§

§

impl Freeze for CGAScreen

§

impl RefUnwindSafe for CGAScreen

§

impl Send for CGAScreen

§

impl Sync for CGAScreen

§

impl Unpin for CGAScreen

§

impl !UnwindSafe for CGAScreen

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.