Exemplo n.º 1
0
 protected void EmitDebugTargetReached()
 {
     DebugStepMode = DebugStepMode.None;
     if (DebugTargetReached != null)
     {
         DebugTargetReached(this, EventArgs.Empty);
     }
 }
 /// <summary>
 /// Initializes the options
 /// </summary>
 /// <param name="emulationMode">Execution emulation mode</param>
 /// <param name="debugStepMode">Debugging execution mode</param>
 /// <param name="fastTapeMode">Fast tape mode</param>
 /// <param name="terminationPoint">Termination point to reach</param>
 public ExecuteCycleOptions(EmulationMode emulationMode = EmulationMode.Continuous,
                            DebugStepMode debugStepMode = DebugStepMode.StopAtBreakpoint,
                            bool fastTapeMode           = false,
                            ushort terminationPoint     = 0x0000)
 {
     EmulationMode    = emulationMode;
     DebugStepMode    = debugStepMode;
     FastTapeMode     = fastTapeMode;
     TerminationPoint = terminationPoint;
 }
 /// <summary>
 /// Initializes the options
 /// </summary>
 /// <param name="emulationMode">Execution emulation mode</param>
 /// <param name="debugStepMode">Debugging execution mode</param>
 /// <param name="fastTapeMode">Fast tape mode</param>
 /// <param name="terminationRom">ROM index of the termination point</param>
 /// <param name="terminationPoint">Termination point to reach</param>
 /// <param name="skipInterruptRoutine">
 /// Signs if maskable interrupt routine instructions should be skipped
 /// </param>
 public ExecuteCycleOptions(EmulationMode emulationMode = EmulationMode.Continuous,
                            DebugStepMode debugStepMode = DebugStepMode.StopAtBreakpoint,
                            bool fastTapeMode           = false,
                            int terminationRom          = 0x0000,
                            ushort terminationPoint     = 0x0000,
                            bool skipInterruptRoutine   = false)
 {
     EmulationMode        = emulationMode;
     DebugStepMode        = debugStepMode;
     FastTapeMode         = fastTapeMode;
     TerminationRom       = terminationRom;
     TerminationPoint     = terminationPoint;
     SkipInterruptRoutine = skipInterruptRoutine;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes the options.
 /// </summary>
 /// <param name="emulationMode">Execution emulation mode.</param>
 /// <param name="debugStepMode">Debugging execution mode.</param>
 /// <param name="fastTapeMode">Fast tape mode.</param>
 /// <param name="terminationRom">ROM index of the termination point.</param>
 /// <param name="terminationPoint">Termination point to reach.</param>
 public ExecuteCycleOptions(EmulationMode emulationMode = EmulationMode.Continuous,
                            DebugStepMode debugStepMode = DebugStepMode.StopAtBreakpoint,
                            bool fastTapeMode           = false,
                            int terminationRom          = 0x0000,
                            ushort terminationPoint     = 0x0000,
                            bool fastVmMode             = false,
                            long timeoutTacts           = 0,
                            bool disableScreenRendering = false)
 {
     EmulationMode          = emulationMode;
     DebugStepMode          = debugStepMode;
     FastTapeMode           = fastTapeMode;
     TerminationRom         = terminationRom;
     TerminationPoint       = terminationPoint;
     FastVmMode             = fastVmMode;
     TimeoutTacts           = timeoutTacts;
     DisableScreenRendering = disableScreenRendering;
 }
Exemplo n.º 5
0
 protected void EmitDebugTargetReached()
 {
     DebugStepMode = DebugStepMode.None;
     if (DebugTargetReached != null)
         DebugTargetReached(this, EventArgs.Empty);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Checks whether the execution cycle should be stopped for debugging
        /// </summary>
        /// <param name="stepMode">Debug setp mode</param>
        /// <param name="executedInstructionCount">
        /// The count of instructions already executed in this cycle
        /// </param>
        /// <returns>True, if the execution should be stopped</returns>
        private bool IsDebugStop(DebugStepMode stepMode, int executedInstructionCount)
        {
            // --- No debug provider, no stop
            if (DebugInfoProvider == null)
            {
                return(false);
            }

            // --- In Step-Into mode we always stop when we're about to
            // --- execute the next instruction
            if (stepMode == DebugStepMode.StepInto)
            {
                return(executedInstructionCount > 0);
            }

            // --- In Stop-At-Breakpoint mode we stop only if a predefined
            // --- breakpoint is reached
            if (stepMode == DebugStepMode.StopAtBreakpoint &&
                DebugInfoProvider.Breakpoints.ContainsKey(Cpu.Registers.PC))
            {
                // --- We do not stop unless we executed at least one instruction
                return(executedInstructionCount > 0);
            }

            // --- We're in Step-Over mode
            if (stepMode == DebugStepMode.StepOver)
            {
                if (DebugInfoProvider.ImminentBreakpoint != null)
                {
                    // --- We also stop, if an imminent breakpoint is reached, and also remove
                    // --- this breakpoint
                    if (DebugInfoProvider.ImminentBreakpoint == Cpu.Registers.PC)
                    {
                        DebugInfoProvider.ImminentBreakpoint = null;
                        return(true);
                    }
                }
                else
                {
                    var imminentJustCreated = false;

                    // --- We check for a CALL-like instruction
                    var length = Cpu.GetCallInstructionLength();
                    if (length > 0)
                    {
                        // --- Its a CALL-like instraction, create an imminent breakpoint
                        DebugInfoProvider.ImminentBreakpoint = (ushort)(Cpu.Registers.PC + length);
                        imminentJustCreated = true;
                    }

                    // --- We stop, we executed at least one instruction and if there's no imminent
                    // --- breakpoint or we've just created one
                    if (executedInstructionCount > 0 &&
                        (DebugInfoProvider.ImminentBreakpoint == null || imminentJustCreated))
                    {
                        return(true);
                    }
                }
            }

            // --- In any other case, we carry on
            return(false);
        }