Start work towards WDC 65C02 implementation

This commit is contained in:
Adrian Conlon committed 2026-05-02 17:02:36 +01:00
1 parent 10106657d3
commit 69a0865ee9
10 files changed
+61 -28

No files matched your search

+2 -2
View File
@@ -12,11 +12,11 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningLevel>8</WarningLevel>
<WarningLevel>9999</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<WarningLevel>8</WarningLevel>
<WarningLevel>9999</WarningLevel>
</PropertyGroup>
<ItemGroup>
+4
View File
@@ -180,8 +180,12 @@
var actualAddress = actualCycle.Address;
_ = this.Check("Cycle address", expectedAddress, actualAddress);
Debug.Assert(expectedCycle.Value is not null);
var expectedValue = (byte)expectedCycle.Value;
Debug.Assert(actualCycle.Value is not null);
var actualValue = (byte)actualCycle.Value;
_ = this.Check("Cycle value", expectedValue, actualValue);
var expectedAction = expectedCycle.Type;
+7 -2
View File
@@ -1,4 +1,6 @@
namespace SM83.HarteTest
using System.Diagnostics;
namespace SM83.HarteTest
{
internal sealed class Cycle
{
@@ -26,7 +28,10 @@
this.Address = AsElement(input[0]).GetUInt16();
this.Value = AsElement(input[1]).GetByte();
this.Type = AsElement(input[2]).GetString();
var possibleType = AsElement(input[2]).GetString();
Debug.Assert(possibleType != null);
this.Type = possibleType;
}
private static System.Text.Json.JsonElement AsElement(object part) => (System.Text.Json.JsonElement)part;
+1 -1
View File
@@ -4,7 +4,7 @@
namespace SM83.HarteTest
{
public static class Program
internal static class Program
{
public static async Task Main(string[] _)
{
+18 -18
View File
@@ -349,7 +349,7 @@ namespace M6502
case 0x25: this.ZeroPage(); this.AND(); break; // AND (zero page)
case 0x26: this.ZeroPage(); this.ROL(); break; // ROL (zero page)
case 0x28: this.PLP(); break; // PLP (implied)
case 0x29: this.FetchByte(); this.AND(); break; // AND (immediate)
case 0x29: this.Immediate(); this.AND(); break; // AND (immediate)
case 0x2a: this.ROLA(); break; // ROL A (implied)
case 0x2c: this.Absolute(); this.BIT(); break; // BIT (absolute)
case 0x2d: this.Absolute(); this.AND(); break; // AND (absolute)
@@ -710,54 +710,54 @@ namespace M6502
#region Address and read
protected byte Immediate() => this.FetchByte();
protected void Immediate() => this.FetchByte();
protected byte Absolute()
protected void Absolute()
{
this.AbsoluteAddress();
return this.MemoryRead();
this.MemoryRead();
}
protected byte ZeroPage()
protected void ZeroPage()
{
this.ZeroPageAddress();
return this.MemoryRead();
this.MemoryRead();
}
protected byte ZeroPageX()
protected void ZeroPageX()
{
this.ZeroPageXAddress();
return this.MemoryRead();
this.MemoryRead();
}
protected byte ZeroPageY()
protected void ZeroPageY()
{
this.ZeroPageYAddress();
return this.MemoryRead();
this.MemoryRead();
}
protected byte IndexedIndirectX()
protected void IndexedIndirectX()
{
this.IndexedIndirectXAddress();
return this.MemoryRead();
this.MemoryRead();
}
protected byte AbsoluteX()
protected void AbsoluteX()
{
this.AbsoluteXAddress();
return this.MaybeFixupRead();
this.MaybeFixupRead();
}
protected byte AbsoluteY()
protected void AbsoluteY()
{
this.AbsoluteYAddress();
return this.MaybeFixupRead();
this.MaybeFixupRead();
}
protected byte IndirectIndexedY()
protected void IndirectIndexedY()
{
this.IndirectIndexedYAddress();
return this.MaybeFixupRead();
this.MaybeFixupRead();
}
#endregion
@@ -9,6 +9,14 @@
<AnalysisLevel>latest-all</AnalysisLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningLevel>9999</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<WarningLevel>9999</WarningLevel>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\EightBit\EightBit.csproj" />
<ProjectReference Include="..\M6502.csproj" />
+8
View File
@@ -8,4 +8,12 @@
<AnalysisLevel>latest-all</AnalysisLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningLevel>9999</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<WarningLevel>9999</WarningLevel>
</PropertyGroup>
</Project>
+1 -1
View File
@@ -6,7 +6,7 @@ namespace M6502.Test
{
using EightBit;
internal class Configuration
internal sealed class Configuration
{
public bool DebugMode { get; set; }
+11 -3
View File
@@ -95,6 +95,7 @@ namespace M6502
case 0x52: this.ZeroPageIndirect(); this.EOR(); break; // EOR (zp)
case 0x53: break; // null
case 0x54: this.ZeroPageX(); break; // zp,x NOP
case 0x57: this.ZeroPage(); this.RMB5(); break; // RMB5 zp
case 0x5a: this.PHY(); break; // PHY s
case 0x5b: break; // null
@@ -121,7 +122,7 @@ namespace M6502
case 0x80: this.BRA(); break; // BRA r
case 0x83: break; // null
case 0x87: this.ZeroPage(); this.SMB0(); break; // SMB0 zp
case 0x89: break; // BIT # (TBC)
case 0x89: this.Immediate(); this.BIT_immediate(); break; // BIT # (TBC)
case 0x8b: break; // null
case 0x8f: this.ZeroPage(); this.BBS0(); break; // BBS0 r
@@ -130,7 +131,7 @@ namespace M6502
case 0x97: this.ZeroPage(); this.SMB1(); break; // SMB1 zp
case 0x9b: break; // null
case 0x9c: this.AbsoluteAddress(); this.STZ(); break; // STZ a
case 0x9e: this.AbsoluteXAddress(); this.STZ(); break; // STZ a,x
case 0x9e: this.AbsoluteXAddress(); this.Fixup(); this.STZ(); break; // STZ a,x
case 0x9f: this.ZeroPage(); this.BBS1(); break; // BBS1 r
case 0xa3: break; // null
@@ -151,10 +152,11 @@ namespace M6502
case 0xd2: this.ZeroPageIndirect(); this.CMP(); break; // CMP (zp)
case 0xd3: break; // null
case 0xd4: this.ZeroPageX(); break; // zp,x NOP
case 0xd7: this.ZeroPage(); this.SMB5(); break; // SMB5 zp
case 0xda: this.PHX(); break; // PHX s
case 0xdb: this.STP(); break; // STP i
case 0xdc: this.SwallowRead(); break; // null
case 0xdc: this.Absolute(); break; // null
case 0xdf: this.ZeroPage(); this.BBS5(); break; // BBS5 r
case 0xe3: break; // null
@@ -164,6 +166,7 @@ namespace M6502
case 0xf2: this.ZeroPageIndirect(); this.SBC(); break; // SBC (zp)
case 0xf3: break; // null
case 0xf4: this.ZeroPageX(); break; // zp,x NOP
case 0xf7: this.ZeroPage(); this.SMB7(); break; // SMB7 zp
case 0xfa: this.PLX(); break; // PLX s
case 0xfb: break; // null
@@ -273,6 +276,11 @@ namespace M6502
#endregion
private void BIT_immediate()
{
this.AdjustZero((byte)(this.A & this.Bus.Data));
}
private void INCA()
{
this.SwallowRead();
+1 -1
View File
@@ -4,7 +4,7 @@
namespace Z80.HarteTest
{
public static class Program
internal static class Program
{
public static async Task Main(string[] _)
{