summaryrefslogtreecommitdiff
path: root/RegionVisualiser
diff options
context:
space:
mode:
Diffstat (limited to 'RegionVisualiser')
-rw-r--r--RegionVisualiser/BoxDrawer.cs49
-rw-r--r--RegionVisualiser/Program.cs74
-rw-r--r--RegionVisualiser/Region.cs10
-rw-r--r--RegionVisualiser/RegionVisualiser.csproj14
-rw-r--r--RegionVisualiser/SizeFormatter.cs25
-rw-r--r--RegionVisualiser/output.txt24
6 files changed, 0 insertions, 196 deletions
diff --git a/RegionVisualiser/BoxDrawer.cs b/RegionVisualiser/BoxDrawer.cs
deleted file mode 100644
index 77d0fc7..0000000
--- a/RegionVisualiser/BoxDrawer.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-namespace RegionVisualiser;
-
-public static class BoxDrawer
-{
- public static void DrawBox(string title, string body, int width = 0, string head = "", string tail = "")
- {
- int leftPad = Math.Max(head.Length, tail.Length);
- var lines = body.Split('\n');
- int maxWidth = Math.Max(Math.Max(title.Length + 2, BoxDrawer.GetMaxWidth(lines) + 1), width);
-
- // Top border with centered title
- string top = "┌" + BoxDrawer.CenterText($" {title} ", maxWidth, '─') + "┐";
- Console.Write(head);
- Console.CursorLeft = leftPad;
- Console.WriteLine(top);
-
- // Body lines, left aligned
- foreach (var line in lines)
- {
- Console.CursorLeft = leftPad;
- Console.WriteLine("│ " + line.PadRight(maxWidth - 1) + "│");
- }
-
- // Bottom border
- string bottom = "└" + new string('─', maxWidth) + "┘";
- Console.Write(tail);
- Console.CursorLeft = leftPad;
- Console.WriteLine(bottom);
- }
-
- private static int GetMaxWidth(string[] lines)
- {
- int width = 0;
- foreach (var l in lines)
- if (l.Length + 1 > width) width = l.Length + 1;
- return width;
- }
-
- private static string CenterText(string text, int width, char fill)
- {
- int totalPad = width - text.Length;
- if (totalPad <= 0) return text;
-
- int left = totalPad / 2;
- int right = totalPad - left;
-
- return new string(fill, left) + text + new string(fill, right);
- }
-} \ No newline at end of file
diff --git a/RegionVisualiser/Program.cs b/RegionVisualiser/Program.cs
deleted file mode 100644
index 029f324..0000000
--- a/RegionVisualiser/Program.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-namespace RegionVisualiser;
-
-using Q1.Emulator;
-
-class Program
-{
- static void Main(string[] args)
- {
- Region[] regions =
- [
- new Region
- {
- Name = "ROM",
- Info = $"ProgramStart: 0x{Q1Layout.ProgramStart:X4}",
- Start = Q1Layout.Rom.start,
- Size = Q1Layout.Rom.size
- },
- new Region
- {
- Name = "Memory",
- Info =
- $"Stack: 0x{Q1Layout.StackStart:X4}-0x{Q1Layout.StackStart + Q1Layout.StackLength:X4}"
- + $" ({Q1Layout.StackLength}b)\n"
- + $"Free : 0x{Q1Layout.FreeMemoryStart:X4}",
- Start = Q1Layout.Memory.start,
- Size = Q1Layout.Memory.size
- },
- new Region
- {
- Name = "Display",
- Info = $"Palette : {Q1Layout.DisplayPaletteSize} colors\n"
- + $"Offset : 0x{Q1Layout.Display.start + Q1Layout.DisplayPaletteSize * 3:X4}\n"
- + $"Dimensions: {Q1Layout.DisplayWidth}x{Q1Layout.DisplayHeight}",
- Start = Q1Layout.Display.start,
- Size = Q1Layout.Display.size
- },
- new Region
- {
- Name = "HID Module",
- Info = $"Mouse IDX : 0x{Q1Layout.Hid.start:X4}\n"
- + $"Mouse state: 0x{Q1Layout.Hid.start + 2:X4}\n"
- + $"Keyboard SK: 0x{Q1Layout.Hid.start + 4:X4}",
- Start = Q1Layout.Hid.start,
- Size = Q1Layout.Hid.size
- },
- ];
-
- regions = regions.OrderBy(x => x.Start).ToArray();
-
- int lastRegionEnd = -1;
- for (int i = 0; i < regions.Length; i++)
- {
- Region r = regions[i];
- if (r.Start != lastRegionEnd + 1)
- {
- Console.WriteLine($" 0x{lastRegionEnd + 1:X4} ────" + new string('─', 50));
- Console.WriteLine($" [ Unmapped / Reserved ({SizeFormatter.HumanReadable(r.Start - lastRegionEnd)}) ]");
- }
- BoxDrawer.DrawBox(
- $"{r.Name} ({SizeFormatter.HumanReadable(r.Size)})",
- r.Info,
- width: 50,
- head: $" 0x{r.Start:X4} ── ");
-
- lastRegionEnd = r.End;
- }
-
- if (lastRegionEnd + 1 != UInt16.MaxValue)
- {
- Console.WriteLine($" 0x{lastRegionEnd + 1:X4} ────" + new string('─', 50));
- Console.WriteLine($" [ Unmapped / Reserved ({SizeFormatter.HumanReadable(UInt16.MaxValue - lastRegionEnd)}) ]");
- }
- }
-} \ No newline at end of file
diff --git a/RegionVisualiser/Region.cs b/RegionVisualiser/Region.cs
deleted file mode 100644
index bee39f5..0000000
--- a/RegionVisualiser/Region.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace RegionVisualiser;
-
-public class Region
-{
- public string Name;
- public int Start;
- public int Size;
- public int End => this.Start + this.Size -1;
- public string Info;
-} \ No newline at end of file
diff --git a/RegionVisualiser/RegionVisualiser.csproj b/RegionVisualiser/RegionVisualiser.csproj
deleted file mode 100644
index d7bfae3..0000000
--- a/RegionVisualiser/RegionVisualiser.csproj
+++ /dev/null
@@ -1,14 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>net9.0</TargetFramework>
- <ImplicitUsings>enable</ImplicitUsings>
- <Nullable>enable</Nullable>
- </PropertyGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\Emulator\Emulator.csproj" />
- </ItemGroup>
-
-</Project>
diff --git a/RegionVisualiser/SizeFormatter.cs b/RegionVisualiser/SizeFormatter.cs
deleted file mode 100644
index 3479bd8..0000000
--- a/RegionVisualiser/SizeFormatter.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-namespace RegionVisualiser;
-
-public static class SizeFormatter
-{
- private static readonly string[] Units = ["bytes", "KB", "MB", "GB", "TB"];
-
- public static string HumanReadable(long bytes)
- {
- if (bytes < 1024) return $"{bytes} {SizeFormatter.Units[0]}";
-
- double value = bytes;
- int unit = 0;
-
- while (value >= 1024 && unit < SizeFormatter.Units.Length - 1)
- {
- value /= 1024;
- unit++;
- }
-
- // Show up to 2 decimal places if not whole
- return value % 1 == 0
- ? $"{value:0} {SizeFormatter.Units[unit]}"
- : $"{value:0.##} {SizeFormatter.Units[unit]}";
- }
-} \ No newline at end of file
diff --git a/RegionVisualiser/output.txt b/RegionVisualiser/output.txt
deleted file mode 100644
index 10d7970..0000000
--- a/RegionVisualiser/output.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
- 0x0000 ──────────────────────────────────────────────────────
- [ Unmapped / Reserved (8 KB) ]
- 0x1FFF ── ┌─────────────────── ROM (8 KB) ───────────────────┐
- │ ProgramStart: 0x1FFF │
- └──────────────────────────────────────────────────┘
- 0x3FFF ── ┌─────────────── Display (8.05 KB) ────────────────┐
- │ Palette : 16 colors │
- │ Offset : 0x402F │
- │ Dimensions: 128x64 │
- └──────────────────────────────────────────────────┘
- 0x602F ── ┌───────────── HID Module (260 bytes) ─────────────┐
- │ Mouse IDX : 0x602F │
- │ Mouse state: 0x6031 │
- │ Keyboard SK: 0x6033 │
- └──────────────────────────────────────────────────┘
- 0x6133 ──────────────────────────────────────────────────────
- [ Unmapped / Reserved (3.7 KB) ]
- 0x6FFF ── ┌───────────────── Memory (16 KB) ─────────────────┐
- │ Stack: 0x6FFF-0x71FF (512b) │
- │ Free : 0x71FF │
- └──────────────────────────────────────────────────┘
- 0xAFFF ──────────────────────────────────────────────────────
- [ Unmapped / Reserved (20 KB) ] \ No newline at end of file