forked from haileys/rustboot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.rs
More file actions
36 lines (33 loc) · 639 Bytes
/
main.rs
File metadata and controls
36 lines (33 loc) · 639 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#![crate_type="lib"]
#![feature(no_std)]
#![no_std]
enum Color {
Black = 0,
Blue = 1,
Green = 2,
Cyan = 3,
Red = 4,
Pink = 5,
Brown = 6,
LightGray = 7,
DarkGray = 8,
LightBlue = 9,
LightGreen = 10,
LightCyan = 11,
LightRed = 12,
LightPink = 13,
Yellow = 14,
White = 15,
}
fn clear_screen(color: u16) {
let max = 80 * 25;
for i in 0..max {
unsafe {
*((0xb8000 + i * 2) as *mut u16) = color << 12;
}
}
}
#[no_mangle]
pub fn main() {
clear_screen(Color::LightRed as u16);
}