Пример #1
0
        private void SetBreakpointFromCellClickForDisassemblyView(MicrocodeBank bank, int index)
        {
            DataGridView view = null;

            switch (bank)
            {
            case MicrocodeBank.RAM0:
                view = _rom0SourceViewer;
                break;

            case MicrocodeBank.RAM1:
                view = _ram1SourceViewer;
                break;

            case MicrocodeBank.RAM2:
                view = _ram2SourceViewer;
                break;

            default:
                throw new InvalidOperationException("Bank does not have a disassembly view.");
            }

            // Set/unset the breakpoint
            bool value = (bool)view.Rows[index].Cells[0].Value;

            view.Rows[index].Cells[0].Value = !value;

            ModifyMicrocodeBreakpoint(bank, (UInt16)index, !value);
        }
Пример #2
0
        private void SetBreakpointFromCellClickForSourceView(MicrocodeBank bank, int index)
        {
            DataGridView view = null;

            switch (bank)
            {
            case MicrocodeBank.ROM0:
                view = _rom0SourceViewer;
                break;

            case MicrocodeBank.ROM1:
                view = _rom1SourceViewer;
                break;

            default:
                throw new InvalidOperationException("Bank does not have a source view.");
            }

            // See if this is a source line, if so check/uncheck the box
            // and set/unset a breakpoint for the line
            if (view.Rows[index].Tag != null)
            {
                bool value = (bool)view.Rows[index].Cells[0].Value;
                view.Rows[index].Cells[0].Value = !value;

                ModifyMicrocodeBreakpoint(bank, (UInt16)view.Rows[index].Tag, !value);
            }
        }
Пример #3
0
        private static void Init()
        {
            //
            // Max 3 banks of microcode RAM
            _uCodeRam = new UInt32[1024 * 3];

            if (Configuration.SystemType == SystemType.AltoI)
            {
                LoadAltoIMicrocode(_uCodeRomsAltoI);
            }
            else
            {
                LoadAltoIIMicrocode(_uCodeRomsAltoII);
            }

            //
            // Cache 5k of instructions: max 2K ROM, 3K RAM.
            _decodeCache = new MicroInstruction[1024 * 5];

            // Precache ROM
            CacheMicrocodeROM();

            // Precache (empty) RAM
            for (ushort i = 0; i < _uCodeRam.Length; i++)
            {
                UpdateRAMCache(i);
            }

            // Start in ROM0
            _microcodeBank = new MicrocodeBank[16];
            _ramAddr       = 0;
            _ramBank       = 0;
            _ramSelect     = true;
            _lowHalfsel    = true;

            // Cache the system type from the configuration
            _systemType = Configuration.SystemType;
        }
Пример #4
0
        public void LoadSourceCode(MicrocodeBank bank, string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(path, "Microcode path must be specified.");
            }

            DataGridView view = bank == MicrocodeBank.ROM0 ? _rom0SourceViewer : _rom1SourceViewer;

            using (StreamReader sr = new StreamReader(path))
            {
                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();

                    SourceLine src = new SourceLine(line);

                    int i = view.Rows.Add(
                        false,  // breakpoint
                        GetTextForTask(src.Task),
                        src.Address,
                        src.Text);

                    // Give the row a color based on the task
                    view.Rows[i].DefaultCellStyle.BackColor = GetColorForTask(src.Task);

                    // Tag the row based on the PROM address (if any) to make it easy to find.
                    if (!String.IsNullOrEmpty(src.Address))
                    {
                        view.Rows[i].Tag = Convert.ToUInt16(src.Address, 8);
                    }
                }
            }

            // Ensure the UI view gets refreshed to display the current MPC source
            Refresh();
        }
Пример #5
0
 private bool GetMicrocodeBreakpoint(MicrocodeBank bank, UInt16 address)
 {
     return(_microcodeBreakpointEnabled[(int)bank, address]);
 }
Пример #6
0
 private void ModifyMicrocodeBreakpoint(MicrocodeBank bank, UInt16 address, bool set)
 {
     _microcodeBreakpointEnabled[(int)bank, address] = set;
 }
Пример #7
0
        private void RefreshUI()
        {
            // Registers
            for (int i = 0; i < 32; i++)
            {
                _registerData.Rows[i].Cells[0].Value = Conversion.ToOctal(i, 2);
                _registerData.Rows[i].Cells[1].Value = Conversion.ToOctal(_system.CPU.R[i], 6);
                _registerData.Rows[i].Cells[2].Value = Conversion.ToOctal(_system.CPU.S[0][i], 6);
            }

            // Tasks
            for (int i = 0; i < 16; i++)
            {
                _taskData.Rows[i].Cells[0].Value = GetTextForTask((TaskType)i);
                _taskData.Rows[i].Cells[1].Value = GetTextForTaskState(_system.CPU.Tasks[i]);
                _taskData.Rows[i].Cells[2].Value = GetTextForTaskBank(_system.CPU.Tasks[i]);
                _taskData.Rows[i].Cells[3].Value =
                    _system.CPU.Tasks[i] != null?Conversion.ToOctal(_system.CPU.Tasks[i].MPC, 4) : String.Empty;
            }

            // Other registers
            _otherRegs.Rows[0].Cells[1].Value = Conversion.ToOctal(_system.CPU.L, 6);
            _otherRegs.Rows[1].Cells[1].Value = Conversion.ToOctal(_system.CPU.T, 6);
            _otherRegs.Rows[2].Cells[1].Value = Conversion.ToOctal(_system.CPU.M, 6);
            _otherRegs.Rows[3].Cells[1].Value = Conversion.ToOctal(_system.CPU.IR, 6);
            _otherRegs.Rows[4].Cells[1].Value = Conversion.ToOctal(_system.CPU.ALUC0, 1);
            _otherRegs.Rows[5].Cells[1].Value = Conversion.ToOctal(_system.MemoryBus.MAR, 6);
            _otherRegs.Rows[6].Cells[1].Value = Conversion.ToOctal(_system.MemoryBus.MDLow, 6);
            _otherRegs.Rows[7].Cells[1].Value = Conversion.ToOctal(_system.MemoryBus.MDHigh, 6);
            _otherRegs.Rows[8].Cells[1].Value = Conversion.ToOctal(_system.MemoryBus.MDWrite, 6);
            _otherRegs.Rows[9].Cells[1].Value = Conversion.ToOctal(_system.MemoryBus.Cycle & 0x3f, 2);

            // Reserved memory locations
            for (int i = 0; i < _reservedMemoryEntries.Length; i++)
            {
                _reservedMemory.Rows[i].Cells[2].Value =
                    Conversion.ToOctal(_system.MemoryBus.DebugReadWord(_reservedMemoryEntries[i].Address), 6);
            }

            //
            // Select active tab based on current UCode bank
            MicrocodeBank bank = UCodeMemory.GetBank(_system.CPU.CurrentTask.TaskType);

            switch (bank)
            {
            case MicrocodeBank.ROM0:
                SourceTabs.SelectedIndex = 0;
                break;

            case MicrocodeBank.ROM1:
                SourceTabs.SelectedIndex = 1;
                break;

            case MicrocodeBank.RAM0:
                SourceTabs.SelectedIndex = 2;
                break;
            }

            RefreshMicrocodeDisassembly(_system.CPU.CurrentTask.MPC);

            // Highlight the nova memory location corresponding to the emulator PC.
            // TODO: this should be configurable
            ushort pc = _system.CPU.R[6];

            HighlightNovaSourceLine(pc);

            // Exec state
            switch (_execState)
            {
            case ExecutionState.Stopped:
                ExecutionStateLabel.Text = "Stopped";
                break;

            case ExecutionState.SingleStep:
                ExecutionStateLabel.Text = "Stepping";
                break;

            case ExecutionState.AutoStep:
                ExecutionStateLabel.Text = "Stepping (auto)";
                break;

            case ExecutionState.Running:
                ExecutionStateLabel.Text = "Running";
                break;

            case ExecutionState.BreakpointStop:
                ExecutionStateLabel.Text = "Stopped (bkpt)";
                break;

            case ExecutionState.InternalError:
                ExecutionStateLabel.Text = String.Format("Stopped (error {0})", _lastExceptionText);
                break;
            }

            this.BringToFront();
        }