コード例 #1
0
ファイル: EmuGB.cs プロジェクト: fattard/xFF
                public EmuGB(ConfigsGB aConfigs)
                {
                    m_configs = aConfigs;

                    m_cpu = new CPU();
                    m_ppu = new PPU();
                    m_apu = new APU();

                    m_mem             = new MEM();
                    m_dmaController   = new DMAController();
                    m_timerController = new TimerController();

                    m_joypad = new Joypad();

                    m_serialIO = new SerialIO();

                    // Start paused
                    m_paused = true;

                    // Temp binding
                    DrawDisplay     = (aPPU) => { };
                    DrawDisplayLine = (aPPU, aScanline) => { };


                    m_mem.AttachCPU(m_cpu);
                    m_mem.AttachPPU(m_ppu);
                    m_mem.AttachAPU(m_apu);
                    m_mem.AttachDMAController(m_dmaController);
                    m_mem.AttachTimerController(m_timerController);
                    m_mem.AttachJoypad(m_joypad);
                    m_mem.AttachSerialIO(m_serialIO);
                    m_cpu.ProcessorState.BindCyclesStep(m_ppu.CyclesStep);
                    m_cpu.ProcessorState.BindCyclesStep(m_apu.CyclesStep);
                    m_cpu.ProcessorState.BindCyclesStep(m_dmaController.CyclesStep);
                    m_cpu.ProcessorState.BindCyclesStep(m_timerController.CyclesStep);
                    m_cpu.ProcessorState.BindCyclesStep(m_serialIO.CyclesStep);

                    m_ppu.BindRequestIRQ(m_cpu.RequestIRQ);
                    m_timerController.BindRequestIRQ(m_cpu.RequestIRQ);
                    m_joypad.BindRequestIRQ(m_cpu.RequestIRQ);
                    m_serialIO.BindRequestIRQ(m_cpu.RequestIRQ);
                    //m_ppu.BindDrawDisplayLine(DrawDisplayLine);
                }