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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use super::{Screen, TextWriter};
use crate::{
colors::DEFAULT_PALETTE,
fonts::TEXT_8X8_FONT,
vga::{VideoMode, VGA},
};
const WIDTH: usize = 40;
const HEIGHT: usize = 50;
#[derive(Default)]
pub struct Text40x50;
impl Screen for Text40x50 {
fn get_width(&self) -> usize {
WIDTH
}
fn get_height(&self) -> usize {
HEIGHT
}
fn get_size(&self) -> usize {
WIDTH * HEIGHT
}
}
impl TextWriter for Text40x50 {
fn set_mode(&self) {
let mut vga = VGA.lock();
vga.set_video_mode(VideoMode::Mode40x50);
vga.color_palette_registers.load_palette(&DEFAULT_PALETTE);
vga.load_font(&TEXT_8X8_FONT);
}
}
impl Text40x50 {
pub fn new() -> Text40x50 {
Text40x50 {}
}
}