More analysis suggestions

This commit is contained in:
Adrian Conlon 2024-05-30 22:20:26 +01:00
parent 59098d0305
commit a3a8c41ff1
8 changed files with 29 additions and 37 deletions

View File

@ -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)

View File

@ -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();
}
}
}

View File

@ -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()

View File

@ -2,13 +2,13 @@
// Copyright (c) Adrian Conlon. All rights reserved.
// </copyright>
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";

View File

@ -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;

View File

@ -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);
}
}
}
}

View File

@ -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,

View File

@ -4,10 +4,6 @@
namespace EightBit
{
using System;
using System.Collections.Generic;
using System.IO;
public class Symbols
{
private readonly Dictionary<string, Dictionary<string, Dictionary<string, string>>> parsed = [];
@ -98,7 +94,7 @@ namespace EightBit
{
if (!this.parsed.ContainsKey(type))
{
this.parsed[type] = new Dictionary<string, Dictionary<string, string>>();
this.parsed[type] = [];
}
var id = data["id"];