private void RebootCore()
        {
            // Regenerate mapper here to make sure its state is entirely clean
            _mapper   = CreateMapper(this, _game.GetOptions()["m"], Rom.Length);
            _lagCount = 0;
            Cpu       = new MOS6502X <CpuLink>(new CpuLink(this));

            if (_game["PAL"])
            {
                _pal = true;
            }
            else if (_game["NTSC"])
            {
                _pal = false;
            }
            else
            {
                _pal = DetectPal(_game, Rom);
            }

            // dcfilter coefficent is from real observed hardware behavior: a latched "1" will fully decay by ~170 or so tia sound cycles
            _tia = new TIA(this, _pal, Settings.SECAMColors);

            _dcfilter = new DCFilter(_tia, 256);

            _m6532 = new M6532(this);

            HardReset();

            RomDetails = $"{_game.Name}\r\nSHA1:{Rom.HashSHA1()}\r\nMD5:{Rom.HashMD5()}\r\nMapper Impl \"{_mapper.GetType()}\"";

            // Some games (ex. 3D tic tac toe), turn off the screen for extended periods, so we need to allow for this here.
            if (_game.GetOptions().ContainsKey("SP_FRAME"))
            {
                if (_game.GetOptions()["SP_FRAME"] == "true")
                {
                    SP_FRAME = true;
                }
            }
            if (_game.GetOptions().ContainsKey("SP_RESET"))
            {
                if (_game.GetOptions()["SP_RESET"] == "true")
                {
                    SP_RESET = true;
                }
            }
        }
        private void RebootCore()
        {
            // Regenerate mapper here to make sure its state is entirely clean
            _mapper   = CreateMapper(this, _game.GetOptions()["m"], Rom.Length);
            _lagCount = 0;
            Cpu       = new MOS6502X <CpuLink>(new CpuLink(this));

            if (_game["PAL"])
            {
                _pal = true;
            }
            else if (_game["NTSC"])
            {
                _pal = false;
            }
            else
            {
                _pal = DetectPal(_game, Rom);
            }

            // dcfilter coefficent is from real observed hardware behavior: a latched "1" will fully decay by ~170 or so tia sound cycles
            _tia = new TIA(this, _pal, Settings.SECAMColors);

            _dcfilter = new DCFilter(_tia, 256);

            _m6532 = new M6532(this);

            HardReset();

            RomDetails = $"{_game.Name}\r\n{SHA1Checksum.ComputePrefixedHex(Rom)}\r\n{MD5Checksum.ComputePrefixedHex(Rom)}\r\nMapper Impl \"{_mapper.GetType()}\"";

            // Some games (ex. 3D tic tac toe), turn off the screen for extended periods, so we need to allow for this here.
            if (_game.GetOptions().TryGetValue("SP_FRAME", out var spFrameStr) && spFrameStr == "true")
            {
                SP_FRAME = true;
            }
            // Some games wait for reset to be unpressed before turning the screen back on, hack unset it if needed
            if (_game.GetOptions().TryGetValue("SP_RESET", out var spResetStr) && spResetStr == "true")
            {
                SP_RESET = true;
            }
            // Ditto select (ex. Karate)
            if (_game.GetOptions().TryGetValue("SP_SELECT", out var spSelectStr) && spSelectStr == "true")
            {
                SP_SELECT = true;
            }
        }
        private void RebootCore()
        {
            // Regenerate mapper here to make sure its state is entirely clean
            switch (_game.GetOptionsDict()["m"])
            {
            case "2IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 2);
                break;

            case "4IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 4);
                break;

            case "8IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 8);
                break;

            case "16IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 16);
                break;

            case "32IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 32);
                break;

            case "AR":
                _mapper = new mAR(this);                         // This mapper has to set up configurations in the contructor.
                break;

            case "4K":
                _mapper = new m4K();
                break;

            case "2K":
                _mapper = new m2K();
                break;

            case "CM":
                _mapper = new mCM();
                break;

            case "CV":
                _mapper = new mCV();
                break;

            case "DPC":
                _mapper = new mDPC();
                break;

            case "DPC+":
                _mapper = new mDPCPlus();
                break;

            case "F8":
                _mapper = new mF8();
                break;

            case "F8SC":
                _mapper = new mF8SC();
                break;

            case "F6":
                _mapper = new mF6();
                break;

            case "F6SC":
                _mapper = new mF6SC();
                break;

            case "F4":
                _mapper = new mF4();
                break;

            case "F4SC":
                _mapper = new mF4SC();
                break;

            case "FE":
                _mapper = new mFE();
                break;

            case "E0":
                _mapper = new mE0();
                break;

            case "3F":
                _mapper = new m3F();
                break;

            case "FA":
                _mapper = new mFA();
                break;

            case "FA2":
                _mapper = new mFA2();
                break;

            case "E7":
                _mapper = new mE7();
                break;

            case "F0":
                _mapper = new mF0();
                break;

            case "UA":
                _mapper = new mUA();
                break;

            // Special Sega Mapper which has swapped banks
            case "F8_sega":
                _mapper = new mF8_sega();
                break;

            // Homebrew mappers
            case "3E":
                _mapper = new m3E();
                break;

            case "0840":
                _mapper = new m0840();
                break;

            case "MC":
                _mapper = new mMC();
                break;

            case "EF":
                _mapper = new mEF();
                break;

            case "EFSC":
                _mapper = new mEFSC();
                break;

            case "X07":
                _mapper = new mX07();
                break;

            case "4A50":
                _mapper = new m4A50();
                break;

            case "SB":
                _mapper = new mSB();
                break;

            default:
                throw new InvalidOperationException("mapper not supported: " + _game.GetOptionsDict()["m"]);
            }

            _mapper.Core = this;

            _lagCount = 0;
            Cpu       = new MOS6502X <CpuLink>(new CpuLink(this));

            if (_game["PAL"])
            {
                _pal = true;
            }
            else if (_game["NTSC"])
            {
                _pal = false;
            }
            else
            {
                _pal = DetectPal(_game, Rom);
            }

            // dcfilter coefficent is from real observed hardware behavior: a latched "1" will fully decay by ~170 or so tia sound cycles
            _tia = new TIA(this, _pal, Settings.SECAMColors);

            _dcfilter = new DCFilter(_tia, 256);

            _m6532 = new M6532(this);

            HardReset();

            // Show mapper class on romstatusdetails
            CoreComm.RomStatusDetails = $"{this._game.Name}\r\nSHA1:{Rom.HashSHA1()}\r\nMD5:{Rom.HashMD5()}\r\nMapper Impl \"{_mapper.GetType()}\"";

            // Some games (ex. 3D tic tac toe), turn off the screen for extended periods, so we need to allow for this here.
            if (_game.GetOptionsDict().ContainsKey("SP_FRAME"))
            {
                if (_game.GetOptionsDict()["SP_FRAME"] == "true")
                {
                    SP_FRAME = true;
                }
            }
            if (_game.GetOptionsDict().ContainsKey("SP_RESET"))
            {
                if (_game.GetOptionsDict()["SP_RESET"] == "true")
                {
                    SP_RESET = true;
                }
            }
        }
Exemple #4
0
        public void RebootCore()
        {
            // Regenerate mapper here to make sure its state is entirely clean
            switch (_game.GetOptionsDict()["m"])
            {
            case "2IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 2);
                break;

            case "4IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 4);
                break;

            case "8IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 8);
                break;

            case "16IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 16);
                break;

            case "32IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 32);
                break;

            case "AR":
                _mapper = new mAR(this);                         // This mapper has to set up configurations in the contructor.
                break;

            case "4K":
                _mapper = new m4K();
                break;

            case "2K":
                _mapper = new m2K();
                break;

            case "CM":
                _mapper = new mCM();
                break;

            case "CV":
                _mapper = new mCV();
                break;

            case "DPC":
                _mapper = new mDPC();
                break;

            case "DPC+":
                _mapper = new mDPCPlus();
                break;

            case "F8":
                _mapper = new mF8();
                break;

            case "F8SC":
                _mapper = new mF8SC();
                break;

            case "F6":
                _mapper = new mF6();
                break;

            case "F6SC":
                _mapper = new mF6SC();
                break;

            case "F4":
                _mapper = new mF4();
                break;

            case "F4SC":
                _mapper = new mF4SC();
                break;

            case "FE":
                _mapper = new mFE();
                break;

            case "E0":
                _mapper = new mE0();
                break;

            case "3F":
                _mapper = new m3F();
                break;

            case "FA":
                _mapper = new mFA();
                break;

            case "FA2":
                _mapper = new mFA2();
                break;

            case "E7":
                _mapper = new mE7();
                break;

            case "F0":
                _mapper = new mF0();
                break;

            case "UA":
                _mapper = new mUA();
                break;

            // Homebrew mappers
            case "3E":
                _mapper = new m3E();
                break;

            case "0840":
                _mapper = new m0840();
                break;

            case "MC":
                _mapper = new mMC();
                break;

            case "EF":
                _mapper = new mEF();
                break;

            case "EFSC":
                _mapper = new mEFSC();
                break;

            case "X07":
                _mapper = new mX07();
                break;

            case "4A50":
                _mapper = new m4A50();
                break;

            case "SB":
                _mapper = new mSB();
                break;

            default:
                throw new InvalidOperationException("mapper not supported: " + _game.GetOptionsDict()["m"]);
            }

            _mapper.Core = this;

            _lagcount = 0;
            Cpu       = new MOS6502X
            {
                ReadMemory      = this.ReadMemory,
                WriteMemory     = this.WriteMemory,
                PeekMemory      = this.PeekMemory,
                DummyReadMemory = this.ReadMemory,
                OnExecFetch     = this.ExecFetch
            };

            if (_game["PAL"])
            {
                _pal = true;
            }
            else if (_game["NTSC"])
            {
                _pal = false;
            }
            else
            {
                _pal = DetectPal(_game, Rom);
            }

            _tia = new TIA(this, _pal, Settings.SECAMColors);
            _tia.GetFrameRate(out CoreComm.VsyncNum, out CoreComm.VsyncDen);

            // dcfilter coefficent is from real observed hardware behavior: a latched "1" will fully decay by ~170 or so tia sound cycles
            _dcfilter = DCFilter.AsISoundProvider(_tia, 256);

            M6532 = new M6532(this);

            // Set up the system state here. for instance..
            // Read from the reset vector for where to start
            Cpu.PC = (ushort)(ReadMemory(0x1FFC) + (ReadMemory(0x1FFD) << 8));             // set the initial PC

            // Show mapper class on romstatusdetails
            CoreComm.RomStatusDetails =
                string.Format(
                    "{0}\r\nSHA1:{1}\r\nMD5:{2}\r\nMapper Impl \"{3}\"",
                    this._game.Name,
                    Rom.HashSHA1(),
                    Rom.HashMD5(),
                    _mapper.GetType());
        }
Exemple #5
0
        private void RebootCore()
        {
            // Regenerate mapper here to make sure its state is entirely clean
            switch (_game.GetOptionsDict()["m"])
            {
            case "2IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 2);
                break;

            case "4IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 4);
                break;

            case "8IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 8);
                break;

            case "16IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 16);
                break;

            case "32IN1":
                _mapper = SetMultiCartMapper(Rom.Length, 32);
                break;

            case "AR":
                _mapper = new mAR(this);                         // This mapper has to set up configurations in the contructor.
                break;

            case "4K":
                _mapper = new m4K();
                break;

            case "2K":
                _mapper = new m2K();
                break;

            case "CM":
                _mapper = new mCM();
                break;

            case "CV":
                _mapper = new mCV();
                break;

            case "DPC":
                _mapper = new mDPC();
                break;

            case "DPC+":
                _mapper = new mDPCPlus();
                break;

            case "F8":
                _mapper = new mF8();
                break;

            case "F8SC":
                _mapper = new mF8SC();
                break;

            case "F6":
                _mapper = new mF6();
                break;

            case "F6SC":
                _mapper = new mF6SC();
                break;

            case "F4":
                _mapper = new mF4();
                break;

            case "F4SC":
                _mapper = new mF4SC();
                break;

            case "FE":
                _mapper = new mFE();
                break;

            case "E0":
                _mapper = new mE0();
                break;

            case "3F":
                _mapper = new m3F();
                break;

            case "FA":
                _mapper = new mFA();
                break;

            case "FA2":
                _mapper = new mFA2();
                break;

            case "E7":
                _mapper = new mE7();
                break;

            case "F0":
                _mapper = new mF0();
                break;

            case "UA":
                _mapper = new mUA();
                break;

            // Special Sega Mapper which has swapped banks
            case "F8_sega":
                _mapper = new mF8_sega();
                break;

            // Homebrew mappers
            case "3E":
                _mapper = new m3E();
                break;

            case "0840":
                _mapper = new m0840();
                break;

            case "MC":
                _mapper = new mMC();
                break;

            case "EF":
                _mapper = new mEF();
                break;

            case "EFSC":
                _mapper = new mEFSC();
                break;

            case "X07":
                _mapper = new mX07();
                break;

            case "4A50":
                _mapper = new m4A50();
                break;

            case "SB":
                _mapper = new mSB();
                break;

            default:
                throw new InvalidOperationException("mapper not supported: " + _game.GetOptionsDict()["m"]);
            }

            _mapper.Core = this;

            _lagcount = 0;
            Cpu       = new MOS6502X
            {
                ReadMemory      = this.ReadMemory,
                WriteMemory     = this.WriteMemory,
                PeekMemory      = this.PeekMemory,
                DummyReadMemory = this.ReadMemory,
                OnExecFetch     = this.ExecFetch
            };

            if (_game["PAL"])
            {
                _pal = true;
            }
            else if (_game["NTSC"])
            {
                _pal = false;
            }
            else
            {
                _pal = DetectPal(_game, Rom);
            }

            // dcfilter coefficent is from real observed hardware behavior: a latched "1" will fully decay by ~170 or so tia sound cycles
            _tia = new TIA(this, _pal, Settings.SECAMColors, CoreComm.VsyncRate > 55.0 ? 735 : 882);
            _tia.GetFrameRate(out CoreComm.VsyncNum, out CoreComm.VsyncDen);

            _dcfilter = new DCFilter(_tia, 256);

            M6532 = new M6532(this);

            // Set up the system state here. for instance..
            // Read from the reset vector for where to start
            Cpu.PC = (ushort)(ReadMemory(0x1FFC) + (ReadMemory(0x1FFD) << 8));             // set the initial PC

            // Show mapper class on romstatusdetails
            CoreComm.RomStatusDetails =
                string.Format(
                    "{0}\r\nSHA1:{1}\r\nMD5:{2}\r\nMapper Impl \"{3}\"",
                    this._game.Name,
                    Rom.HashSHA1(),
                    Rom.HashMD5(),
                    _mapper.GetType());


            // as it turns out, the stack pointer cannot be set to 0 for some games as they do not initilize it themselves.
            // some documentation seems to indicate it should beset to FD, but currently there is no documentation of the 6532
            // executing a reset sequence at power on, but it's needed so let's hard code it for now
            Cpu.S = 0xFD;
        }
Exemple #6
0
		public void RebootCore()
		{
			// Regenerate mapper here to make sure its state is entirely clean
			switch (_game.GetOptionsDict()["m"])
			{
				case "2IN1":
					_mapper = SetMultiCartMapper(Rom.Length, 2);
					break;
				case "4IN1":
					_mapper = SetMultiCartMapper(Rom.Length, 4);
					break;
				case "8IN1":
					_mapper = SetMultiCartMapper(Rom.Length, 8);
					break;
				case "16IN1":
					_mapper = SetMultiCartMapper(Rom.Length, 16);
					break;
				case "32IN1":
					_mapper = SetMultiCartMapper(Rom.Length, 32);
					break;
				case "AR":
					_mapper = new mAR(this); // This mapper has to set up configurations in the contructor.
					break;
				case "4K":
					_mapper = new m4K();
					break;
				case "2K":
					_mapper = new m2K();
					break;
				case "CM":
					_mapper = new mCM();
					break;
				case "CV":
					_mapper = new mCV();
					break;
				case "DPC":
					_mapper = new mDPC();
					break;
				case "DPC+":
					_mapper = new mDPCPlus();
					break;
				case "F8":
					_mapper = new mF8();
					break;
				case "F8SC":
					_mapper = new mF8SC();
					break;
				case "F6":
					_mapper = new mF6();
					break;
				case "F6SC":
					_mapper = new mF6SC();
					break;
				case "F4":
					_mapper = new mF4();
					break;
				case "F4SC":
					_mapper = new mF4SC();
					break;
				case "FE":
					_mapper = new mFE();
					break;
				case "E0":
					_mapper = new mE0();
					break;
				case "3F":
					_mapper = new m3F();
					break;
				case "FA":
					_mapper = new mFA();
					break;
				case "FA2":
					_mapper = new mFA2();
					break;
				case "E7":
					_mapper = new mE7();
					break;
				case "F0":
					_mapper = new mF0();
					break;
				case "UA":
					_mapper = new mUA();
					break;

				// Homebrew mappers
				case "3E":
					_mapper = new m3E();
					break;
				case "0840":
					_mapper = new m0840();
					break;
				case "MC":
					_mapper = new mMC();
					break;
				case "EF":
					_mapper = new mEF();
					break;
				case "EFSC":
					_mapper = new mEFSC();
					break;
				case "X07":
					_mapper = new mX07();
					break;
				case "4A50":
					_mapper = new m4A50();
					break;
				case "SB":
					_mapper = new mSB();
					break;

				default:
					throw new InvalidOperationException("mapper not supported: " + _game.GetOptionsDict()["m"]);
			}

			_mapper.Core = this;

			_lagcount = 0;
			Cpu = new MOS6502X
			{
				ReadMemory = this.ReadMemory,
				WriteMemory = this.WriteMemory,
				PeekMemory = this.PeekMemory,
				DummyReadMemory = this.ReadMemory,
				OnExecFetch = this.ExecFetch
			};

			if (_game["PAL"])
			{
				_pal = true;
			}
			else if (_game["NTSC"])
			{
				_pal = false;
			}
			else
			{
				_pal = DetectPal(_game, Rom);
			}

			_tia = new TIA(this, _pal, Settings.SECAMColors);
			_tia.GetFrameRate(out CoreComm.VsyncNum, out CoreComm.VsyncDen);

			// dcfilter coefficent is from real observed hardware behavior: a latched "1" will fully decay by ~170 or so tia sound cycles
			_dcfilter = DCFilter.AsISoundProvider(_tia, 256);

			M6532 = new M6532(this);

			// Set up the system state here. for instance..
			// Read from the reset vector for where to start
			Cpu.PC = (ushort)(ReadMemory(0x1FFC) + (ReadMemory(0x1FFD) << 8)); // set the initial PC

			// Show mapper class on romstatusdetails
			CoreComm.RomStatusDetails =
				string.Format(
					"{0}\r\nSHA1:{1}\r\nMD5:{2}\r\nMapper Impl \"{3}\"",
					this._game.Name,
					Rom.HashSHA1(),
					Rom.HashMD5(),
					_mapper.GetType());
		}