예제 #1
0
 public void Connect(GameBoySpu spu)
 {
     for (var i = 0; i < spu.Channels.Count; i++)
     {
         spu.Channels[i].ChannelOutput = Channels[i];
     }
 }
예제 #2
0
 public void Connect(GameBoySpu spu)
 {
     for (var i = 0; i < spu.Channels.Count; i++)
     {
         var channel = spu.Channels[i];
         channel.ChannelOutput = Channels[i];
         channel.ChannelVolume = 0.05f;
     }
 }
예제 #3
0
 public void Connect(GameBoySpu spu)
 {
     for (var i = 0; i < spu.Channels.Count; i++)
     {
         var channel = spu.Channels[i];
         if (channel != null) // TODO: remove null check if all channels are implemented.
         {
             channel.ChannelOutput = Channels[i];
         }
     }
 }
예제 #4
0
 public GameBoy(ICartridge cartridge)
 {
     Cartridge = cartridge;
     Memory    = new GameBoyMemory(this);
     Cpu       = new GameBoyCpu(this);
     Gpu       = new GameBoyGpu(this);
     Spu       = new GameBoySpu(this);
     KeyPad    = new GameBoyPad(this);
     Timer     = new GameBoyTimer(this);
     Reset();
     IsPoweredOn = true;
 }
예제 #5
0
파일: GameBoy.cs 프로젝트: lukehorak/Emux
        public GameBoy(ICartridge cartridge, IClock clock, bool preferGbcMode)
        {
            GbcMode = preferGbcMode && (cartridge.GameBoyColorFlag & GameBoyColorFlag.SupportsColor) != 0;

            _clock = clock;

            Components = new List <IGameBoyComponent>
            {
                (Cartridge = cartridge),
                (Memory = new GameBoyMemory(this)),
                (Cpu = new GameBoyCpu(this, clock)),
                (Gpu = new GameBoyGpu(this)),
                (Spu = new GameBoySpu(this)),
                (KeyPad = new GameBoyPad(this)),
                (Timer = new GameBoyTimer(this))
            }.AsReadOnly();

            foreach (var component in Components)
            {
                component.Initialize();
            }

            Reset();
            IsPoweredOn = true;

            _clock.Tick += NextFrame;
            new Thread(CpuLoop)
            {
                Name         = "Z80CPULOOP",
                IsBackground = true
            }.Start();


            _lastFrameTime     = DateTime.Now;
            Gpu.VBlankStarted += (_, __) =>
            {
                _framesCount++;

                FrameDelta     = DateTime.Now - _lastFrameTime;
                _lastFrameTime = DateTime.Now;
            };
        }
예제 #6
0
파일: GameBoy.cs 프로젝트: luqide/Emux
        public GameBoy(ICartridge cartridge, IClock clock, bool preferGbcMode)
        {
            GbcMode = preferGbcMode && (cartridge.GameBoyColorFlag & GameBoyColorFlag.SupportsColor) != 0;

            Components = new List <IGameBoyComponent>
            {
                (Cartridge = cartridge),
                (Memory = new GameBoyMemory(this)),
                (Cpu = new GameBoyCpu(this, clock)),
                (Gpu = new GameBoyGpu(this)),
                (Spu = new GameBoySpu(this)),
                (KeyPad = new GameBoyPad(this)),
                (Timer = new GameBoyTimer(this))
            }.AsReadOnly();

            foreach (var component in Components)
            {
                component.Initialize();
            }

            Reset();
            IsPoweredOn = true;
        }
예제 #7
0
        public void PowerOn(string romName)
        {
            PoweredOn = true;

            bootstrapRom = new BootRom("../../../../DMG_BootRom.bin");
            rom          = new Rom(romName);
            //rom = new Rom("../../../../roms/games/tetris.gb");
            //rom = new Rom("../../../../roms/games/Dr. Mario.gb");
            //rom = new Rom("../../../../roms/games/Bubble Ghost (J).gb");
            //rom = new Rom("../../../../roms/games/Super Mario Land.gb");
            //rom = new Rom("../../../../roms/games/Super Mario Land 2 - 6 Golden Coins (UE) (V1.2).gb");
            //rom = new Rom("../../../../roms/games/Wario Land - Super Mario Land 3.gb");
            //rom = new Rom("../../../../roms/games/Bootleg Marioland 4.gb");
            //rom = new Rom("../../../../roms/games/Teenage Mutant Hero Turtles - Back from the Sewers (E).gb");
            //rom = new Rom("../../../../roms/games/Teenage Mutant Hero Turtles - Fall of the Foot Clan (E).gb");
            //rom = new Rom("../../../../roms/games/Teenage Mutant Hero Turtles III - Radical Rescue (E) [!].gb");
            //rom = new Rom("../../../../roms/games/Legend of Zelda, The - Link's Awakening (U) (V1.2).gb");
            //rom = new Rom("../../../../roms/games/Pokemon - Blue.gb");
            //rom = new Rom("../../../../roms/games/Gargoyle's Quest - Ghosts'n Goblins.gb");
            //rom = new Rom("../../../../roms/games/Mega Man V.gb");
            //rom = new Rom("../../../../roms/games/Donkey Kong.gb");
            //rom = new Rom("../../../../roms/games/Donkey Kong Land (U) [S][!].gb");
            //rom = new Rom("../../../../roms/games/Donkey Kong Land 2 (UE) [S][!].gb");
            //rom = new Rom("../../../../roms/games/Donkey Kong Land III (U) [S][!].gb");
            //rom = new Rom("../../../../roms/games/X - Xekkusu.gb");
            //rom = new Rom("../../../../roms/games/Wave race.gb");
            //rom = new Rom("../../../../roms/games/F-1 Race.gb");
            //rom = new Rom("../../../../roms/games/Pinball Deluxe (U).gb");
            //rom = new Rom("../../../../roms/games/Prehistorik Man.gb");
            //rom = new Rom("../../../../roms/games/Amazing Spider-Man 3, The - Invasion of the Spider-Slayers (U) [!].gb");
            //rom = new Rom("../../../../roms/games/Tennis (JUE) [!].gb");

            //rom = new Rom("../../../../roms/bgbtest.gb");
            //rom = new Rom("../../../../roms/tellinglys.gb");                  //passes

            // Blargg CPU tests
            //rom = new Rom("../../../../roms/cpu_instrs.gb");
            //rom = new Rom("../../../../roms/01-special.gb");                  // passes
            //rom = new Rom("../../../../roms/02-interrupts.gb");               // passes
            //rom = new Rom("../../../../roms/03-op sp,hl.gb");                 // passes
            //rom = new Rom("../../../../roms/04-op r,imm.gb");                 // passes
            //rom = new Rom("../../../../roms/05-op rp.gb");                    // passes
            //rom = new Rom("../../../../roms/06-ld r,r.gb");                   // passes
            //rom = new Rom("../../../../roms/07-jr,jp,call,ret,rst.gb");       // passes
            //rom = new Rom("../../../../roms/08-misc instrs.gb");              // passes
            //rom = new Rom("../../../../roms/09-op r,r.gb");                   // passes
            //rom = new Rom("../../../../roms/10-bit ops.gb");                  // passes
            //rom = new Rom("../../../../roms/11-op a,(hl).gb");                // passes

            //rom = new Rom("../../../../roms/instr_timing.gb");                // passes
            //rom = new Rom("../../../../roms/mem_timing.gb");                  // passes
            //rom = new Rom("../../../../roms/mem_timing2.gb");                 // passes
            //rom = new Rom("../../../../roms/interrupt_time.gb");              // fails (GBC only)
            //rom = new Rom("../../../../roms/halt_bug.gb");

            // Mooneye tests
            //rom = new Rom("../../../../roms/bits_bank1.gb");                    // pass

            if (rom.Type == Rom.RomType.UnSupported)
            {
                throw new InvalidDataException("Unsupported ROM type");
            }

            interrupts = new Interrupts(this);
            ppu        = new Ppu(this);
            memory     = new Memory(this);
            cpu        = new Cpu(memory, interrupts, this);
            timer      = new DmgTimer(this);
            pad        = new Joypad(interrupts, this);
            spu        = new GameBoySpu(this);
            spu.Initialize();

            mixer = new GameBoyNAudioMixer();
            mixer.Connect(spu);
            player = new DirectSoundOut();
            player.Init(mixer);
            player.Play();

            cpu.Reset();
            ppu.Reset();
            interrupts.Reset();
            timer.Reset();
            pad.Reset();

            EmulatorTimer.Reset();
            EmulatorTimer.Start();

            if (rom.Type == Rom.RomType.MBC1_Ram_Battery)
            {
                rom.LoadMbc1BatteryBackData();
            }

            ticksPerSecond       = 0;
            secondsSinceLastSave = 0;
        }