say steps in timer

This commit is contained in:
Alex Janka 2023-02-24 10:41:01 +11:00
parent fd22f62f21
commit e0ee657fb3

View file

@ -85,8 +85,8 @@ impl Timer {
}
}
pub fn tick(&mut self, clock_cycles: usize) -> TimerReturn {
self.div_counter += clock_cycles;
pub fn tick(&mut self, steps: usize) -> TimerReturn {
self.div_counter += steps;
let mut div_diff = (self.div_counter / 256) as u8;
let mut last_div = self.div;
let mut returning = TimerReturn::default();
@ -105,7 +105,7 @@ impl Timer {
self.div_counter %= 256;
if self.control.enable {
self.tima_counter += clock_cycles;
self.tima_counter += steps;
let tima_diff = (self.tima_counter / self.control.rate.as_num()) as u8;
self.tima_counter %= self.control.rate.as_num();
let (val, wrap) = self.tima.overflowing_add(tima_diff);