static void initVga() { if (vgaView is null) { vgaView = new(); if (vgaView.InitVga(parser) == false) { vgaView = null; return; } } }
static void Main(string[] args) { Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; string defaultS8File = @"s8.s8"; parser = new S8CommandParser(); parser.MessageHandler += Parser_Message; parser.s8d.Init(defaultS8File); parser.s8d.cpu.HWDisplay.OnVSync += HWDisplay_OnVSync; Console.WriteLine("Velkommen til Slede8 debugger"); Console.WriteLine("H => HELP"); Console.WriteLine(""); Console.WriteLine("Enter command 'GUI' to enter GUI mode"); Console.WriteLine(""); bool debugging = true; while (debugging) { if (parser.showAddress) { Console.Write("S8#["); } else { Console.Write("s8 ["); } Console.Write(parser.currentAddress.ToString("X3") + "] "); string input = Console.ReadLine(); switch (input.ToUpper()) { case "Q": case "QUIT": case "DIE": debugging = false; break; case "CLS": Console.Clear(); break; case "G": case "GUI": var s8gui = new S8Gui(parser); disableConsoleLogging = true; s8gui.RunGui(null); disableConsoleLogging = false; Console.Clear(); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; break; case "W": case "WIN": case "WINRUN": if (vgaView is null) { initVga(); } if (vgaView is not null) { vgaView.RunUI(); vgaView.CleanupSDL(); vgaView = null; } else { Console.WriteLine("Failed to initialize SDL2/WIN"); } break; default: parser.ParseCommand(input); break; } } if (vgaView is not null) { vgaView.CleanupSDL(); vgaView = null; } }