Esempio n. 1
0
        public Cpu(Mapper mapper, Ppu ppu, Apu apu, Cheats cheats = null)
        {
            m_Mapper = mapper;
            m_Ppu    = ppu;
            m_Apu    = apu;

            if (cheats?.Count > 0)
            {
                m_Cheats = cheats;
            }
        }
Esempio n. 2
0
        public Nes(string path, string cheatPath, ushort?entryPoint = null)
        {
            var cartridge = new Cartridge(path);

            Console.WriteLine($"Mapper: {cartridge.MapperId}");
            Console.WriteLine($"PRG size: 0x{cartridge.PrgSize.ToHex()}");
            Console.WriteLine($"CHR size: 0x{cartridge.ChrSize.ToHex()}");
            Console.WriteLine($"Mirroring: {cartridge.Mirroring}");
            Console.WriteLine();

            if (cartridge.Mapper == null)
            {
                throw new InvalidOperationException("Unsupported mapper");
            }

            var mapper = cartridge.Mapper;
            var cheats = string.IsNullOrEmpty(cheatPath) ? null : new Cheats(cheatPath);

            m_Ppu = new Ppu(mapper);
            m_Apu = new Apu(mapper);
            m_Cpu = new Cpu(mapper, m_Ppu, m_Apu, cheats);

            m_Cpu.PowerOn(entryPoint);
        }