From 71cbf2b7aeeafb2d7b7c6cfcc1e7938b36f79fb1 Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 13 Nov 2017 20:08:39 -0500 Subject: .. --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index b5c45de..54885ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -184,19 +184,25 @@ fn main() { let mut ppu = ppu::PPU::new(&pmem, &win); let mut cpu = mos6502::CPU::new(&mem); mem.init(&mut cpu, &mut ppu); - + let mut cnt = 0; + let mut cnt2 = 0; loop { if win.poll() {break} cpu.step(); //println!("cpu at 0x{:04x}", cpu.get_pc()); while cpu.cycle > 0 { for _ in 0..3 { + cnt2 += 1; if ppu.tick() { println!("triggering nmi"); cpu.trigger_nmi(); + println!("{} cpu {} ppu per frame", cnt, cnt2); + cnt2 = 0; + cnt = 0; } } cpu.cycle -= 1; + cnt += 1; } } } -- cgit v1.2.3-70-g09d2