Exemple #1
0
        private void UpdateDebugger()
        {
            if (InteropEmu.DebugIsCodeChanged())
            {
                string code = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(InteropEmu.DebugGetCode());
                ctrlDebuggerCode.Code      = code;
                ctrlDebuggerCodeSplit.Code = code;
            }

            DebugState state = new DebugState();

            InteropEmu.DebugGetState(ref state);

            if (UpdateSplitView())
            {
                ctrlDebuggerCodeSplit.UpdateCode(true);
            }
            else
            {
                _lastCodeWindow = ctrlDebuggerCode;
            }

            ctrlDebuggerCode.SelectActiveAddress(state.CPU.DebugPC);
            ctrlDebuggerCodeSplit.SetActiveAddress(state.CPU.DebugPC);
            RefreshBreakpoints();

            ctrlConsoleStatus.UpdateStatus(ref state);
            ctrlWatch.UpdateWatch();
            ctrlCallstack.UpdateCallstack();

            ctrlCpuMemoryMapping.UpdateCpuRegions(state.Cartridge);
            ctrlPpuMemoryMapping.UpdatePpuRegions(state.Cartridge);

            this.BringToFront();
        }
Exemple #2
0
        public void UpdateDebugger(bool updateActiveAddress = true, bool bringToFront = true)
        {
            if (!_debuggerInitialized)
            {
                return;
            }

            ctrlBreakpoints.RefreshListAddresses();
            ctrlLabelList.UpdateLabelListAddresses();
            ctrlFunctionList.UpdateFunctionList(false);
            UpdateDebuggerFlags();
            UpdateVectorAddresses();

            string newCode = InteropEmu.DebugGetCode(_firstBreak);

            if (newCode != null)
            {
                ctrlDebuggerCode.Code = newCode;
            }

            DebugState state = new DebugState();

            InteropEmu.DebugGetState(ref state);

            lblCyclesElapsedCount.Text = (state.CPU.CycleCount - _previousCycle).ToString();
            _previousCycle             = state.CPU.CycleCount;

            if (UpdateSplitView())
            {
                if (newCode != null || ctrlDebuggerCodeSplit.Code == null)
                {
                    ctrlDebuggerCodeSplit.Code = ctrlDebuggerCode.Code;
                }
                ctrlDebuggerCodeSplit.UpdateCode(true);
            }
            else
            {
                _lastCodeWindow = ctrlDebuggerCode;
            }

            if (updateActiveAddress)
            {
                _lastCodeWindow.SelectActiveAddress(state.CPU.DebugPC);
            }

            ctrlDebuggerCode.SetActiveAddress(state.CPU.DebugPC);
            ctrlDebuggerCode.UpdateLineColors();

            if (UpdateSplitView())
            {
                ctrlDebuggerCodeSplit.SetActiveAddress(state.CPU.DebugPC);
                ctrlDebuggerCodeSplit.UpdateLineColors();
            }

            ctrlConsoleStatus.UpdateStatus(ref state);
            ctrlWatch.UpdateWatch();
            ctrlCallstack.UpdateCallstack();

            ctrlCpuMemoryMapping.UpdateCpuRegions(state.Cartridge);
            ctrlPpuMemoryMapping.UpdatePpuRegions(state.Cartridge);

            if (bringToFront)
            {
                this.BringToFront();
            }

            if (_firstBreak)
            {
                InteropEmu.SetFlag(EmulationFlags.ForceMaxSpeed, false);
                if (!ConfigManager.Config.DebugInfo.BreakOnOpen)
                {
                    ResumeExecution();
                }
                _firstBreak = false;
            }
        }