mirror of
https://github.com/ApfelTeeSaft/DotNesJit.git
synced 2026-08-26 19:23:35 +00:00
Testrunner ignore N and V flags in bcd mode
This commit is contained in:
@@ -210,6 +210,9 @@ public static class InstructionConverter
|
||||
|
||||
var setAcc = new Ir6502.Copy(result, accumulator);
|
||||
|
||||
// Note: I can't find reliable info on what the zero flag should be in decimal mode. 6502 test suite
|
||||
// claims it should follow non-BCD logic, but other references state it should be zero result from BCD logic.
|
||||
// For now I'm just going to assume it follows a zero result but will probably revisit.
|
||||
var setZeroFlag = new Ir6502.Binary(
|
||||
Ir6502.BinaryOperator.Equals,
|
||||
result,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Text.Json;
|
||||
using Dotnet6502.Common.Compilation;
|
||||
using Dotnet6502.Common.Hardware;
|
||||
using NESDecompiler.Core.CPU;
|
||||
using NESDecompiler.Core.Disassembly;
|
||||
|
||||
@@ -131,10 +132,25 @@ public static class TestRunner
|
||||
errorMessages.Add($"Y: expected {testCase.Final.Y}, actual {jit.TestHal.YRegister}");
|
||||
}
|
||||
|
||||
if (jit.TestHal.ProcessorStatus != testCase.Final.P)
|
||||
// If we are in decimal mode, we need to ignore the negative and overflow flags, as they are
|
||||
// undefined behavior.
|
||||
if (jit.TestHal.GetFlag(CpuStatusFlags.Decimal))
|
||||
{
|
||||
hasFailure = true;
|
||||
errorMessages.Add($"P: expected {testCase.Final.P}, actual {jit.TestHal.ProcessorStatus}");
|
||||
var testValue = jit.TestHal.ProcessorStatus & 0b00111111;
|
||||
var expectedValue = testCase.Final.P & 0b00111111;
|
||||
if (testValue != expectedValue)
|
||||
{
|
||||
hasFailure = true;
|
||||
errorMessages.Add($"Decimal mode P: expected {expectedValue}, actual {testValue}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (jit.TestHal.ProcessorStatus != testCase.Final.P)
|
||||
{
|
||||
hasFailure = true;
|
||||
errorMessages.Add($"P: expected {testCase.Final.P}, actual {jit.TestHal.ProcessorStatus}");
|
||||
}
|
||||
}
|
||||
|
||||
if (jit.TestHal.StackPointer != testCase.Final.S)
|
||||
|
||||
Reference in New Issue
Block a user