aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 7 insertions, 1 deletions
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;
}
}
}