コード例 #1
0
        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            if (mJM == null || !mJM.ValidLoadedProgram)
            {
                return;
            }

            Graphics g = e.Graphics;

            System.Drawing.Drawing2D.Matrix mx = new System.Drawing.Drawing2D.Matrix(1, 0, 0, 1,
                                                                                     panel1.AutoScrollPosition.X, panel1.AutoScrollPosition.Y);
            e.Graphics.Transform = mx;

            using (SolidBrush backBrush = new SolidBrush(panel1.BackColor))
                using (SolidBrush textBrush = new SolidBrush(panel1.ForeColor))
                    using (SolidBrush highlightBrush = new SolidBrush(mHighlightColor))
                    {
                        for (uint ii = 0; ii < 16; ii++)
                        {
                            int       ypos   = (int)(ii * panel1.Font.Height);
                            Rectangle bounds = new Rectangle(0, ypos, panel1.ClientRectangle.Width, panel1.Font.Height);

                            string str = GeneralPurposeRegisters.registerToString(ii);

                            uint regValue = mJM.GPR[ii];
                            switch (this.CurrentDisplayBase)
                            {
                            case RegisterDisplayBase.Hexadecimal:
                                str += regValue.ToString("x8"); break;

                            case RegisterDisplayBase.Signed:
                                str += ((int)regValue).ToString(); break;

                            case RegisterDisplayBase.Unsigned:
                                str += regValue.ToString(); break;
                            }
                            g.FillRectangle(backBrush, bounds);
                            Brush brush = _gpRegistersChanged[ii] ? highlightBrush : textBrush;

                            // Draw the current item text based on the current Font and the custom brush settings.
                            e.Graphics.DrawString(str, panel1.Font, brush, bounds, StringFormat.GenericDefault);
                        }//for ii

                        RegistersView.DrawLine(g, panel1, 16, textBrush, "------------------");
                        RegistersView.DrawLine(g, panel1, 17, textBrush, "CPSR Register");
                        RegistersView.DrawLine(g, panel1, 18, _cpsrChanged[0] ? highlightBrush : textBrush, "Negative(N):" + (mJM.CPSR.nf ? "1" : "0"));
                        RegistersView.DrawLine(g, panel1, 19, _cpsrChanged[1] ? highlightBrush : textBrush, "Zero(Z)    :" + (mJM.CPSR.zf ? "1" : "0"));
                        RegistersView.DrawLine(g, panel1, 20, _cpsrChanged[2] ? highlightBrush : textBrush, "Carry(C)   :" + (mJM.CPSR.cf ? "1" : "0"));
                        RegistersView.DrawLine(g, panel1, 21, _cpsrChanged[3] ? highlightBrush : textBrush, "Overflow(V):" + (mJM.CPSR.vf ? "1" : "0"));
                        RegistersView.DrawLine(g, panel1, 22, textBrush, "IRQ Disable:" + (mJM.CPSR.IRQDisable ? "1" : "0"));
                        RegistersView.DrawLine(g, panel1, 23, textBrush, "FIQ Disable:" + (mJM.CPSR.FIQDisable ? "1" : "0"));
                        RegistersView.DrawLine(g, panel1, 24, textBrush, "Thumb(T)   :" + (mJM.CPSR.tf ? "1" : "0"));
                        RegistersView.DrawLine(g, panel1, 25, textBrush, "CPU Mode   :" + System.Enum.GetName(typeof(CPSR.CPUModeEnum), mJM.CPSR.Mode));
                        RegistersView.DrawLine(g, panel1, 26, textBrush, "------------------");
                        RegistersView.DrawLine(g, panel1, 27, textBrush, "0x" + mJM.CPSR.Flags.ToString("x8"));
                    }
        }
コード例 #2
0
        private void panel2_Paint(object sender, PaintEventArgs e)
        {
            if (mJM == null || !mJM.ValidLoadedProgram)
            {
                return;
            }

            Graphics g = e.Graphics;

            System.Drawing.Drawing2D.Matrix mx = new System.Drawing.Drawing2D.Matrix(1, 0, 0, 1, panel2.AutoScrollPosition.X, panel2.AutoScrollPosition.Y);
            e.Graphics.Transform = mx;

            using (SolidBrush backBrush = new SolidBrush(panel2.BackColor))
                using (SolidBrush textBrush = new SolidBrush(panel2.ForeColor))
                    using (SolidBrush highlightBrush = new SolidBrush(mHighlightColor))
                    {
                        int line = 0;
                        switch (this.CurrentFloatingPointType)
                        {
                        case FloatingPointType.Single:
                            for (uint ii = 0; ii < 32; ii++, line++)
                            {
                                int       ypos   = (int)(ii * panel2.Font.Height);
                                Rectangle bounds = new Rectangle(0, ypos, panel2.ClientRectangle.Width, panel2.Font.Height);

                                string str      = "s" + ii.ToString() + ((ii < 10) ? " " : "") + ":";
                                float  regValue = mJM.FPP.FPR.ReadS(ii);
                                str += ARMSim.Simulator.VFP.FloatingPointProcessor.FloatToString(regValue);
                                //str += float.IsNaN(regValue) ? "NaN" : regValue.ToString("0.###E+0");

                                g.FillRectangle(backBrush, bounds);
                                Brush brush = _fpRegistersChanged[ii] ? highlightBrush : textBrush;
                                e.Graphics.DrawString(str, panel2.Font, brush, bounds, StringFormat.GenericDefault);
                            }
                            break;

                        case FloatingPointType.Double:
                            for (uint ii = 0; ii < 16; ii++, line++)
                            {
                                int       ypos   = (int)(ii * panel2.Font.Height);
                                Rectangle bounds = new Rectangle(0, ypos, panel2.ClientRectangle.Width, panel1.Font.Height);

                                string str      = "d" + ii.ToString() + ((ii < 10) ? " " : "") + ":";
                                double regValue = mJM.FPP.FPR.ReadD(ii);
                                str += ARMSim.Simulator.VFP.FloatingPointProcessor.DoubleToString(regValue);
                                //str += double.IsNaN(regValue) ? "NaN" : regValue.ToString("0.###E+0");

                                g.FillRectangle(backBrush, bounds);
                                Brush brush = _fpRegistersChanged[ii] ? highlightBrush : textBrush;
                                e.Graphics.DrawString(str, panel1.Font, brush, bounds, StringFormat.GenericDefault);
                            }
                            break;
                        }//switch
                        RegistersView.DrawLine(g, panel2, line++, textBrush, "------------------");
                        RegistersView.DrawLine(g, panel2, line++, textBrush, "FCPSR Register");
                        RegistersView.DrawLine(g, panel2, line++, textBrush, "Negative(N):" + (mJM.FPP.FPSCR.nf ? "1" : "0"));
                        RegistersView.DrawLine(g, panel2, line++, textBrush, "Zero(Z)    :" + (mJM.FPP.FPSCR.zf ? "1" : "0"));
                        RegistersView.DrawLine(g, panel2, line++, textBrush, "Carry(C)   :" + (mJM.FPP.FPSCR.cf ? "1" : "0"));
                        RegistersView.DrawLine(g, panel2, line++, textBrush, "Overflow(V):" + (mJM.FPP.FPSCR.vf ? "1" : "0"));
                        RegistersView.DrawLine(g, panel2, line++, textBrush, "Stride     :" + (mJM.FPP.FPSCR.Stride.ToString()));
                        RegistersView.DrawLine(g, panel2, line++, textBrush, "Length     :" + (mJM.FPP.FPSCR.Length.ToString()));
                        RegistersView.DrawLine(g, panel2, line++, textBrush, "-------------");
                        RegistersView.DrawLine(g, panel2, line++, textBrush, "0x" + mJM.FPP.FPSCR.Flags.ToString("x8"));
                    }
        }