Exemple #1
0
        public void Reset()
        {
            NES.IRQ.Disable();
            CPU6502.CLD();
            NES.APU.FrameCounter.Set(0x40);
            Stack.Reset();
            NES.PPU.Control.Set(0);
            NES.PPU.Mask.Set(0);
            NES.APU.DMC.Disable();
            //NES.APU.SetChannelsEnabled(NES.APU.Channels.DMC | NES.APU.Channels.Pulse1);

            Hardware.WaitForVBlank();
            Hardware.ClearRAM();
            Hardware.WaitForVBlank();

            ////TODO: move this to title, along with datasection
            //Comment("Load palettes");
            //Hardware.LoadPalettes(Palettes);

            Module <SceneManager>().Load(Module <Scenes.Title>());
            Hardware.WaitForVBlank();
            NES.PPU.Control.Set(NES.PPU.LazyControl);
            NES.PPU.Mask.Set(NES.PPU.LazyMask);
            ScrollUtil.Update();
            Loop.Infinite(_ => {
                Comment("Main Loop");

                Module <Gamepads>().Update();

                Module <SceneManager>().Step();

                A.Set(nmiCount);
                Loop.Do_old().While(() => nmiCount.Equals(A));

                Module <SceneManager>().CheckLoadNeeded();

                //Set shadow OAM address
                NES.PPU.OAM.Address.Set(0x00);                  //low byte of RAM address
                NES.PPU.OAM.DMA.Set(0x02);                      //high byte of RAM address
            });
        }