mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2025-01-23 23:30:07 +00:00
Some code simplifications
This commit is contained in:
parent
ef8f9f476b
commit
30f8b8a600
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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<string, int> scopeCycles;
|
||||
private readonly Dictionary<string, int> 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<EventArgs>? 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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user