コード例 #1
0
ファイル: GameBoy.cs プロジェクト: zeralph/GameBoyEmu
//        private static bool m_debugContextInitalized = false;

        public GameBoy()
        {
            m_parameters = new CParameters();
            LoadParameters();
            m_DebugThread = new System.Threading.Thread(DebuggerThread);
            m_DebugThread.Start();
//          m_debugContextInitalized = false;

            m_timer = new GameBoyTest.MicroTimer.MicroTimer();

            m_BGScreen     = new GBScreenForm(GameBoy.Ram);
            m_memory       = new MappedMemory();
            m_cartridge    = new Cartridge();
            m_sbDebug      = new SB_Debug();
            m_inputsMgr    = new InputsMgr();
            m_video        = new GBVideo(m_BGScreen);
            m_soundManager = new SoundManager();
            m_cpu          = new Z80Cpu(m_timer);

            m_bDebuggerEnabled = false;

            m_cpu.Init();
            m_video.Init();
            m_sbDebug.Init();
            //sDebugReady = false;

            //m_cpu.Start();
            m_video.Start();
            Application.Run();
            System.Windows.Forms.Application.Exit();
        }
コード例 #2
0
ファイル: Z80Cpu.cs プロジェクト: zeralph/GameBoyEmu
        //////////////////////////////////////////////////////////////////////
        //
        //////////////////////////////////////////////////////////////////////
        public Z80Cpu(GameBoyTest.MicroTimer.MicroTimer timer)
        {
            m_timer          = timer; //new GameBoyTest.MicroTimer.MicroTimer();// new System.Timers.Timer();
            m_timer.Interval = (long)(GAMEBOY_DEFAULT_CLOCK_SPEED_MS * 1000);
            //m_timer.AutoReset = false;
            //m_timer.Elapsed += new ElapsedEventHandler(OnCpuTick);
            m_timer.MicroTimerElapsed += new GameBoyTest.MicroTimer.MicroTimer.MicroTimerElapsedEventHandler(OnCpuTick);

            m_decoder       = new Z80InstructionDecoder();
            m_interruptsMgr = new InterruptsMgr();
            m_cpuTimer      = new CpuTimer();

            m_curInstructionNbCycles = 0;
            m_curInstructionCurCycle = 0;
            m_curInstruction         = null;

            m_clockCnt              = 0;
            m_CpuTick               = 0;
            m_controlTimer          = new System.Timers.Timer();
            m_controlTimer.Interval = 100;
            m_controlTimer.Elapsed += new ElapsedEventHandler(ControlTimerElapsed);
            m_controlTimer.Enabled  = true; // Enable it
            m_ImeFlag               = false;
            m_stopWatch             = new Stopwatch();
            m_timer.Start();
        }