Ejemplo n.º 1
0
        /// <summary>
        /// Reads a word from the specified address.
        /// </summary>
        /// <param name="address"></param>
        /// <param name="extendedMemory"></param>
        /// <returns></returns>
        public ushort Read(int address, TaskType task, bool extendedMemory)
        {
            // debug for kaehler's music st
            Log.Write(LogType.Verbose, LogComponent.Music, "MUSIC (I/O) read from {0} by task {1} (bank {2}), Nova PC {3}",
                      Conversion.ToOctal(address),
                      task,
                      UCodeMemory.GetBank(task),
                      Conversion.ToOctal(_system.CPU.R[6]));

            if (address == 0xfffe)
            {
                return(_lastDac);
            }
            else
            {
                _foo = !_foo;

                if (!_foo)
                {
                    return(0x800);
                }
                else
                {
                    return(0);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Writes a word to the specified address.
 /// </summary>
 /// <param name="address"></param>
 /// <param name="data"></param>
 public void Load(int address, ushort data, TaskType task, bool extendedMemory)
 {
     // The registers are write-only as far as I've been able to ascertain.
     Log.Write(LogType.Verbose, LogComponent.Organ, "Unexpected organ write to {0} ({1}) by task {2} (bank {3})",
               Conversion.ToOctal(address),
               Conversion.ToOctal(data),
               task,
               UCodeMemory.GetBank(task));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Reads a word from the specified address.
        /// </summary>
        /// <param name="address"></param>
        /// <param name="extendedMemory"></param>
        /// <returns></returns>
        public ushort Read(int address, TaskType task, bool extendedMemory)
        {
            Log.Write(LogType.Verbose, LogComponent.Organ, "Organ read from {0} by task {1} (bank {2}), Nova PC {3}",
                      Conversion.ToOctal(address),
                      task,
                      UCodeMemory.GetBank(task),
                      Conversion.ToOctal(_system.CPU.R[6]));

            return(_keyData[address - 0xfe60]);
        }
Ejemplo n.º 4
0
        private bool OnExecutionStep()
        {
            switch (_execType)
            {
            case ExecutionType.Auto:
            {
                // Execute a single step, then update UI and
                // sleep to give messages time to run.
                this.BeginInvoke(new StepDelegate(RefreshUI));
                this.BeginInvoke(new StepDelegate(Invalidate));
                System.Threading.Thread.Sleep(10);
                return(false);        /* break always */
            }

            case ExecutionType.Step:
                return(true);     /* break always */

            case ExecutionType.Normal:
            case ExecutionType.NextTask:
            case ExecutionType.NextNovaInstruction:
                // See if we need to stop here
                if (_execAbort ||                                                   // The Stop button was hit
                    _system.CPU.InternalBreak ||                                    // Something internal has requested a debugger break
                    _microcodeBreakpointEnabled[
                        (int)UCodeMemory.GetBank(
                            _system.CPU.CurrentTask.TaskType),
                        _system.CPU.CurrentTask.MPC] ||                             // A microcode breakpoint was hit
                    (_execType == ExecutionType.NextTask &&
                     _system.CPU.NextTask != null &&
                     _system.CPU.NextTask != _system.CPU.CurrentTask) ||            // The next task was switched to
                    (_system.CPU.CurrentTask.MPC == 0x10 &&                         // MPC is 20(octal) meaning a new Nova instruction and...
                     (_novaBreakpointEnabled[_system.CPU.R[6]] ||                   // A breakpoint is set here
                      _execType == ExecutionType.NextNovaInstruction)))             // or we're running only a single Nova instruction.
                {
                    if (!_execAbort)
                    {
                        SetExecutionState(ExecutionState.BreakpointStop);
                    }

                    // Stop here as we've hit a breakpoint or have been stopped
                    // Update UI to indicate where we stopped.
                    this.BeginInvoke(new StepDelegate(RefreshUI));
                    this.BeginInvoke(new StepDelegate(Invalidate));

                    _system.CPU.InternalBreak = false;

                    _execAbort = false;
                    return(true);
                }

                break;
            }

            return(false);
        }
Ejemplo n.º 5
0
 private string GetTextForTaskBank(AltoCPU.Task task)
 {
     if (task == null)
     {
         return(String.Empty);
     }
     else
     {
         return(UCodeMemory.GetBank(task.TaskType).ToString());
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Writes a word to the specified address.
        /// </summary>
        /// <param name="address"></param>
        /// <param name="data"></param>
        public void Load(int address, ushort data, TaskType task, bool extendedMemory)
        {
            Log.Write(LogType.Verbose, LogComponent.Music, "MUSIC (I/O) write to {0} ({1}) by task {2} (bank {3})",
                      Conversion.ToOctal(address),
                      Conversion.ToOctal(data),
                      task,
                      UCodeMemory.GetBank(task));

            if (address == 0xfffe)
            {
                //_musicIo.WriteByte((byte)(data >> 8));
                //_musicIo.WriteByte((byte)data);
                _lastDac = data;
            }
        }
Ejemplo n.º 7
0
        public void Reset()
        {
            _scheduler.Reset();

            _memBus.Reset();
            _mem.Reset();
            ALU.Reset();
            Shifter.Reset();
            _diskController.Reset();
            _displayController.Reset();
            _keyboard.Reset();
            _mouse.Reset();
            _cpu.Reset();
            _ethernetController.Reset();
            _musicInterface.Reset();

            UCodeMemory.Reset();
        }
Ejemplo n.º 8
0
        public void Reset()
        {
            _scheduler.Reset();

            _memBus.Reset();
            _mem.Reset();
            ALU.Reset();
            Shifter.Reset();
            _diskController.Reset();
            _displayController.Reset();
            _keyboard.Reset();
            _mouseAndKeyset.Reset();
            _cpu.Reset();
            _ethernetController.Reset();
            _orbitController.Reset();
            _tridentController.Reset();

            UCodeMemory.Reset();
        }
Ejemplo n.º 9
0
        public void Reset()
        {
            _scheduler.Reset();

            _memBus.Reset();
            _mem.Reset();
            ALU.Reset();
            Shifter.Reset();
            _diskController.Reset();
            _displayController.Reset();
            _keyboard.Reset();
            _mouseAndKeyset.Reset();
            _cpu.Reset();
            _ethernetController.Reset();
            _orbitController.Reset();
            _tridentController.Reset();

            UCodeMemory.Reset();

            if (ScriptManager.IsRecording)
            {
                ScriptManager.Recorder.Command("reset");
            }
        }
Ejemplo n.º 10
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();
        }