Exemplo n.º 1
0
        public override void UpdateDock(BaseSimState simState)
        {
            if (simState == null)
            {
                return;
            }

            var toplist = simState.Values["WatchValues"] as Dictionary <int, Dictionary <ulong, object> >;

            if (toplist == null)
            {
                return;
            }

            foreach (var entry in watches)
            {
                var bysize = toplist[entry.size] as Dictionary <ulong, object>;

                if (bysize == null)
                {
                    continue;
                }

                var data = bysize[entry.address];

                if (data == null)
                {
                    continue;
                }

                entry.Update(data);
            }

            this.Refresh();
        }
Exemplo n.º 2
0
        private void AddWatch(BaseSimState simState)
        {
            var toplist = new Dictionary <int, Dictionary <ulong, object> >();

            for (int size = 8; size <= 64; size = size * 2)
            {
                var list = new Dictionary <ulong, object>();

                foreach (var entry in watches)
                {
                    if (entry.Size == size)
                    {
                        switch (size)
                        {
                        case 8: list.Add(entry.Address, SimCPU.Read8(entry.Address)); break;

                        case 16: list.Add(entry.Address, SimCPU.Read16(entry.Address)); break;

                        case 32: list.Add(entry.Address, SimCPU.Read32(entry.Address)); break;

                        //case 64: list.Add(entry.Address, SimCPU.Read64(entry.Address)); break;
                        default: break;
                        }
                    }
                }

                toplist.Add(size, list);
            }

            simState.StoreValue("WatchValues", toplist);
        }
Exemplo n.º 3
0
        public override void UpdateDock(BaseSimState simState)
        {
            tbLastInstruction.Text = GetInstruction(SimCPU.LastProgramCounter);
            tbNextInstruction.Text = GetInstruction(SimCPU.CurrentProgramCounter);

            Refresh();
        }
Exemplo n.º 4
0
        public override void UpdateDock(BaseSimState simState)
        {
            if (!enable)
            {
                return;
            }

            if (simState == null)
            {
                return;
            }

            if (!MainForm.Record)
            {
                return;
            }

            if (pendingHistory.Count == 0)
            {
                return;
            }

            dataGridView1.DataSource = null;

            if (pendingHistory.Count >= MainForm.MaxHistory)
            {
                history.Clear();
            }

            foreach (var entry in pendingHistory)
            {
                history.Add(entry);
            }

            pendingHistory.Clear();

            while (history.Count > MainForm.MaxHistory)
            {
                history.RemoveAt(0);
            }

            dataGridView1.DataSource = history;

            if (history.Count == 1)
            {
                dataGridView1.AutoResizeColumns();
                dataGridView1.Columns[0].Width = 60;
                dataGridView1.Columns[1].Width = 90;
                dataGridView1.Columns[2].Width = 450;
            }

            dataGridView1.CurrentCell = dataGridView1[0, history.Count - 1];

            // FirstDisplayedScrollingRowIndex
            //dataGridView1.CurrentCell = dataGridView1.Rows[history.Count - 1].Cells[0];

            Refresh();
        }
Exemplo n.º 5
0
 public HistoryEntry(BaseSimState simState, string method, bool display32)
 {
     this.Tick     = simState.Tick;
     this.ip       = simState.IP;
     this.Code     = simState.Instruction.ToString();
     this.Method   = method;
     this.SimState = simState;
     IP            = MainForm.Format(simState.IP, display32);
 }
Exemplo n.º 6
0
        public override void UpdateDock(BaseSimState simState)
        {
            dataGridView1.Rows.Clear();

            foreach (var name in simState.RegisterList)
            {
                dataGridView1.Rows.Add(name, MainForm.Format(simState.GetRegister(name)));
            }

            Refresh();
        }
Exemplo n.º 7
0
        public override void UpdateDock(BaseSimState simState)
        {
            treeView1.Nodes.Clear();

            List <ulong> list = simState.Values["CallStack"] as List <ulong>;

            foreach (ulong ip in list)
            {
                AddSymbol(ip);
            }

            this.Refresh();
        }
Exemplo n.º 8
0
        private void Select(BaseSimState simState)
        {
            if (simState == null)
            {
                return;
            }

            enable = false;

            MainForm.UpdateAllDocks(simState);

            enable = true;
        }
Exemplo n.º 9
0
        public override void UpdateDock(BaseSimState simState)
        {
            listBox1.Items.Clear();

            bool           display32 = simState.NativeRegisterSize == 32;
            List <ulong[]> stack     = simState.Values["StackFrame"] as List <ulong[]>;

            foreach (var entry in stack)
            {
                listBox1.Items.Add(listBox1.Items.Count.ToString("D2") + ": " + MainForm.Format(entry[0], display32) + " [" + MainForm.Format(entry[1], display32) + "]");
            }

            this.Refresh();
        }
Exemplo n.º 10
0
        public override void UpdateDock(BaseSimState simState)
        {
            treeView1.Nodes.Clear();

            var list = simState.Values["CallStack"] as List <ulong>;

            list.Reverse();

            foreach (var ip in list)
            {
                AddSymbol(ip);
            }

            Refresh();
        }
Exemplo n.º 11
0
        public void AddHistory(BaseSimState simState)
        {
            if (!MainForm.Record)
            {
                return;
            }

            if (simState.IP == 0xFFFFFFF0)
            {
                return;
            }

            string methodName = SimCPU.FindSymbol(simState.IP).Name;

            pendingHistory.Enqueue(new HistoryEntry(simState, methodName, MainForm.Display32));
        }
Exemplo n.º 12
0
        private void UpdateSimState(BaseSimState simState, bool forceUpdate)
        {
            SimCPU.ExtendState(simState);

            double secs = stopwatch.Elapsed.TotalSeconds;

            if (secs == 0)
            {
                secs = 1;
            }

            simState.TotalElapsedSeconds = secs;

            if (this.Record)
            {
                stateQueue.Enqueue(simState);
                if (stateQueue.Count > MaxHistory)
                {
                    stateQueue.Dequeue();                     // Throw away
                }
            }

            AddWatch(simState);

            if (forceUpdate)
            {
                while (stateQueue.Count > 0)
                {
                    AddHistory(stateQueue.Dequeue());
                }
            }

            if (forceUpdate || simState.Tick == 0 || DateTime.Now.Ticks > lastTimeTick + 2500000)
            {
                MethodInvoker method = delegate()
                {
                    UpdateAllDocks(simState);
                };

                BeginInvoke(method);

                lastTimeTick = DateTime.Now.Ticks;
            }
        }
Exemplo n.º 13
0
        public void UpdateAllDocks(BaseSimState simState)
        {
            if (simState == null)
            {
                return;
            }

            if (SimCPU == null)
            {
                return;
            }

            foreach (var dock in dockPanel.Contents)
            {
                if (dock.DockHandler.Content is SimulatorDockContent)
                {
                    (dock.DockHandler.Content as SimulatorDockContent).UpdateDock(simState);
                }
            }
        }
Exemplo n.º 14
0
        public override void UpdateDock(BaseSimState simState)
        {
            var currentInstruction = simState.Instruction;
            var nextInstruction    = SimCPU.GetOpcode(simState.NextIP);

            textBox1.Text = simState.Tick.ToString();
            textBox2.Text = currentInstruction != null?currentInstruction.ToString() : "-BLANK-";

            textBox3.Text = nextInstruction != null?nextInstruction.ToString() : "-BLANK-";

            textBox4.Text = "0x" + simState.IP.ToString("X8");
            textBox5.Text = "0x" + simState.NextIP.ToString("X8");

            textBox6.Text = simState.CPUException != null?simState.CPUException.ToString() : "None";

            double speed = simState.Tick / simState.TotalElapsedSeconds;

            textBox7.Text = speed.ToString("0.00");

            Refresh();
        }
Exemplo n.º 15
0
 public override void ExtendState(BaseSimState simState)
 {
     simState.ExtendState(this);
 }
Exemplo n.º 16
0
 private void AddHistory(BaseSimState simState)
 {
     historyView.AddHistory(simState);
 }
Exemplo n.º 17
0
 public override void ExtendState(BaseSimState simState)
 {
     simState.ExtendState(this);
 }
Exemplo n.º 18
0
 public override void UpdateDock(BaseSimState simState)
 {
 }
Exemplo n.º 19
0
 public virtual void UpdateDock(BaseSimState simState)
 {
 }
Exemplo n.º 20
0
 public override void UpdateDock(BaseSimState simState)
 {
     Refresh();
 }