#register #graphics #data-structures #hardware #mode #access #memory

no-std vga

Support for vga specific functions, data structures, and registers

13 releases

0.2.9 Jun 12, 2023
0.2.8 Mar 1, 2023
0.2.7 Jun 3, 2021
0.2.6 Feb 15, 2021
0.2.1 Mar 26, 2020

#94 in No standard library

Download history 31/week @ 2024-07-20 86/week @ 2024-07-27 23/week @ 2024-08-03 35/week @ 2024-08-10 19/week @ 2024-08-17 11/week @ 2024-08-24 20/week @ 2024-08-31 38/week @ 2024-09-07 25/week @ 2024-09-14 84/week @ 2024-09-21 50/week @ 2024-09-28 10/week @ 2024-10-05 18/week @ 2024-10-12 13/week @ 2024-10-19 21/week @ 2024-10-26 68/week @ 2024-11-02

120 downloads per month
Used in 4 crates

MIT/Apache

155KB
2.5K SLoC

Build Status Docs.rs Badge

vga

This crate provides vga specific functions, data structures, and access to various registers.

Memory addresses 0xA0000 -> 0xBFFFF must be readable and writeable this crate to work properly.

Note: This crate is currently experimental and subject to change since it's in active development.

Text Mode

use vga::colors::{Color16, TextModeColor};
use vga::writers::{ScreenCharacter, TextWriter, Text80x25};

let text_mode = Text80x25::new();
let color = TextModeColor::new(Color16::Yellow, Color16::Black);
let screen_character = ScreenCharacter::new(b'T', color);

text_mode.set_mode();
text_mode.clear_screen();
text_mode.write_character(0, 0, screen_character);

Graphics Mode

use vga::colors::Color16;
use vga::writers::{Graphics640x480x16, GraphicsWriter};

let mode = Graphics640x480x16::new();
mode.set_mode();
mode.clear_screen(Color16::Black);
mode.draw_line((80, 60), (80, 420), Color16::White);
mode.draw_line((80, 60), (540, 60), Color16::White);
mode.draw_line((80, 420), (540, 420), Color16::White);
mode.draw_line((540, 420), (540, 60), Color16::White);
mode.draw_line((80, 90), (540, 90), Color16::White);
for (offset, character) in "Hello World!".chars().enumerate() {
    mode.draw_character(270 + offset * 8, 72, character, Color16::White)
}

Dependencies

~1.5MB
~20K SLoC