Esempio n. 1
0
        /*
         * Read a file into memory
         */
        public void Load(String filename)
        {
            XmlReader reader = XmlReader.Create(filename);

            if (Resources == null)
            {
                Resources = new ResourceChecker();
            }
            else
            {
                Resources.Clear();
            }
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name.Equals("data"))
                    {
                        LoadMemory(reader.GetAttribute("address"), reader.ReadElementContentAsString());
                    }
                    if (reader.Name.Equals("resource"))
                    {
                        ResourceChecker.Resource res = new ResourceChecker.Resource
                        {
                            Name         = reader.GetAttribute("name"),
                            SourceFile   = reader.GetAttribute("source"),
                            StartAddress = Convert.ToInt32(reader.GetAttribute("start-address"), 16),
                            Length       = Convert.ToInt32(reader.GetAttribute("length"), 16)
                        };
                        Resources.Add(res);
                    }
                }
            }
            reader.Close();
        }
Esempio n. 2
0
 public FoeniXmlFile(FoenixSystem kernel, ResourceChecker resources)
 {
     this.kernel      = kernel;
     this.Resources   = resources;
     this.codeList    = kernel.lstFile.Lines;
     this.BreakPoints = kernel.Breakpoints;
     watchList        = kernel.WatchList;
 }
Esempio n. 3
0
        /*
         * Read a file into memory
         */
        public void Load(String filename)
        {
            XmlReader reader = XmlReader.Create(filename);

            Version = BoardVersion.RevB;
            if (Resources == null)
            {
                Resources = new ResourceChecker();
            }
            else
            {
                Resources.Clear();
            }
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name.Equals("data"))
                    {
                        LoadMemory(reader.GetAttribute("address"), reader.ReadElementContentAsString());
                        continue;
                    }
                    if (reader.Name.Equals("resource"))
                    {
                        ResourceChecker.Resource res = new()
                        {
                            Name         = reader.GetAttribute("name"),
                            SourceFile   = reader.GetAttribute("source"),
                            StartAddress = Convert.ToInt32(reader.GetAttribute("start-address"), 16),
                            Length       = Convert.ToInt32(reader.GetAttribute("length"), 16)
                        };
                        Resources.Add(res);
                        continue;
                    }
                    if (reader.Name.Equals("code"))
                    {
                        string addrStr = reader.GetAttribute("address");
                        if (addrStr.Length > 0)
                        {
                            int       address = Convert.ToInt32(addrStr.Replace("$", ""), 16);
                            string    label   = reader.GetAttribute("label");
                            string    source  = reader.GetAttribute("source");
                            string    command = reader.GetAttribute("command");
                            DebugLine code    = new(address);
                            code.SetLabel(label);
                            code.SetMnemonic(source);
                            code.SetOpcodes(command);
                            if (codeList.ContainsKey(address))
                            {
                                codeList.Remove(address);
                            }
                            codeList.Add(address, code);
                        }
                        continue;
                    }
                    if (reader.Name.Equals("breakpoint"))
                    {
                        string address = reader.GetAttribute("address");
                        BreakPoints.Add(address);
                        continue;
                    }
                    if (reader.Name.Equals("project"))
                    {
                        String version = reader.GetAttribute("version");
                        if (version != null)
                        {
                            Enum.TryParse <BoardVersion>(version, out Version);
                        }
                        continue;
                    }
                    if (reader.Name.Equals("watch"))
                    {
                        int           address = Convert.ToInt32(reader.GetAttribute("address"), 16);
                        string        name    = reader.GetAttribute("label");
                        WatchedMemory mem     = new(name, address, 0, 0);
                        if (watchList.ContainsKey(address))
                        {
                            watchList.Remove(address);
                        }
                        watchList.Add(address, mem);
                    }
                }
            }
            reader.Close();
        }
Esempio n. 4
0
 public FoeniXmlFile(MemoryManager memory, ResourceChecker resources, Processor.Breakpoints breakpoints)
 {
     this.Memory      = memory;
     this.Resources   = resources;
     this.BreakPoints = breakpoints;
 }