diff --git a/M6502/M6502.HarteTest/Checker.cs b/M6502/M6502.HarteTest/Checker.cs index 2702f11..402bab2 100644 --- a/M6502/M6502.HarteTest/Checker.cs +++ b/M6502/M6502.HarteTest/Checker.cs @@ -157,15 +157,15 @@ var expected_address = expected_cycle.Address; var actual_address = actual_cycle.Address; - this.Check("Cycle address", expected_address, actual_address); + _ = this.Check("Cycle address", expected_address, actual_address); var expected_value = expected_cycle.Value; var actual_value = actual_cycle.Value; - this.Check("Cycle value", expected_value, actual_value); + _ = this.Check("Cycle value", expected_value, actual_value); var expected_action = expected_cycle.Type; var actual_action = actual_cycle.Type; - this.Check("Cycle action", expected_action, actual_action); + _ = this.Check("Cycle action", expected_action, actual_action); } if (actual_idx < actual_cycles.Count) diff --git a/M6502/M6502.HarteTest/Cycle.cs b/M6502/M6502.HarteTest/Cycle.cs index 8d08bc3..77d9cd1 100644 --- a/M6502/M6502.HarteTest/Cycle.cs +++ b/M6502/M6502.HarteTest/Cycle.cs @@ -23,8 +23,8 @@ } this.Address = ((System.Text.Json.JsonElement)input[0]).GetUInt16(); - this.Value = ((System.Text.Json.JsonElement)input[1]).GetByte(); ; - this.Type = ((System.Text.Json.JsonElement)input[2]).GetString(); ; + this.Value = ((System.Text.Json.JsonElement)input[1]).GetByte(); + this.Type = ((System.Text.Json.JsonElement)input[2]).GetString(); } } } diff --git a/M6502/M6502.HarteTest/OpcodeTestSuite.cs b/M6502/M6502.HarteTest/OpcodeTestSuite.cs index 122b2eb..8b7a82b 100644 --- a/M6502/M6502.HarteTest/OpcodeTestSuite.cs +++ b/M6502/M6502.HarteTest/OpcodeTestSuite.cs @@ -1,8 +1,8 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace M6502.HarteTest +namespace M6502.HarteTest { + using System.Text.Json; + using System.Text.Json.Serialization; + internal class OpcodeTestSuite(string path) : IDisposable { private static readonly JsonSerializerOptions SerializerOptions = new() diff --git a/M6502/M6502.HarteTest/Program.cs b/M6502/M6502.HarteTest/Program.cs index 2372db7..3107763 100644 --- a/M6502/M6502.HarteTest/Program.cs +++ b/M6502/M6502.HarteTest/Program.cs @@ -2,13 +2,13 @@ // Copyright (c) Adrian Conlon. All rights reserved. // -using System.IO; - namespace M6502.HarteTest { + using System.IO; + public static class Program { - public static async Task Main(string[] args) + public static async Task Main(string[] _) { var directory = @"C:\github\spectrum\libraries\EightBit\modules\65x02\6502\v1"; diff --git a/M6502/M6502.HarteTest/TestRunner.cs b/M6502/M6502.HarteTest/TestRunner.cs index 3f6c806..5479eec 100644 --- a/M6502/M6502.HarteTest/TestRunner.cs +++ b/M6502/M6502.HarteTest/TestRunner.cs @@ -1,12 +1,12 @@ -using EightBit; - -namespace M6502.HarteTest +namespace M6502.HarteTest { - internal class TestRunner : EightBit.Bus - { - public EightBit.Ram RAM { get; } = new(0x10000); + using EightBit; - public EightBit.M6502 CPU { get; } + internal class TestRunner : Bus + { + public Ram RAM { get; } = new(0x10000); + + public M6502 CPU { get; } private readonly MemoryMapping mapping; diff --git a/M6502/M6502.cs b/M6502/M6502.cs index c323742..8e98d6b 100644 --- a/M6502/M6502.cs +++ b/M6502/M6502.cs @@ -105,6 +105,7 @@ namespace EightBit private static int CarryTest(byte data) => data & (byte)StatusBits.CF; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")] public virtual void RaiseNMI() { if (this.NMI.Lowered()) @@ -125,6 +126,7 @@ namespace EightBit } } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")] public virtual void RaiseSO() { if (this.SO.Lowered()) @@ -145,6 +147,7 @@ namespace EightBit } } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")] public virtual void RaiseRDY() { if (this.RDY.Lowered()) @@ -165,6 +168,7 @@ namespace EightBit } } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")] public virtual void RaiseRW() { if (this.RW.Lowered()) @@ -586,6 +590,7 @@ namespace EightBit this.MemoryWrite(value); } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")] protected virtual void RaiseSYNC() { this.OnRaisingSYNC(); @@ -634,8 +639,6 @@ namespace EightBit private static byte ClearBit(byte f, StatusBits flag, int condition) => ClearBit(f, (byte)flag, condition); - private static byte ClearBit(byte f, StatusBits flag, bool condition) => ClearBit(f, (byte)flag, condition); - // Status flag operations private void SetFlag(StatusBits flag) @@ -659,11 +662,6 @@ namespace EightBit } private void ResetFlag(StatusBits which, int condition) - { - this.P = ClearBit(this.P, which, condition); - } - - private void ResetFlag(StatusBits which, bool condition) { this.P = ClearBit(this.P, which, condition); } @@ -856,7 +854,7 @@ namespace EightBit private void AdjustZero(byte datum) => this.ResetFlag(StatusBits.ZF, datum); - private void AdjustNegative(byte datum) => SetFlag(StatusBits.NF, NegativeTest(datum)); + private void AdjustNegative(byte datum) => this.SetFlag(StatusBits.NF, NegativeTest(datum)); private void AdjustNZ(byte datum) { @@ -874,8 +872,8 @@ namespace EightBit var relative = (sbyte)this.Bus.Data; this.Swallow(); this.NoteFixedAddress(this.PC.Word + relative); - this.Jump(this.intermediate.Word); this.MaybeFixup(); + this.Jump(this.Bus.Address.Word); } } @@ -1261,5 +1259,4 @@ namespace EightBit this.ModifyWrite(this.DEC()); this.CMP(this.A); } - } -} + } \ No newline at end of file diff --git a/M6502/StatusBits.cs b/M6502/StatusBits.cs index c48e41b..ab678ca 100644 --- a/M6502/StatusBits.cs +++ b/M6502/StatusBits.cs @@ -4,9 +4,8 @@ namespace EightBit { - using System; - [Flags] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1028:Enum Storage should be Int32", Justification = "Must be castable to byte")] public enum StatusBits : byte { None = 0, diff --git a/M6502/Symbols.cs b/M6502/Symbols.cs index f49f481..5ea0cd4 100644 --- a/M6502/Symbols.cs +++ b/M6502/Symbols.cs @@ -4,10 +4,6 @@ namespace EightBit { - using System; - using System.Collections.Generic; - using System.IO; - public class Symbols { private readonly Dictionary>> parsed = []; @@ -98,7 +94,7 @@ namespace EightBit { if (!this.parsed.ContainsKey(type)) { - this.parsed[type] = new Dictionary>(); + this.parsed[type] = []; } var id = data["id"];