From 16f3cb74564cf7c19da6e13666c98aca36094716 Mon Sep 17 00:00:00 2001 From: Melodi <62381002+Melodi17@users.noreply.github.com> Date: Tue, 5 Aug 2025 21:24:16 +1000 Subject: updates --- Program.cs | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'Program.cs') diff --git a/Program.cs b/Program.cs index 63906a0..016e557 100644 --- a/Program.cs +++ b/Program.cs @@ -14,6 +14,10 @@ internal class Program if (args.Length > 0) { string filePath = args[0]; + + Environment.CurrentDirectory = Path.GetDirectoryName(filePath) ?? Environment.CurrentDirectory; + filePath = Path.GetFileName(filePath); + if (filePath.EndsWith(".q1")) { Run(filePath); @@ -34,7 +38,7 @@ internal class Program { StringReader reader = new(File.ReadAllText(filePath)); BinaryWriter writer = new(File.Create(Path.ChangeExtension(filePath, ".q1"))); - + Assembler assembler = new(reader, writer); assembler.Assemble(); writer.Close(); @@ -49,31 +53,49 @@ internal class Program File.ReadAllBytes(filePath).CopyTo(ram.Memory, 0); cpu.PC = ram.AddressableStart; - + DisplayDevice display = new(16, 64, 32, 0x3FFF); display.SetPalette([ - Color.Red, Color.Green, Color.Blue, Color.Yellow, - Color.Cyan, Color.Magenta, Color.White, Color.Black, - Color.Gray, Color.Orange, Color.Purple, Color.Brown, - Color.LightGray, Color.DarkGray, Color.LightBlue, Color.LightGreen]); - + Color.Red, + Color.Green, + Color.Blue, + Color.Yellow, + Color.Cyan, + Color.Magenta, + Color.White, + Color.Black, + Color.Gray, + Color.Orange, + Color.Purple, + Color.Brown, + Color.LightGray, + Color.DarkGray, + Color.LightBlue, + Color.LightGreen + ]); + cpu.Bus = bus; ram.AttachToBus(bus); display.AttachToBus(bus); - int frameRate = 600; Thread t = new(() => { while (true) { - cpu.Clock(); - Thread.Sleep(1000 / frameRate); + for (int i = 0; i < 64; i++) + { + cpu.Clock(); + } + Thread.Sleep(1); + // + // cpu.Clock(); + // Thread.Sleep(1000); } }); t.IsBackground = true; t.Start(); - using DisplayEngine game = new(64, 32, 10, + using DisplayEngine game = new(64, 32, 10, tex => { display.OutputTexture = tex; -- cgit v1.3.1