public uint Step() { uint cycles = 0; uint cpuCyclces = Cpu.Step(); cycles += cpuCyclces; uint ppuCycles = 0; //while (ppuCycles < cpuCyclces * 3) { ppuCycles = Ppu.Step(); } cycles += ppuCycles; return(cycles); }
public void Frame() { var originalOddFrame = Ppu.OddFrame; while (isRunning && originalOddFrame == Ppu.OddFrame) { if (stepMode & !shouldStep) { return; } shouldStep = false; if (shouldReset) { Cpu.Reset(); Ppu.Reset(); Apu.Reset(); originalOddFrame = Ppu.OddFrame; shouldReset = false; } onBeforeStep?.Invoke(); var cycles = Cpu.Step(); for (var i = 0; i < cycles * PpuDotsPerCpuCycle; i++) { Ppu.Step(); } for (var i = 0; i < cycles; i++) { Apu.Step(); } } }