Ejemplo n.º 1
0
        protected override void OnCellValueNeeded(DataGridViewCellValueEventArgs e)
        {
            if (e.RowIndex > _cp.MicrocodeRam.Length)
            {
                // Past end of microcode, nothing to do.
                base.OnCellValueNeeded(e);
                return;
            }

            switch (e.ColumnIndex)
            {
            case 0:
            {
                ushort address = (ushort)e.RowIndex;

                e.Value = BreakpointManager.GetBreakpoint(BreakpointProcessor.CP, address) != BreakpointType.None;
            }
            break;

            case 1:
                e.Value = String.Format("{0:x3}", e.RowIndex);
                break;

            case 2:
                e.Value = new Microinstruction(_cp.MicrocodeRam[e.RowIndex]).Disassemble(-1);
                break;

            default:
                throw new InvalidOperationException("Unhandled column.");
            }

            base.OnCellValueNeeded(e);
        }
Ejemplo n.º 2
0
        protected override void OnCellValueChanged(DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex > _cp.MicrocodeRam.Length)
            {
                base.OnCellValueChanged(e);
                return;
            }

            switch (e.ColumnIndex)
            {
            case 0:         // breakpoint
            {
                // grab the check value
                bool cellValue = (bool)this.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue;

                if (cellValue)
                {
                    BreakpointManager.SetBreakpoint(new BreakpointEntry(BreakpointProcessor.CP, BreakpointType.Execution, (ushort)e.RowIndex));
                }
                else
                {
                    BreakpointManager.SetBreakpoint(new BreakpointEntry(BreakpointProcessor.CP, BreakpointType.None, (ushort)e.RowIndex));
                }
            }
            break;
            }

            base.OnCellValueChanged(e);
        }
Ejemplo n.º 3
0
        private bool StepCallbackMesa()
        {
            bool stopExecution = _singleStepMesa;

            if (!_system.CP.IOPWait)
            {
                // Check for execution breakpoints
                int mesaPC = ((((_system.CP.RH[5] & 0xf) << 16) | _system.CP.ALU.R[5]) << 1) | (_system.CP.PC16 ? 1 : 0);
                if (BreakpointManager.TestBreakpoint(BreakpointProcessor.Mesa, BreakpointType.Execution, mesaPC))
                {
                    BeginInvoke(new StatusDelegate(RefreshPostExecution), String.Format("* Mesa Execution breakpoint hit at PC=0x{0:x6} *", mesaPC));
                    stopExecution = true;
                }
            }

            return(stopExecution);
        }
Ejemplo n.º 4
0
        protected override void OnCellValueNeeded(DataGridViewCellValueEventArgs e)
        {
            if (e.RowIndex > _source.Count)
            {
                // Past end of source, nothing to do.
                return;
            }

            switch (e.ColumnIndex)
            {
            case 0:
            {
                ushort address          = 0;
                bool   addressAvailable = _sourceMap != null?_sourceMap.GetAddressForSource(new SourceEntry(_currentSourceFile, new string[] { }, 0, e.RowIndex), out address) : false;

                if (addressAvailable)
                {
                    e.Value = BreakpointManager.GetBreakpoint(_iopCode ? BreakpointProcessor.IOP : BreakpointProcessor.CP, address) != BreakpointType.None;
                }
                else
                {
                    e.Value = false;                // TODO: hook to breakpoint system
                }
            }
            break;

            case 1:
            {
                ushort address          = 0;
                bool   addressAvailable = _sourceMap != null?_sourceMap.GetAddressForSource(new SourceEntry(_currentSourceFile, new string[] { }, 0, e.RowIndex), out address) : false;

                e.Value = addressAvailable ? String.Format("${0:x4}", address) : String.Empty;
            }
            break;

            case 2:
                e.Value = _source[e.RowIndex];
                break;

            default:
                throw new InvalidOperationException("Unhandled column.");
            }

            base.OnCellValueNeeded(e);
        }
Ejemplo n.º 5
0
        private bool StepCallback8085()
        {
            bool stopExecution = _singleStepIOP;

            // Check for execution breakpoints
            if (BreakpointManager.TestBreakpoint(BreakpointProcessor.IOP, BreakpointType.Execution, _system.IOP.CPU.PC))
            {
                BeginInvoke(new StatusDelegate(RefreshPostExecution), String.Format("* IOP Execution breakpoint hit at PC=${0:x4} *", _system.IOP.CPU.PC));
                stopExecution = true;
            }

            // IOP processor still running?
            if (_system.IOP.CPU.Halted)
            {
                BeginInvoke(new StatusDelegate(RefreshPostExecution), String.Format("* 8085 halted at PC=${0:x4} *", _system.IOP.CPU.PC));
                stopExecution = true;
            }

            return(stopExecution);
        }
Ejemplo n.º 6
0
        private bool StepCallbackCP()
        {
            bool stopExecution = false;

            if (!_debugSpecificTask)
            {
                // Stop after every step
                stopExecution = _singleStepCP;
            }
            else
            {
                //
                // Stop only if the current task is the task we're debugging or we've exhausted our cycle count
                // waiting for the task to wake up again.
                //
                _stepCount++;

                stopExecution = _singleStepCP && (_system.CP.CurrentTask == _debugTask || _stepCount > 1000);

                if (_stepCount > 1000)
                {
                    BeginInvoke(new StatusDelegate(RefreshPostExecution), String.Format("Timeout waiting for task {0} to wake.", _debugTask));
                }
            }

            if (!_system.CP.IOPWait)
            {
                // Check for execution breakpoints
                int tpc = _system.CP.TPC[(int)_system.CP.CurrentTask];
                if (BreakpointManager.TestBreakpoint(BreakpointProcessor.CP, BreakpointType.Execution, (ushort)tpc))
                {
                    BeginInvoke(new StatusDelegate(RefreshPostExecution), String.Format("* CP Execution breakpoint hit at TPC=0x{0:x3} *", tpc));
                    stopExecution = true;
                }
            }

            return(stopExecution);
        }
Ejemplo n.º 7
0
        protected override void OnCellValueChanged(DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex > _source.Count)
            {
                base.OnCellValueChanged(e);
                return;
            }

            switch (e.ColumnIndex)
            {
            case 0:         // breakpoint
            {
                // grab the check value
                bool cellValue = (bool)this.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue;

                ushort address          = 0;
                bool   addressAvailable = _sourceMap != null?_sourceMap.GetAddressForSource(new SourceEntry(_currentSourceFile, new string[] { }, 0, e.RowIndex), out address) : false;

                if (addressAvailable)
                {
                    if (cellValue)
                    {
                        BreakpointManager.SetBreakpoint(new BreakpointEntry(_iopCode ? BreakpointProcessor.IOP : BreakpointProcessor.CP, BreakpointType.Execution, address));
                    }
                    else
                    {
                        BreakpointManager.SetBreakpoint(new BreakpointEntry(_iopCode ? BreakpointProcessor.IOP : BreakpointProcessor.CP, BreakpointType.None, address));
                    }
                }
            }
            break;

            case 1:         // address
            {
                string oldCellValue = ((string)this.Rows[e.RowIndex].Cells[e.ColumnIndex].Value).Trim();

                string[] symbolTokens = ((string)this.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue).Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                if (symbolTokens.Length > 2)
                {
                    MessageBox.Show("Invalid syntax.");
                    return;
                }

                if (oldCellValue.StartsWith("$"))
                {
                    oldCellValue = oldCellValue.Substring(1);
                }

                if (symbolTokens.Length == 0)
                {
                    // cell is empty, delete the current source map entry if present.
                    // TODO: use source map for this instead?

                    if (_sourceMap != null && !string.IsNullOrEmpty(oldCellValue))
                    {
                        ushort oldAddress = Convert.ToUInt16(oldCellValue, 16);
                        _sourceMap.RemoveSourceEntry(new SourceEntry(_currentSourceFile, new string[] { }, oldAddress, e.RowIndex));
                    }
                    return;
                }

                //
                // Valid new cell value.
                //
                string cellValue  = symbolTokens[0];
                string symbolName = symbolTokens.Length == 2 ? symbolTokens[1] : "*none*";

                // strip leading $ if any.
                if (cellValue.StartsWith("$"))
                {
                    cellValue = cellValue.Substring(1);
                }

                try
                {
                    ushort address    = Convert.ToUInt16(cellValue, 16);
                    ushort oldAddress = string.IsNullOrWhiteSpace(oldCellValue) ? (ushort)0 : Convert.ToUInt16(oldCellValue, 16);

                    if (_sourceMap != null && address != oldAddress)
                    {
                        //
                        // Set the new value first.
                        //
                        _sourceMap.AddSourceEntry(new SourceEntry(_currentSourceFile, new string[] { symbolName }, address, e.RowIndex));

                        //
                        // Remove the old value from the database if there is one.
                        //
                        if (!string.IsNullOrWhiteSpace(oldCellValue))
                        {
                            _sourceMap.RemoveSourceEntry(new SourceEntry(_currentSourceFile, new string[] { }, oldAddress, e.RowIndex));
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Hey!");
                    // Invalid value, clear it.
                    // this.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = String.Empty;
                }
            }
            break;
            }


            base.OnCellValueChanged(e);
        }
Ejemplo n.º 8
0
 private void ClearMesaBreakpoint(int address)
 {
     BreakpointManager.SetBreakpoint(new BreakpointEntry(BreakpointProcessor.Mesa, BreakpointType.None, address));
 }
Ejemplo n.º 9
0
 private void SetMesaBreakpoint(int address)
 {
     BreakpointManager.SetBreakpoint(new BreakpointEntry(BreakpointProcessor.Mesa, BreakpointType.Execution, address));
 }