private static void LinkList(int addr) { BlockNode node = new BlockNode(addr, Zpr.ReadRam(addr, 0x10)); Console.Clear(); List <BlockNode> nodes = new List <BlockNode>() { node }; var cur = node; while (cur.Prev != 0) { cur = new BlockNode(cur.Prev, Zpr.ReadRam(cur.Prev, 0x10)); nodes.Add(cur); } cur = node; while (cur.Next != 0) { cur = new BlockNode(cur.Next, Zpr.ReadRam(cur.Next, 0x10)); nodes.Add(cur); } foreach (var item in nodes.OrderBy(x => x.Ram.Start)) { Console.WriteLine($"{item.Ram.Start:X8}:{item.ToString()}"); } }
static void Main(string[] args) { bool flip = true; bool dump = false; //091CFD80 Mount(); string line = "";// = Console.ReadLine(); while (line != "q") { line = Console.ReadLine(); switch (line) { case "flip": flip = !flip; break; case "dump": dump = !dump; break; case "link": LinkList(0x08080000); break; case "link2": LinkList(0x080A6E40); break; case "link3": LinkList(0x08000064); break; case "link4": LinkList(0x08002AD0); break; case "linkc": LinkListCircular(0x9EA0000); break; case "mount": Mount(); break; default: { long addr; if (!TryEvaluate(line.Trim(), out addr)) { continue; } //if (!int.TryParse(line.Trim(), System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out addr)) // continue; if (!dump) { ReadRam((int)addr, flip); } else { Console.Clear(); var arr = Zpr.ReadRam((int)addr, 0x100); for (int i = 0; i < 0x100; i++) { Console.Write($"{arr[i]:X2}"); } } } break; } } }
private static void ReadRam(int addr, bool flip) { Console.Clear(); long emuAddr = 0; long emuAddrOld = 0; if (flip) { for (int i = 0; i < 0x100; i += 0x10) { emuAddr = Zpr.GetEmulatedAddress(addr); if (emuAddrOld != emuAddr) { Console.WriteLine($"{emuAddr:X16}"); emuAddrOld = emuAddr; } int addrLocal = addr + i; Console.WriteLine($"{addrLocal:X8} {Zpr.ReadRamInt32(addrLocal + 0):X8} {Zpr.ReadRamInt32(addrLocal + 4):X8} {Zpr.ReadRamInt32(addrLocal + 0x8):X8} {Zpr.ReadRamInt32(addrLocal + 0xC):X8}"); } } else { byte[] arr = Zpr.ReadRam(addr, 0x100); emuAddr = Zpr.GetEmulatedAddress(addr); Console.WriteLine($"{emuAddr:X16}"); for (int i = 0; i < 0x100; i += 0x10) { Console.Write($"{(addr + i):X8}"); for (int j = 0; j < 0x10; j += 4) { Console.Write($" {arr[i + j]:X2}{arr[i + j + 1]:X2}{arr[i + j + 2]:X2}{arr[i + j + 3]:X2}"); } Console.WriteLine(); } } }