Ejemplo n.º 1
0
        private void Repaint(bool tick, NativeCog host)
        {
            Graphics g = Graphics.FromImage((Image)BackBuffer);

            g.Clear(SystemColors.Control);
            Brush brush;

            OpcodeSize.Visible   = false;
            DisplayUnits.Visible = false;
            zeroFlagLabel.Text   = "Zero: " + (host.ZeroFlag ? "True" : "False");
            carryFlagLabel.Text  = "Carry: " + (host.CarryFlag ? "True" : "False");

            String display;
            uint   topLine, bottomLine;

            topLine    = 5;
            bottomLine = (uint)((ClientRectangle.Height / MonoFont.Height) - 5);

            for (uint i = (uint)positionScroll.Value, y = 0, line = 1;
                 y < ClientRectangle.Height;
                 y += (uint)MonoFont.Height, i++, line++)
            {
                if ((i > 0x1FF) || (i < 0))
                {
                    continue;
                }

                uint mem = host[(int)i];

                if (memoryViewButton.Checked)
                {
                    string binary = Convert.ToString((long)mem, 2);

                    while (binary.Length < 32)
                    {
                        binary = "0" + binary;
                    }

                    display = String.Format("{0:X4}:  {1:X8}   {2}   {1}",
                                            i,
                                            mem,
                                            binary);
                }
                else
                {
                    display = String.Format("{0:X3}:  {2:X8}   {1}",
                                            i,
                                            InstructionDisassembler.AssemblyText(mem),
                                            mem);
                }

                if ((uint)positionScroll.Value + line - 1 == host.BreakPoint)
                {
                    brush = System.Drawing.Brushes.Pink;
                }
                else if ((!followPCButton.Checked) || (line <= topLine) || (line >= bottomLine))
                {
                    brush = SystemBrushes.Control;
                }
                else
                {
                    brush = SystemBrushes.Window;
                }
                g.FillRectangle(brush, 0, y, assemblyPanel.Width, y + MonoFont.Height);


                g.DrawString(
                    display,
                    (host.ProgramCursor == i) ? MonoFontBold : MonoFont,
                    SystemBrushes.ControlText, 0, y);
            }
        }
Ejemplo n.º 2
0
        private void PaintNative(Graphics g, NativeCog host)
        {
            g.Clear(SystemColors.Control);
            Brush brush;

            String display;
            uint   topLine, bottomLine;

            topLine    = 5;
            bottomLine = (uint)((ClientRectangle.Height / MonoFont.Height) - 5);

            for (uint i = (uint)positionScroll.Value, y = 0, line = 1;
                 y < ClientRectangle.Height;
                 y += (uint)MonoFont.Height, i++, line++)
            {
                if ((i > 0x1FF) || (i < 0))
                {
                    continue;
                }

                uint mem = host[(int)i];

                if (memoryViewButton.Checked)
                {
                    string binary = Convert.ToString((long)mem, 2);

                    while (binary.Length < 32)
                    {
                        binary = "0" + binary;
                    }

                    display = String.Format("{0:X4}:  {1:X8}   {2}   {1}",
                                            i,
                                            mem,
                                            binary);
                }
                else
                {
                    display = String.Format("{0:X3}:  {2:X8}   {1}",
                                            i,
                                            InstructionDisassembler.AssemblyText(mem),
                                            mem);
                }

                if ((uint)positionScroll.Value + line - 1 == host.BreakPoint)
                {
                    brush = System.Drawing.Brushes.Pink;
                }
                else if ((!followPCButton.Checked) || (line <= topLine) || (line >= bottomLine))
                {
                    brush = SystemBrushes.Control;
                }
                else
                {
                    brush = SystemBrushes.Window;
                }
                g.FillRectangle(brush, 0, y, assemblyPanel.Width, y + MonoFont.Height);


                g.DrawString(
                    display,
                    (host.ProgramCursor == i) ? MonoFontBold : MonoFont,
                    SystemBrushes.ControlText, 0, y);
            }
        }