diff --git a/M6502/Disassembly.cs b/M6502/Disassembly.cs index a33dd17..d3ef9a7 100644 --- a/M6502/Disassembly.cs +++ b/M6502/Disassembly.cs @@ -8,9 +8,9 @@ namespace EightBit public class Disassembly { - private Bus bus; - private M6502 processor; - private Symbols symbols; + private readonly Bus bus; + private readonly M6502 processor; + private readonly Symbols symbols; private ushort address; public Disassembly(Bus bus, M6502 processor, Symbols symbols) diff --git a/M6502/M6502.cs b/M6502/M6502.cs index 6ba402c..e64015e 100644 --- a/M6502/M6502.cs +++ b/M6502/M6502.cs @@ -12,12 +12,6 @@ namespace EightBit private const byte RSTvector = 0xfc; // RST vector private const byte NMIvector = 0xfa; // NMI vector - private byte x = 0; - private byte y = 0; - private byte a = 0; - private byte s = 0; - private byte p = 0; - private ushort intermediate; private bool handlingRESET = false; @@ -70,15 +64,15 @@ namespace EightBit public event EventHandler LoweredRDY; - public byte X { get => this.x; set => this.x = value; } + public byte X { get; set; } = 0; - public byte Y { get => this.y; set => this.y = value; } + public byte Y { get; set; } = 0; - public byte A { get => this.a; set => this.a = value; } + public byte A { get; set; } = 0; - public byte S { get => this.s; set => this.s = value; } + public byte S { get; set; } = 0; - public byte P { get => this.p; set => this.p = value; } + public byte P { get; set; } = 0; private int InterruptMasked => this.P & (byte)StatusBits.IF; diff --git a/M6502/Symbols.cs b/M6502/Symbols.cs index 2fe4de7..6164970 100644 --- a/M6502/Symbols.cs +++ b/M6502/Symbols.cs @@ -10,10 +10,6 @@ namespace EightBit public class Symbols { - private readonly Dictionary labels; - private readonly Dictionary constants; - private readonly Dictionary scopes; - private readonly Dictionary addresses; private readonly Dictionary>> parsed; public Symbols() @@ -23,10 +19,10 @@ namespace EightBit public Symbols(string path) { - this.labels = new Dictionary(); - this.constants = new Dictionary(); - this.scopes = new Dictionary(); - this.addresses = new Dictionary(); + this.Labels = new Dictionary(); + this.Constants = new Dictionary(); + this.Scopes = new Dictionary(); + this.Addresses = new Dictionary(); this.parsed = new Dictionary>>(); if (path.Length > 0) @@ -37,13 +33,13 @@ namespace EightBit } } - public Dictionary Labels => this.labels; + public Dictionary Labels { get; } - public Dictionary Constants => this.constants; + public Dictionary Constants { get; } - public Dictionary Scopes => this.scopes; + public Dictionary Scopes { get; } - public Dictionary Addresses => this.addresses; + public Dictionary Addresses { get; } private void AssignScopes() { @@ -54,7 +50,7 @@ namespace EightBit var name = parsedScope["name"]; var trimmedName = name.Substring(1, name.Length - 2); var size = parsedScope["size"]; - this.scopes[trimmedName] = ushort.Parse(size); + this.Scopes[trimmedName] = ushort.Parse(size); } } @@ -71,12 +67,12 @@ namespace EightBit var symbolType = symbol["type"]; if (symbolType == "lab") { - this.labels[number] = trimmedName; - this.addresses[trimmedName] = number; + this.Labels[number] = trimmedName; + this.Addresses[trimmedName] = number; } else if (symbolType == "equ") { - this.constants[number] = trimmedName; + this.Constants[number] = trimmedName; } } }