public void RunFrame() { while (ElapsedFrameCycles < CyclesPerFrame) { while (CpuCyclesForDot < CyclesPerDot) { CpuCyclesForDot += Cpu.Step(); } MemoryMap.FlushMmio(); Ppu.Tick(); MemoryMap.UpdateMmio(); CpuCyclesForDot -= CyclesPerDot; ElapsedFrameCycles += CyclesPerDot; } ElapsedFrameCycles -= CyclesPerFrame; }
public void ExecuteFrame() { while (CyclesCount < CPU_CYCLES) { int cycles = Cpu.ExecuteCycle(); int divisorAmount = Cpu.DoubleSpeed ? 2 : 1; int dmaCycles = Dma.CopyData(); cycles *= 4; Timer.Tick(cycles + dmaCycles); Input.Tick(); Ppu.Tick((cycles + dmaCycles) / divisorAmount); Apu.Tick((cycles + dmaCycles) / divisorAmount); CyclesCount += cycles / divisorAmount; } CyclesCount -= CPU_CYCLES; }