say steps in timer
This commit is contained in:
parent
fd22f62f21
commit
e0ee657fb3
|
@ -85,8 +85,8 @@ impl Timer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tick(&mut self, clock_cycles: usize) -> TimerReturn {
|
pub fn tick(&mut self, steps: usize) -> TimerReturn {
|
||||||
self.div_counter += clock_cycles;
|
self.div_counter += steps;
|
||||||
let mut div_diff = (self.div_counter / 256) as u8;
|
let mut div_diff = (self.div_counter / 256) as u8;
|
||||||
let mut last_div = self.div;
|
let mut last_div = self.div;
|
||||||
let mut returning = TimerReturn::default();
|
let mut returning = TimerReturn::default();
|
||||||
|
@ -105,7 +105,7 @@ impl Timer {
|
||||||
self.div_counter %= 256;
|
self.div_counter %= 256;
|
||||||
|
|
||||||
if self.control.enable {
|
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;
|
let tima_diff = (self.tima_counter / self.control.rate.as_num()) as u8;
|
||||||
self.tima_counter %= self.control.rate.as_num();
|
self.tima_counter %= self.control.rate.as_num();
|
||||||
let (val, wrap) = self.tima.overflowing_add(tima_diff);
|
let (val, wrap) = self.tima.overflowing_add(tima_diff);
|
||||||
|
|
Loading…
Reference in a new issue