Csproj cleanup and always pass unused processor status bit as 1, per 6502 spec

This commit is contained in:
KallDrexx
2025-12-30 15:32:34 -05:00
parent 05b32148d7
commit 730f5bc970
11 changed files with 21 additions and 22 deletions
@@ -7,7 +7,7 @@ public class Base6502Hal
private readonly MemoryBus _memoryBus;
private readonly Dictionary<CpuStatusFlags, bool> _flags = new()
{
{ CpuStatusFlags.Unused, false },
{ CpuStatusFlags.Unused, true },
{ CpuStatusFlags.BFlag, false },
{ CpuStatusFlags.Carry, false },
{ CpuStatusFlags.Decimal, false },
@@ -12,12 +12,7 @@
</ItemGroup>
<ItemGroup>
<None Include="../../65x02/**" CopyToOutputDirectory="Always" />
<None Remove="..\..\65x02\6502\**" />
<None Remove="..\..\65x02\rockwell65c02\**" />
<None Remove="..\..\65x02\synertek65c02\**" />
<None Remove="..\..\65x02\wdc65c02\**" />
<None Remove="..\..\65x02\*" />
<None Include="../../65x02/**" CopyToOutputDirectory="Always" Visible="false" />
</ItemGroup>
</Project>
@@ -36,11 +36,15 @@ try
Console.WriteLine($"Failures written to: {absoluteOutputPath}");
return 1;
}
else
if (totalTests == 0)
{
Console.WriteLine("All tests passed!");
return 0;
Console.WriteLine("No test cases found!");
return 1;
}
Console.WriteLine("All tests passed!");
return 0;
}
catch (Exception ex)
{
@@ -15,7 +15,7 @@ public static class TestRunner
// Find all opcodes that match this mnemonic
var matchingOpcodes = new List<byte>();
for (byte opcode = 0; opcode <= 0xFF; opcode++)
for (byte opcode = 0;; opcode++)
{
var instructionInfo = InstructionSet.GetInstruction(opcode);
if (instructionInfo.Mnemonic.Equals(mnemonic, StringComparison.OrdinalIgnoreCase))
@@ -65,7 +65,7 @@ public class BrkTests
jit.AddMethod(0x3456, [callableInstruction]); // IRQ address
jit.RunMethod(0x1234);
jit.TestHal.PopFromStack().ShouldBe((byte)0b11011111);
jit.TestHal.PopFromStack().ShouldBe((byte)0b11111111);
jit.TestHal.PopFromStack().ShouldBe((byte)0x47); // low address byte
jit.TestHal.PopFromStack().ShouldBe((byte)0x23); // high address byte
}
@@ -127,6 +127,6 @@ public class BrkTests
jit.AddMethod(0x3456, [callableInstruction]); // IRQ address
jit.RunMethod(0x1234);
jit.TestHal.PopFromStack().ShouldBe((byte)0b00010000);
jit.TestHal.PopFromStack().ShouldBe((byte)0b00110000);
}
}
@@ -35,7 +35,7 @@ public class RtiTests
jit.AddMethod(0x2345, [callableInstruction]);
jit.RunMethod(0x1234);
jit.TestHal.ProcessorStatus.ShouldBe((byte)0b11001111);
jit.TestHal.ProcessorStatus.ShouldBe((byte)0b11101111);
jit.TestHal.ReadMemory(0x4000).ShouldBe((byte)99); // Verify return address was called
}
}
@@ -469,7 +469,7 @@ public class BinaryInstructionTests
jit.AddMethod(0x1234, [instruction]);
jit.RunMethod(0x1234);
jit.TestHal.YRegister.ShouldBe((byte)0x85);
jit.TestHal.YRegister.ShouldBe((byte)0xA5);
}
[Fact]
@@ -533,7 +533,7 @@ public class CopyInstructionTests
jit.AddMethod(0x1234, [instruction]);
jit.RunMethod(0x1234);
jit.TestHal.ARegister.ShouldBe((byte)0x85);
jit.TestHal.ARegister.ShouldBe((byte)0xA5);
}
[Fact]
@@ -548,7 +548,7 @@ public class CopyInstructionTests
jit.AddMethod(0x1234, [instruction]);
jit.RunMethod(0x1234);
jit.TestHal.ProcessorStatus.ShouldBe((byte)0x85);
jit.TestHal.ProcessorStatus.ShouldBe((byte)0xA5);
}
[Fact]
@@ -563,7 +563,7 @@ public class CopyInstructionTests
jit.AddMethod(0x1234, [instruction]);
jit.RunMethod(0x1234);
jit.TestHal.ReadMemory(0xB000).ShouldBe((byte)0x85);
jit.TestHal.ReadMemory(0xB000).ShouldBe((byte)0xA5);
}
[Fact]
@@ -578,7 +578,7 @@ public class CopyInstructionTests
jit.TestHal.WriteMemory(0xC000, 0x85);
jit.RunMethod(0x1234);
jit.TestHal.ProcessorStatus.ShouldBe((byte)0x85);
jit.TestHal.ProcessorStatus.ShouldBe((byte)0xA5);
}
[Fact]
@@ -54,7 +54,7 @@ public class PollForInterruptsTests
jit.AddMethod(0x9078, []);
jit.RunMethod(0x1234);
jit.TestHal.PopFromStack().ShouldBe((byte)0b11001111);
jit.TestHal.PopFromStack().ShouldBe((byte)0b11101111);
jit.TestHal.PopFromStack().ShouldBe((byte)0x56);
jit.TestHal.PopFromStack().ShouldBe((byte)0x34);
}
@@ -189,7 +189,7 @@ public class PopStackValueInstructionTests
jit.TestHal.PushToStack(0x85);
jit.RunMethod(0x1234);
jit.TestHal.ProcessorStatus.ShouldBe((byte)0x85);
jit.TestHal.ProcessorStatus.ShouldBe((byte)0xA5);
}
[Fact]
@@ -174,7 +174,7 @@ public class PushStackValueInstructionTests
jit.AddMethod(0x1234, [instruction]);
jit.RunMethod(0x1234);
jit.TestHal.PopFromStack().ShouldBe((byte)0x85);
jit.TestHal.PopFromStack().ShouldBe((byte)0xA5);
}
[Fact]