Example #1
0
 public void Update(UInt16 interrupt, NesState aNesState, CPpu ppu)
 {
     if (ppu.IsSetNmi() == true)
     {
         NesCpu.Interrupt(aNesState, NesCpu.NMI);
     }
     //case CCpu::RESET:
     //case CCpu::IRQBRK:
 }
Example #2
0
        public Nes()
        {
            if (!ThreadNameSet)
            {
                Thread.CurrentThread.Name = "NES# GUI";
                ThreadNameSet             = true;
            }

            Cpu      = new NesCpu(this);
            Ppu      = new NesPpu(this);
            Debugger = new NesDebugger(this);
            Gui      = new SdlGui(this);
        }
Example #3
0
        public PlayerNsf(string aFilePath)
        {
            MusicNsf lMusic = ( MusicNsf )LoaderMusic.Load(aFilePath);

            Logger.LogNormal("Load");

            midiSynthesizer = new MidiSynthesizer();
            midiSynthesizer.SetVolume(( UInt16 )0x4000);
            midiSynthesizer.MonoModeOn(1);

            nesState = new NesState(lMusic);
            NesCpu.InitNsf(nesState);

            float lVolume = ( float )(40.0d * Math.Log10(0.5f));

            volume = ( float )Math.Pow(10.0d, lVolume / 20.0d);

            Init();
        }
Example #4
0
        public void Update(float[] aSoundBuffer, int aChannels, int aSampleRate)
        {
            NesCpu.Update(nesState);

            NesApu.Update(nesState, midiSynthesizer);

            int lLength = aSoundBuffer.Length / aChannels;

            midiSynthesizer.Reflesh();

            for (int i = 0; i < lLength; i++)
            {
                float[] lDataArray = new float[aChannels];

                midiSynthesizer.Update(lDataArray, aChannels, aSampleRate);

                for (int j = 0; j < aChannels; j++)
                {
                    aSoundBuffer[i * aChannels + j] = lDataArray[j] * volume;
                }
            }
        }