diff options
Diffstat (limited to 'Emulator/Program.cs')
| -rw-r--r-- | Emulator/Program.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Emulator/Program.cs b/Emulator/Program.cs index 65bf068..f6fa932 100644 --- a/Emulator/Program.cs +++ b/Emulator/Program.cs @@ -64,6 +64,7 @@ public class Program cpu.Clock(); } Console.WriteLine($"Exit code: 0x{cpu.V[0]:X4}"); + MemoryDump(memory, Q1Layout.FreeMemoryStart, (u16) (Q1Layout.Memory.start + Q1Layout.Memory.size - 1)); }); t.IsBackground = true; t.Start(); @@ -80,4 +81,18 @@ public class Program Console.WriteLine("Display surface closed. Waiting for CPU thread to finish..."); t.Join(); } + + private static void MemoryDump(RamDevice memory, u16 start, u16 end) + { + for (u16 addr = start; addr <= end; addr += 16) + { + Console.Write($"0x{addr:X4}: "); + for (u16 offset = 0; offset < 16; offset++) + { + if (addr + offset > end) break; + Console.Write($"{memory.Read((u16) (addr + offset)):X2} "); + } + Console.WriteLine(); + } + } }
\ No newline at end of file |
