示例#1
0
        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);
        }
示例#2
0
        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();
                }
            }
        }