diff --git a/EightBit/Bus.cs b/EightBit/Bus.cs index 6bbe12e..9d4d21f 100644 --- a/EightBit/Bus.cs +++ b/EightBit/Bus.cs @@ -132,10 +132,8 @@ namespace EightBit protected void LoadHexFile(string path) { using var file = new IntelHexFile(path); - foreach (var chunk in file.Parse()) + foreach (var (address, content) in file.Parse()) { - var address = chunk.Item1; - var content = chunk.Item2; var mapped = this.Mapping(address); var offset = address - mapped.Begin; mapped.Memory.Load(content, offset); diff --git a/M6502/M6502.Symbols/Parser.cs b/M6502/M6502.Symbols/Parser.cs index 863a4e1..fbbd984 100644 --- a/M6502/M6502.Symbols/Parser.cs +++ b/M6502/M6502.Symbols/Parser.cs @@ -302,11 +302,9 @@ Debug.Assert(into.Count == 0); into.Capacity = parsed.Count; - foreach (var element in parsed) + foreach (var (id, information) in parsed) { - var id = element.Key; Debug.Assert(into.Count == id); - var information = element.Value; var entry = new T(); entry.Parse(this, information); into.Add(entry); diff --git a/M6502/Profiler.cs b/M6502/Profiler.cs index 58c9a8d..995667c 100644 --- a/M6502/Profiler.cs +++ b/M6502/Profiler.cs @@ -4,11 +4,11 @@ public sealed class Profiler { - private readonly int[] instructionCounts; - private readonly int[] addressProfiles; - private readonly int[] addressCounts; + private readonly int[] instructionCounts = new int[0x100]; + private readonly int[] addressProfiles = new int[0x10000]; + private readonly int[] addressCounts = new int[0x10000]; - private readonly Dictionary scopeCycles; + private readonly Dictionary scopeCycles = []; private readonly M6502 processor; private readonly Disassembler disassembler; @@ -31,12 +31,6 @@ this.processor.RaisingSYNC += this.Processor_RaisingSYNC; this.processor.ExecutedInstruction += this.Processor_ExecutedInstruction; } - - this.instructionCounts = new int[0x100]; - this.addressProfiles = new int[0x10000]; - this.addressCounts = new int[0x10000]; - - this.scopeCycles = []; } public event EventHandler? StartingOutput; @@ -100,11 +94,9 @@ this.OnStartingScopeOutput(); try { - foreach (var scopeCycle in this.scopeCycles) + foreach (var (name, cycles) in this.scopeCycles) { - var name = scopeCycle.Key; Debug.Assert(name != null); - var cycles = scopeCycle.Value; var symbol = this.symbols.LookupLabel(name); Debug.Assert(symbol != null); var count = this.addressCounts[symbol.Value];