Exemple #1
0
 public void Reset()
 {
     cpu.Reset();
     ppu.Reset();
     cartridge.Reset();
     clockCounter = 0;
 }
Exemple #2
0
        public void Reset(bool inBios = false, Cartridge cartridge = null)
        {
            CyclesCount = 0;
            Cpu.Reset(inBios, cartridge);
            Mmu.Reset();
            Ppu.Reset();
            Apu.Reset();
            Input.Reset();
            Timer.Reset();
            Dma.Reset();
            LinkCable.Reset();
            IsAlive = true;

            frameQueue = new FrameQueue();
        }
Exemple #3
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();
                }
            }
        }