From 998b64d14c9d055562d8c1611813d40af4cb030b Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 9 Mar 2012 23:01:13 +0000 Subject: Further bug fixes to Z80. Now starts the Spectrum ROM OK. --- .../Program.cs | 44 +++++++++++++++++----- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'native/Noddybox.Emulation.EightBit.Z80.Test/Program.cs') diff --git a/native/Noddybox.Emulation.EightBit.Z80.Test/Program.cs b/native/Noddybox.Emulation.EightBit.Z80.Test/Program.cs index 43dab10..cad9031 100644 --- a/native/Noddybox.Emulation.EightBit.Z80.Test/Program.cs +++ b/native/Noddybox.Emulation.EightBit.Z80.Test/Program.cs @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; +using System.Diagnostics; namespace Noddybox.Emulation.EightBit.Z80.Test { @@ -60,6 +61,26 @@ namespace Noddybox.Emulation.EightBit.Z80.Test return q; } + static bool Run(Queue test, Queue expected, bool stop) + { + bool ok = true; + + if (test.Peek() != expected.Peek()) + { + throw new Exception(String.Format("Test name {0}, expected name {1}", test.Peek(), expected.Peek())); + } + + TestMachine m = new TestMachine(); + expected.Dequeue(); + + if (!m.Run(test.Dequeue(), test, expected, stop)) + { + ok = false; + } + + return ok; + } + static void Main(string[] args) { try @@ -74,17 +95,22 @@ namespace Noddybox.Emulation.EightBit.Z80.Test if (t.Count > 0) { - if (t.Peek() != e.Peek()) - { - throw new Exception(String.Format("Test name {0}, expected name {1}", t.Peek(), e.Peek())); - } - - TestMachine m = new TestMachine(); - e.Dequeue(); + Queue t2 = new Queue(t); + Queue e2 = new Queue(t); - if (!m.Run(t.Dequeue(), t, e)) + if (!Run(t, e, false)) { - Console.ReadKey(true); + if (!Debugger.IsAttached) + { + if (Console.ReadKey(true).Key == ConsoleKey.Q) + { + return; + } + } + else + { + Run(t2, e2, true); + } } } } -- cgit v1.3