Exemplo n.º 1
0
        public void HardReset()
        {
            in_vblank     = true;         // we start off in vblank since the LCD is off
            in_vblank_old = true;

            RAM_Bank = 1;             // RAM bank always starts as 1 (even writing zero still sets 1)

            ppu.Reset();
            serialport.Reset();

            cpu.SetCallbacks(ReadMemory, PeekMemory, PeekMemory, WriteMemory);

            _vidbuffer   = new int[VirtualWidth * VirtualHeight];
            frame_buffer = new int[VirtualWidth * VirtualHeight];
        }
Exemplo n.º 2
0
        public void HardReset()
        {
            in_vblank     = true;         // we start off in vblank since the LCD is off
            in_vblank_old = true;

            // bank switching carts expect to be in upper bank on boot up, so can't have 0 at ports
            WritePort(1, 0xFF);
            WritePort(2, 0xFF);

            ppu.Reset();
            serialport.Reset();

            cpu.SetCallbacks(ReadMemory, PeekMemory, PeekMemory, WriteMemory);

            _vidbuffer   = new int[372 * 240];
            frame_buffer = new int[320 * 240];
        }
Exemplo n.º 3
0
        public O2Hawk(CoreComm comm, GameInfo game, byte[] rom, O2Settings settings, O2SyncSettings syncSettings)
        {
            var ser = new BasicServiceProvider(this);

            cpu = new I8048
            {
                ReadMemory      = ReadMemory,
                WriteMemory     = WriteMemory,
                PeekMemory      = PeekMemory,
                DummyReadMemory = ReadMemory,
                ReadPort        = ReadPort,
                WritePort       = WritePort,
                OnExecFetch     = ExecFetch,
            };

            _settings     = settings ?? new O2Settings();
            _syncSettings = syncSettings ?? new O2SyncSettings();

            is_G7400 = _syncSettings.G7400_Enable;

            _controllerDeck = new O2HawkControllerDeck("O2 Controller", "O2 Controller", is_G7400);

            _bios = comm.CoreFileProvider.GetFirmwareOrThrow(new("O2", is_G7400 ? "BIOS-G7400" : "BIOS-O2"), "BIOS Not Found, Cannot Load");

            Buffer.BlockCopy(rom, 0x100, header, 0, 0x50);

            Console.WriteLine("MD5: " + rom.HashMD5(0, rom.Length));
            Console.WriteLine("SHA1: " + rom.HashSHA1(0, rom.Length));
            _rom = rom;

            if (game["XROM"])
            {
                is_XROM = true;
            }
            Setup_Mapper();

            _frameHz = 60;

            ser.Register <IVideoProvider>(this);
            ServiceProvider = ser;

            _tracer = new TraceBuffer(cpu.TraceHeader);
            ser.Register(_tracer);
            ser.Register <IStatable>(new StateSerializer(SyncState));
            SetupMemoryDomains();
            cpu.SetCallbacks(ReadMemory, PeekMemory, PeekMemory, WriteMemory);

            // set up differences between PAL and NTSC systems
            if ((game.Region == "US" || game.Region == "EU-US" || game.Region == null) && !is_G7400)
            {
                is_pal     = false;
                pic_height = 240;
                _frameHz   = 60;

                ppu = new NTSC_PPU();
            }
            else
            {
                is_pal     = true;
                pic_height = 240;
                _frameHz   = 50;
                ppu        = new PAL_PPU();
            }

            ppu.Core = this;
            ppu.set_region(is_pal, is_G7400);
            ser.Register <ISoundProvider>(ppu);

            _vidbuffer   = new int[372 * pic_height];
            frame_buffer = new int[320 * pic_height];

            HardReset();
        }
Exemplo n.º 4
0
        public O2Hawk(CoreComm comm, GameInfo game, byte[] rom, /*string gameDbFn,*/ object settings, object syncSettings)
        {
            var ser = new BasicServiceProvider(this);

            cpu = new I8048
            {
                ReadMemory      = ReadMemory,
                WriteMemory     = WriteMemory,
                PeekMemory      = PeekMemory,
                DummyReadMemory = ReadMemory,
                ReadPort        = ReadPort,
                WritePort       = WritePort,
                OnExecFetch     = ExecFetch,
            };

            _settings       = (O2Settings)settings ?? new O2Settings();
            _syncSettings   = (O2SyncSettings)syncSettings ?? new O2SyncSettings();
            _controllerDeck = new O2HawkControllerDeck("O2 Controller", "O2 Controller");

            ppu = new PPU();

            _bios = comm.CoreFileProvider.GetFirmware("O2", "BIOS", true, "BIOS Not Found, Cannot Load")
                    ?? throw new MissingFirmwareException("Missing Odyssey2 Bios");

            Buffer.BlockCopy(rom, 0x100, header, 0, 0x50);

            Console.WriteLine("MD5: " + rom.HashMD5(0, rom.Length));
            Console.WriteLine("SHA1: " + rom.HashSHA1(0, rom.Length));
            _rom = rom;
            Setup_Mapper();

            _frameHz = 60;

            ppu.Core = this;
            cpu.Core = this;

            ser.Register <IVideoProvider>(this);
            ser.Register <ISoundProvider>(ppu);
            ServiceProvider = ser;

            _settings     = (O2Settings)settings ?? new O2Settings();
            _syncSettings = (O2SyncSettings)syncSettings ?? new O2SyncSettings();

            _tracer = new TraceBuffer {
                Header = cpu.TraceHeader
            };
            ser.Register(_tracer);
            ser.Register <IStatable>(new StateSerializer(SyncState));
            SetupMemoryDomains();
            cpu.SetCallbacks(ReadMemory, PeekMemory, PeekMemory, WriteMemory);

            HardReset();

            // set up differences between PAL and NTSC systems
            is_pal     = true;
            pic_height = 288;
            _frameHz   = 50;

            if (game.Region == "US" || game.Region == "EU-US" || game.Region == null)
            {
                is_pal     = false;
                pic_height = 240;
                _frameHz   = 60;
            }

            ppu.set_region(is_pal);

            _vidbuffer   = new int[372 * pic_height];
            frame_buffer = new int[320 * pic_height];
        }