示例#1
0
        public GameBoy(string romPath)
        {
            _logger = new Logger();

            _mainMemory    = new MainMemory();
            _dmaController = new DmaController(_mainMemory);

            _timer  = new Timer(_mainMemory);
            _joypad = new Joypad();

            _serialController = new SerialController(_mainMemory);

            _pixelProcessingUnit = new PixelProcessingUnit(_mainMemory, _logger);
            _audioProcessingUnit = new AudioProcessingUnit();

            IRandomAccessMemory mainMemoryProxy = new MainMemoryDmaProxy(_mainMemory, _dmaController);

            _cpuCore = new CpuCore(mainMemoryProxy, new CpuState(), _logger);

            IRomLoader romLoader = new FileRomLoader(romPath);

            _ramManager = new FileRamManager(Path.ChangeExtension(romPath, ".sav"));

            _memoryBankController = MBCFactory.CreateMBC(romLoader);
            _memoryBankController.LoadRam(_ramManager);

            _mainMemory.RegisterMemoryAccessDelegate(_memoryBankController as IMemoryAccessDelegate);
            _mainMemory.RegisterMemoryAccessDelegate(_pixelProcessingUnit);
            _mainMemory.RegisterMemoryAccessDelegate(_timer);
            _mainMemory.RegisterMemoryAccessDelegate(_joypad);
            _mainMemory.RegisterMemoryAccessDelegate(_audioProcessingUnit);
            _mainMemory.RegisterMemoryAccessDelegate(_serialController);
        }
示例#2
0
        public ExecutionUnit(IMemoryCore moduleMemory, Dictionary <ushort, IExportedModule> exportedModuleDictionary)
        {
            ModuleCpu                = new CpuCore();
            ModuleCpuRegisters       = new CpuRegisters();
            ModuleMemory             = moduleMemory;
            ExportedModuleDictionary = exportedModuleDictionary;

            ModuleCpu.Reset(ModuleMemory, ModuleCpuRegisters, ExternalFunctionDelegate);
        }
示例#3
0
        public CpuPane( Studio studio )
            : this()
        {
            Debug.Assert( studio != null );
            if( studio == null )
                throw new ArgumentNullException( "studio" );
            _studio = studio;

            this.Icon = IconUtilities.ConvertToIcon( Properties.Resources.RegistersIcon );

            _cpu = _studio.Debugger.Host.CurrentInstance.Cpu;
            _core0 = _cpu.Cores[ 0 ];

            _studio.GlobalRefreshRequested += new EventHandler( StudioGlobalRefreshRequested );

            this.generalRegistersLabel_SizeChanged( this, EventArgs.Empty );

            _useFriendlyLabels = true;
            this.friendlyCheckbox.Checked = _useFriendlyLabels;

            this.UpdateValues();
        }
示例#4
0
        public Kernel(Bios bios)
        {
            Debug.Assert(bios != null);
            Bios     = bios;
            Emulator = Bios.Emulator;

            Debug.Assert(Emulator.Cpu != null);
            Cpu          = Emulator.Cpu;
            CpuCore      = Cpu.Cores[0];
            Memory       = Cpu.Memory;
            MemorySystem = Memory.MemorySystem;

            Devices = new List <KDevice>();

            UserModules = new List <KModule>(10);

            Threads            = new List <KThread>(128);
            SchedulableThreads = new FastLinkedList <KThread>();

            Handles  = new Dictionary <uint, KHandle>();
            _lastUid = 100;

            SpeedLocked = true;
        }
示例#5
0
        public CpuPane(Studio studio)
            : this()
        {
            Debug.Assert(studio != null);
            if (studio == null)
            {
                throw new ArgumentNullException("studio");
            }
            _studio = studio;

            this.Icon = IconUtilities.ConvertToIcon(Properties.Resources.RegistersIcon);

            _cpu   = _studio.Debugger.Host.CurrentInstance.Cpu;
            _core0 = _cpu.Cores[0];

            _studio.GlobalRefreshRequested += new EventHandler(StudioGlobalRefreshRequested);

            this.generalRegistersLabel_SizeChanged(this, EventArgs.Empty);

            _useFriendlyLabels            = true;
            this.friendlyCheckbox.Checked = _useFriendlyLabels;

            this.UpdateValues();
        }