Esempio n. 1
0
        public void GenerateLowHighHexFile(string pathWithoutExt)
        {
            int extLength = System.IO.Path.GetExtension(pathWithoutExt).Length;

            if (extLength > 0)
            {
                pathWithoutExt = pathWithoutExt.Remove(pathWithoutExt.Length - extLength);
            }

            MessageManager.ShowLine($"Entry point is 0x{ StartupAddress.ToString("X8") } (by word address)", enumMessageLevel.ProgressLog);
            {
                StringBuilder sb = new StringBuilder();
                int           i  = 0;
                {
                    MemoryContent content = MemoryContents[i];
                    for (int addr = 0; addr < content.WordCapacity; addr++)
                    {
                        uint val = content.Words[addr].InitialValue;
                        sb.AppendLine($"{((val >> 16) & 0xFFFF).ToString("X4")}{ ((content.GetDebugInfo(addr, 2, 0).DebugInfo != null && false) ? ("  # " + content.GetDebugInfo(addr, 2, 0).DebugInfo) : "") } ");
                    }
                }
                System.IO.File.WriteAllText(pathWithoutExt + "_h.hex", sb.ToString());
            }
            {
                StringBuilder sb = new StringBuilder();
                int           i  = 0;
                {
                    MemoryContent content = MemoryContents[i];
                    for (int addr = 0; addr < content.WordCapacity; addr++)
                    {
                        uint val = content.Words[addr].InitialValue;
                        sb.AppendLine($"{(val & 0xFFFF).ToString("X4")}{ ((content.GetDebugInfo(addr, 2, 1).DebugInfo != null&&false) ? ("  # " + content.GetDebugInfo(addr, 2, 1).DebugInfo) : "") } ");
                    }
                }
                System.IO.File.WriteAllText(pathWithoutExt + "_l.hex", sb.ToString());
            }
        }
Esempio n. 2
0
        public void GenerateHexFile(string path, bool splitWithLowHigh = false)
        {
            if (splitWithLowHigh)
            {
                GenerateLowHighHexFile(path);
                return;
            }

            MessageManager.ShowLine($"Entry point is 0x{ StartupAddress.ToString("X8") } (by word address)", enumMessageLevel.ProgressLog);

            StringBuilder sb          = new StringBuilder();
            string        displayFmt  = IsSixteenBitArch ? "X4" : "X8";
            uint          displayMask = IsSixteenBitArch ? 0xFFFF : 0xFFFFFFFF;
            int           i           = 0;

            {
                MemoryContent content = MemoryContents[i];
                for (int addr = 0; addr < content.WordCapacity; addr++)
                {
                    sb.AppendLine($"{(content.Words[addr].InitialValue & displayMask).ToString(displayFmt)}{ ((content.GetDebugInfo(addr).DebugInfo != null && false) ? ("  # " + content.GetDebugInfo(addr).DebugInfo) : "") } ");
                }
            }

            System.IO.File.WriteAllText(path, sb.ToString());
        }