ppu can trigger NMIs

This commit is contained in:
Daniel Bauer
2020-01-20 10:20:18 +01:00
parent acd014991d
commit b1a996f009
5 changed files with 61 additions and 8 deletions

View File

@@ -74,7 +74,13 @@ impl NES {
if self.clock_count % 3 == 0 {
self.cpu.clock(&mut self.bus);
}
self.ppu.borrow_mut().clock(&mut *self.ppu_bus.borrow_mut());
let mut ppu = self.ppu.borrow_mut();
ppu.clock(&mut *self.ppu_bus.borrow_mut());
if ppu.nmi {
ppu.nmi = false;
self.cpu.nmi(&mut self.bus);
debug!("NMI triggered by PPU.")
}
if self.clock_count % 100000 == 0 {
info!("clock {}", self.clock_count);
}