Find a file
2021-02-14 21:06:06 -06:00
.github/workflows Update workflow 2021-02-14 21:06:06 -06:00
src Comments and cleanup 2020-04-05 18:45:52 -05:00
testing Version bumps 2020-10-30 15:11:43 -05:00
.gitignore Basic testing groundwork 2020-03-12 13:34:48 -05:00
Cargo.toml Updated readme and version 2020-11-02 14:41:39 -06:00
Changelog.md Updated readme and version 2020-11-02 14:41:39 -06:00
LICENSE-APACHE Added licenses 2020-03-12 17:43:09 -05:00
LICENSE-MIT Added licenses 2020-03-12 17:43:09 -05:00
README.md updated readme 2020-03-24 17:54:09 -05:00
rust-toolchain Initial commit 2020-03-12 12:10:18 -05:00

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)
}