예제 #1
0
        void NavigateRAMPanel(int startAddress)
        {
            LstView_RAM.Items.Clear();
            int rows = 6, bytes = 16;

            if (startAddress % 2 != 0 || startAddress + (bytes * rows) >= Ada.RAM.MemoryArray.Length || startAddress < 0)
            {
                throw new Exception("Invalid memory address.");
            }

            for (int i = startAddress; i < startAddress + (rows * bytes); i += bytes)
            {
                LstStruct row = new LstStruct
                {
                    Address = "0x" + i.ToString("X8"),
                    Values  = ""
                };
                for (int j = 0; j < bytes; j++)
                {
                    row.Values += Ada.RAM.MemoryArray[i + j].ToString("X2") + "    ";
                }

                LstView_RAM.Items.Add(row);
            }
        }
예제 #2
0
        void UpdateAssemblyPanel()
        {
            lstView_Dissassembly.Items.Clear();
            int rows = 5;
            int PC   = Ada.PC;

            for (int i = PC - 4 * rows; i < PC + 4 * rows; i += 4)
            {
                if (i < 0 || i > Ada.RAM.MemoryArray.Length)
                {
                    LstStruct empty = new LstStruct
                    {
                        Address     = "0x" + i.ToString("X8"),
                        Values      = "",
                        Instruction = ""
                    };
                    continue;
                }

                int instCode = Ada.RAM.ReadWord(i);

                LstStruct row = new LstStruct
                {
                    Address     = "0x" + i.ToString("X8"),
                    Values      = StringDecoder.Decode(instCode, Ada.Registers, Ada.RAM, Ada.Flags, i),
                    Instruction = instCode.ToString("X8")
                };
                lstView_Dissassembly.Items.Add(row);
            }
            lstView_Dissassembly.SelectedIndex = rows;
        }