BUGFIX: Corrects runaway after drawing in my first schip rom scroll down, left, right all test with test rom assembler now assembles to the expected output it seems fixes incorrect loading of schip font to memory replaces schip font from new chatgpt feedback
37 lines
636 B
Rust
37 lines
636 B
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Copy, Serialize, Deserialize, Debug)]
|
|
pub struct DelayTimer {
|
|
counter: u8,
|
|
}
|
|
|
|
impl Default for DelayTimer {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|
|
|
|
impl DelayTimer {
|
|
pub fn current(&self) -> u8 {
|
|
self.counter
|
|
}
|
|
|
|
pub fn new() -> Self {
|
|
DelayTimer { counter: 0xff }
|
|
}
|
|
|
|
pub fn reset(&mut self) {
|
|
self.counter = 0xff;
|
|
}
|
|
|
|
pub fn set_timer(&mut self, new_value: u8) {
|
|
self.counter = new_value
|
|
}
|
|
|
|
pub fn tick(&mut self) {
|
|
if self.counter > 0 {
|
|
self.counter -= 1;
|
|
}
|
|
}
|
|
}
|