Ejemplo n.º 1
0
        public void RefreshMemoryView()
        {
            StringBuilder s = new StringBuilder();

            if (Memory == null)
            {
                return;
            }
            MemoryText.Clear();
            for (int i = StartAddress; i <= EndAddress; i += 0x10)
            {
                s.Append(">");
                s.Append(i.ToString("X6"));
                s.Append("  ");
                for (int j = 0; j < 16; j++)
                {
                    s.Append(Memory.ReadByte(i + j).ToString("X2"));
                    s.Append(" ");
                    if (j == 7 || j == 15)
                    {
                        s.Append(" ");
                    }
                }

                for (int j = 0; j < 16; j++)
                {
                    int c = Memory.ReadByte(i + j);
                    if (c < 32 || c > 127)
                    {
                        s.Append(".");
                    }
                    else
                    {
                        s.Append((char)c);
                    }
                    if (j == 7 || j == 15)
                    {
                        s.Append(" ");
                    }
                }
                s.AppendLine();
            }
            MemoryText.AppendText(s.ToString());
        }
Ejemplo n.º 2
0
        public void RefreshMemoryView()
        {
            StringBuilder s = new StringBuilder();

            if (Memory == null)
            {
                return;
            }
            //MemoryText.Clear();
            // Display 16 bytes per line
            for (int i = StartAddress; i < EndAddress; i += 0x10)
            {
                s.Append(">");
                if (Memory is MemoryRAM)
                {
                    s.Append((i + Memory.StartAddress).ToString("X6"));
                }
                else
                {
                    s.Append(i.ToString("X6"));
                }

                s.Append("  ");
                StringBuilder text = new StringBuilder();
                for (int j = 0; j < 16; j++)
                {
                    if (i + j < Memory.Length)
                    {
                        int c = Memory.ReadByte(i + j);
                        s.Append(c.ToString("X2"));

                        // Character data
                        if (c < 32 || c > 127)
                        {
                            text.Append(".");
                        }
                        else
                        {
                            text.Append((char)c);
                        }
                    }
                    else
                    {
                        s.Append("--");
                        text.Append("-");
                    }
                    s.Append(" ");



                    // Group 8 bytes together
                    if (j == 7 || j == 15)
                    {
                        s.Append(" ");
                        text.Append(" ");
                    }
                }
                s.Append(text);
                if ((i - StartAddress) < 256)
                {
                    s.AppendLine();
                }
            }
            MemoryText.Text = s.ToString();
        }