Skip to content
Snippets Groups Projects
Verified Commit 1804a57d authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

fix: issue in timer where the clock handles

large instructions values
parent 929f1507
No related branches found
No related tags found
No related merge requests found
Pipeline #986 passed
...@@ -29,14 +29,14 @@ impl Timer { ...@@ -29,14 +29,14 @@ impl Timer {
pub fn clock(&mut self, cycles: u8) { pub fn clock(&mut self, cycles: u8) {
self.div_clock += cycles as u16; self.div_clock += cycles as u16;
if self.div_clock >= 256 { while self.div_clock >= 256 {
self.div = self.div.wrapping_add(1); self.div = self.div.wrapping_add(1);
self.div_clock -= 256; self.div_clock -= 256;
} }
if self.tima_enabled { if self.tima_enabled {
self.tima_clock += cycles as u16; self.tima_clock += cycles as u16;
if self.tima_clock >= self.tima_ratio { while self.tima_clock >= self.tima_ratio {
if self.tima == 0xff { if self.tima == 0xff {
self.int_tima = true; self.int_tima = true;
self.tima = self.tma; self.tima = self.tma;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment