Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void RedrawInterface()
- {
- Console.Clear();
- Console.SetCursorPosition(0, 0);
- string bar = GenerateBar(Console.WindowWidth, ' ');
- bar = bar.Substring(title.Length);
- // Title bar
- Console.BackgroundColor = ConsoleColor.White;
- Console.ForegroundColor = ConsoleColor.Black;
- Console.Write(title + bar);
- // Menu
- DrawMenu();
- // Chrome
- bar = GenerateBar(Console.WindowWidth - 1, ' ');
- Console.SetCursorPosition(0, Console.WindowHeight - 1);
- Console.Write(bar);
- // Fix bottom right corner
- if (Type.GetType("Mono.Runtime") == null)
- Console.MoveBufferArea(0, Console.WindowHeight - 1, 1, 1, Console.WindowWidth - 1, Console.WindowHeight - 1);
- bar += ' ';
- for (int y = 2; y < Console.WindowHeight - 1; y++)
- {
- Console.SetCursorPosition(0, y);
- Console.Write(' ');
- Console.SetCursorPosition(Console.WindowWidth - 1, y);
- Console.Write(' ');
- }
- Console.BackgroundColor = ConsoleColor.White;
- bar = GenerateBar(Console.WindowWidth - 2, ' ');
- Console.SetCursorPosition(1, 2);
- Console.Write(bar);
- Console.SetCursorPosition(2, 2);
- Console.ForegroundColor = ConsoleColor.Black;
- bar = GenerateBar(LEM1801.Width + 2, ' ');
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 3, LEM1801.Height + 3);
- Console.Write(bar);
- for (int y = 2; y < Console.WindowHeight - 1; y++)
- {
- Console.SetCursorPosition(1, y);
- Console.Write(' ');
- Console.SetCursorPosition(Console.WindowWidth - 2, y);
- Console.Write(' ');
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 3, y);
- Console.Write(' ');
- }
- Console.SetCursorPosition(2, 2);
- // File bar
- foreach (WorkingFile file in OpenFiles)
- {
- if (!file.Modified)
- Console.Write(Path.GetFileName(file.FileName) + " ");
- else
- Console.Write(Path.GetFileName(file.FileName) + "* ");
- Console.ForegroundColor = ConsoleColor.DarkGray;
- }
- bar = GenerateBar(Console.WindowWidth - 2, ' ');
- Console.SetCursorPosition(1, Console.WindowHeight - 2);
- Console.Write(bar);
- Console.BackgroundColor = ConsoleColor.White;
- Console.ForegroundColor = ConsoleColor.Black;
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, LEM1801.Height + 3);
- Console.Write("Registers");
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, 2);
- Console.WriteLine("Emulator");
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, 3);
- Console.ForegroundColor = ConsoleColor.White;
- Console.BackgroundColor = ConsoleColor.Black;
- Screen.DrawScreen();
- DrawRectangle(Console.WindowWidth - LEM1801.Width - 2, LEM1801.Height + 4, Console.WindowWidth - 2, Console.WindowHeight - 2, ConsoleColor.DarkGray);
- string[] test = new string[]
- {
- "A: 0x1234",
- "B: 0x1234",
- "C: 0x1234",
- "X: 0x1234",
- "Y: 0x1234",
- "Z: 0x1234",
- "I: 0x1234",
- "J: 0x1234",
- "PC: 0x1234",
- "SP: 0x1234",
- "EX: 0x1234",
- "IA: 0x1234",
- };
- Console.BackgroundColor = ConsoleColor.DarkGray;
- Console.ForegroundColor = ConsoleColor.White;
- Console.CursorTop = LEM1801.Height + 3;
- int i = 0;
- foreach (string s in test)
- {
- if (i < 6)
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width + 2, Console.CursorTop + 1);
- else
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width + 15, Console.CursorTop + 1);
- Console.Write(s);
- i++;
- if (i == 6)
- Console.CursorTop = LEM1801.Height + 3;
- }
- Console.BackgroundColor = ConsoleColor.White;
- Console.ForegroundColor = ConsoleColor.Black;
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop);
- bar = GenerateBar(LEM1801.Width, ' ');
- Console.Write(bar);
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop);
- Console.Write("Disassembly");
- Console.ForegroundColor = ConsoleColor.White;
- Console.BackgroundColor = ConsoleColor.Black;
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop + 1);
- Console.Write("[0" + LongHex(0x1234) + "]: SET A, B");
- Console.BackgroundColor = ConsoleColor.DarkGray;
- for (int j = 0x1235; j - 0x1235 < 7; j++)
- {
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop + 1);
- Console.Write("[0" + LongHex((ushort)j) + "]: SET A, B");
- }
- Console.BackgroundColor = ConsoleColor.White;
- Console.ForegroundColor = ConsoleColor.Black;
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop + 1);
- Console.Write(bar);
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop);
- Console.Write("Memory");
- Console.BackgroundColor = ConsoleColor.DarkGray;
- Console.ForegroundColor = ConsoleColor.White;
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop + 1);
- Console.Write("[0" + LongHex(0x1234) + "]:");
- Console.ForegroundColor = ConsoleColor.White;
- Console.BackgroundColor = ConsoleColor.Black;
- Console.Write(" 6D30 ");
- Console.BackgroundColor = ConsoleColor.DarkGray;
- Console.Write("2A23 5F2D 8C34");
- Random r = new Random();
- for (int j = 0x1238; j - 0x1238 < 16 * 4; j += 4)
- {
- Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop + 1);
- Console.Write("[0" + LongHex((ushort)j) + "]: ");
- for (int k = 0; k < 4; k++)
- Console.Write(LongHex((ushort)r.Next()) + " ");
- }
- // Draw open file
- DrawRectangle(2, 3, Console.WindowWidth - LEM1801.Width - 4, Console.WindowHeight - 3, ConsoleColor.Black);
- Console.SetCursorPosition(2, 3);
- SyntaxHighlighting.DrawHighlightedText(OpenFiles[FocusedFile].Contents,
- Console.WindowWidth - LEM1801.Width - 4, Console.WindowHeight - 3, 0, BreakpointLines);
- }
Advertisement
Add Comment
Please, Sign In to add comment