#cursor-position #vga

cursor-rs

Getter & Setter cursor position on VGA(0xB8000) in freestanding Rust

3 releases

0.1.4 Nov 29, 2023
0.1.3 Nov 29, 2023
0.1.2 Nov 28, 2023
0.1.1 Nov 28, 2023
0.1.0 Nov 28, 2023

#6 in #vga


Used in vgastream-rs

MIT/Apache

6KB
86 lines

cursor-rs

Getter & Setter cursor position on VGA(0xB8000) in freestanding Rust.

How to use


cargo add cursor-rs

Example

#![no_std]
extern crate vgainfo_rs;
use vgainfo_rs::*;
extern crate cursor_rs;
use cursor_rs::*;

fn reset_screen() {
    let buffer_ptr = LENGTH as *mut VgaCharType;
    let iter = (0..LENGTH).map(|i| unsafe { buffer_ptr.add(i) });

    for ptr in iter {
        let value = unsafe { ptr.read_volatile() };
        unsafe { ptr.write_volatile(value & 0xff00) };
    }
    VgaCursor::new().set(0,0);
}

Contact me


lib.rs:

cursor_rs

Getter & Setter cursor position on VGA(0xB8000) in freestanding Rust.

Example

#![no_std]
extern crate vgainfo_rs;
use vgainfo_rs::*;
extern crate cursor_rs;
use cursor_rs::*;

fn reset_screen() {
    let buffer_ptr = LENGTH as *mut VgaCharType;
    let iter = (0..LENGTH).map(|i| unsafe { buffer_ptr.add(i) });

    for ptr in iter {
        let value = unsafe { ptr.read_volatile() };
        unsafe { ptr.write_volatile(value & 0xff00) };
    }
    VgaCursor::new().set(0,0);
}

Dependencies

~7KB