More analysis suggestions

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-02-06 23:50:25 +00:00
parent 0e8a530573
commit e66525e45f
3 changed files with 20 additions and 30 deletions

View File

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

View File

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

View File

@ -10,10 +10,6 @@ namespace EightBit
public class Symbols
{
private readonly Dictionary<ushort, string> labels;
private readonly Dictionary<ushort, string> constants;
private readonly Dictionary<string, ushort> scopes;
private readonly Dictionary<string, ushort> addresses;
private readonly Dictionary<string, Dictionary<string, Dictionary<string, string>>> parsed;
public Symbols()
@ -23,10 +19,10 @@ namespace EightBit
public Symbols(string path)
{
this.labels = new Dictionary<ushort, string>();
this.constants = new Dictionary<ushort, string>();
this.scopes = new Dictionary<string, ushort>();
this.addresses = new Dictionary<string, ushort>();
this.Labels = new Dictionary<ushort, string>();
this.Constants = new Dictionary<ushort, string>();
this.Scopes = new Dictionary<string, ushort>();
this.Addresses = new Dictionary<string, ushort>();
this.parsed = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
if (path.Length > 0)
@ -37,13 +33,13 @@ namespace EightBit
}
}
public Dictionary<ushort, string> Labels => this.labels;
public Dictionary<ushort, string> Labels { get; }
public Dictionary<ushort, string> Constants => this.constants;
public Dictionary<ushort, string> Constants { get; }
public Dictionary<string, ushort> Scopes => this.scopes;
public Dictionary<string, ushort> Scopes { get; }
public Dictionary<string, ushort> Addresses => this.addresses;
public Dictionary<string, ushort> 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;
}
}
}