use super::{Screen, TextWriter};
use crate::{
colors::DEFAULT_PALETTE,
fonts::TEXT_8X16_FONT,
vga::{VideoMode, VGA},
};
const WIDTH: usize = 40;
const HEIGHT: usize = 25;
const SIZE: usize = WIDTH * HEIGHT;
#[derive(Debug, Clone, Copy, Default)]
pub struct Text40x25;
impl Screen for Text40x25 {
const WIDTH: usize = WIDTH;
const HEIGHT: usize = HEIGHT;
const SIZE: usize = SIZE;
}
impl TextWriter for Text40x25 {
fn set_mode(&self) {
let mut vga = VGA.lock();
vga.set_video_mode(VideoMode::Mode40x25);
vga.color_palette_registers.load_palette(&DEFAULT_PALETTE);
vga.load_font(&TEXT_8X16_FONT);
}
}
impl Text40x25 {
pub const fn new() -> Text40x25 {
Text40x25
}
}