vblank and registers

This commit is contained in:
Daniel Bauer
2020-01-13 09:20:16 +01:00
parent 99f73aa0c8
commit 6fe7c94edc
6 changed files with 370 additions and 214 deletions

View File

@@ -65,6 +65,9 @@ impl NES {
self.cpu.clock(&mut self.memory);
}
self.ppu.borrow_mut().clock(&mut self.memory);
if self.clock_count % 100000 == 0 {
info!("clock {}", self.clock_count);
}
}
@@ -86,8 +89,17 @@ impl NES {
self.clock();
}
self.ppu.borrow_mut().frame_ready = false;
info!("clock {}", self.clock_count);
}
// clock until the next scanline is done
pub fn clock_scanline(&mut self) {
let current_line = self.ppu.borrow().scanline;
while self.ppu.borrow().scanline == current_line {
self.clock();
}
}
}