From f432f1be20d3f0fc35727bbb447401660d0a3a89 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Wed, 14 Aug 2019 08:02:57 +0100 Subject: [PATCH] Correct AF output in Z80 Fuse test runner. Signed-off-by: Adrian Conlon --- Z80/Z80.FuseTest/TestRunner.cs | 36 +++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/Z80/Z80.FuseTest/TestRunner.cs b/Z80/Z80.FuseTest/TestRunner.cs index 6088fba..c03b9a5 100644 --- a/Z80/Z80.FuseTest/TestRunner.cs +++ b/Z80/Z80.FuseTest/TestRunner.cs @@ -207,9 +207,20 @@ namespace Fuse if (!af) { - var expectedWord = expectedRegisters[(int)Register.AF]; - var actualWord = this.cpu.AF; - DumpDifference("A", "F", expectedWord, actualWord); + var expectedA = expectedRegisters[(int)Register.AF].High; + var gotA = this.cpu.A; + if (expectedA != gotA) + { + DumpDifference("A", expectedA, gotA); + } + + var expectedF = expectedRegisters[(int)Register.AF].Low; + var gotF = this.cpu.F; + if (expectedF != gotF) + { + var output = $"**** F, Expected: {EightBit.Disassembler.AsFlags(expectedF)}, Got: {EightBit.Disassembler.AsFlags(gotF)}"; + System.Console.Error.WriteLine(output); + } } if (!bc) @@ -273,9 +284,20 @@ namespace Fuse if (!af_) { - var expectedWord = expectedRegisters[(int)Register.AF_]; - var actualWord = this.cpu.AF; - DumpDifference("A'", "F'", expectedWord, actualWord); + var expectedA = expectedRegisters[(int)Register.AF_].High; + var gotA = this.cpu.A; + if (expectedA != gotA) + { + DumpDifference("A'", expectedA, gotA); + } + + var expectedF = expectedRegisters[(int)Register.AF_].Low; + var gotF = this.cpu.F; + if (expectedF != gotF) + { + var output = $"**** F', Expected: {EightBit.Disassembler.AsFlags(expectedF)}, Got: {EightBit.Disassembler.AsFlags(gotF)}"; + System.Console.Error.WriteLine(output); + } } if (!bc_) @@ -307,7 +329,7 @@ namespace Fuse if (!refresh) { - var output = $"**** R, Expected: {expectedState.R:X2}, Got: {this.cpu.REFRESH:X2}"; + var output = $"**** R, Expected: {expectedState.R:X2}, Got: {this.cpu.REFRESH.ToByte():X2}"; System.Console.Error.WriteLine(output); }