コード例 #1
0
        public void RunFrame()
        {
            while (ElapsedFrameCycles < CyclesPerFrame)
            {
                while (CpuCyclesForDot < CyclesPerDot)
                {
                    CpuCyclesForDot += Cpu.Step();
                }

                MemoryMap.FlushMmio();

                Ppu.Tick();

                MemoryMap.UpdateMmio();

                CpuCyclesForDot    -= CyclesPerDot;
                ElapsedFrameCycles += CyclesPerDot;
            }

            ElapsedFrameCycles -= CyclesPerFrame;
        }
コード例 #2
0
ファイル: Gameboy.cs プロジェクト: honased/GBSharp
        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;
        }