diff --git a/M6502/M6502.Symbols/Parser.cs b/M6502/M6502.Symbols/Parser.cs index f7ef130..1c86d2d 100644 --- a/M6502/M6502.Symbols/Parser.cs +++ b/M6502/M6502.Symbols/Parser.cs @@ -296,13 +296,18 @@ #region Parser driver - public void Parse(string path) + public void Parse(string? path) { if (this.Parsed) { throw new InvalidOperationException("A file has already been parsed."); } + if (string.IsNullOrEmpty(path)) + { + return; + } + using var reader = new StreamReader(path); while (!reader.EndOfStream) { diff --git a/M6502/M6502.Test/Board.cs b/M6502/M6502.Test/Board.cs index 1687fdb..19f11de 100644 --- a/M6502/M6502.Test/Board.cs +++ b/M6502/M6502.Test/Board.cs @@ -38,17 +38,6 @@ namespace M6502.Test this.symbols.Parse(string.IsNullOrEmpty(this.configuration.Symbols) ? string.Empty : this.configuration.RomDirectory + "/" + this.configuration.Symbols); this.profiler = new Profiler(this.CPU, this.disassembler, this.symbols, this.configuration.Profile, this.configuration.Profile); - if (this.configuration.Profile) - { - this.profiler.StartingOutput += this.Profiler_StartingOutput; - this.profiler.FinishedOutput += this.Profiler_FinishedOutput; - this.profiler.StartingLineOutput += this.Profiler_StartingLineOutput; - this.profiler.FinishedLineOutput += this.Profiler_FinishedLineOutput; - this.profiler.StartingScopeOutput += this.Profiler_StartingScopeOutput; - this.profiler.FinishedScopeOutput += this.Profiler_FinishedScopeOutput; - this.profiler.EmitLine += this.Profiler_EmitLine; - this.profiler.EmitScope += this.Profiler_EmitScope; - } } public M6502 CPU { get; } @@ -100,6 +89,18 @@ namespace M6502.Test this.CPU.Bus.ReadByte += this.Bus_ReadByte; } + if (this.configuration.Profile) + { + this.profiler.StartingOutput += this.Profiler_StartingOutput; + this.profiler.FinishedOutput += this.Profiler_FinishedOutput; + this.profiler.StartingLineOutput += this.Profiler_StartingLineOutput; + this.profiler.FinishedLineOutput += this.Profiler_FinishedLineOutput; + this.profiler.StartingScopeOutput += this.Profiler_StartingScopeOutput; + this.profiler.FinishedScopeOutput += this.Profiler_FinishedScopeOutput; + this.profiler.EmitLine += this.Profiler_EmitLine; + this.profiler.EmitScope += this.Profiler_EmitScope; + } + this.Poke(0x00, 0x4c); this.CPU.PokeWord(0x01, this.configuration.StartAddress); } diff --git a/M6502/M6502.Test/Configuration.cs b/M6502/M6502.Test/Configuration.cs index f135c77..b2a5043 100644 --- a/M6502/M6502.Test/Configuration.cs +++ b/M6502/M6502.Test/Configuration.cs @@ -8,26 +8,33 @@ namespace M6502.Test internal class Configuration { - public Configuration() - { - } - public bool DebugMode { get; set; } = false; - public bool BreakOnRead { get; } = true; + public bool Profile { get; set; } = true; - public Register16 LoadAddress { get; } = new Register16(0x400); + public bool BreakOnKeyRead { get; } = true; - public Register16 StartAddress { get; } = new Register16(0x400); + // Sudoku + //public string Program { get; } = "sudoku.65b"; + //public string Symbols { get; } = "sudoku.dbg"; + //public Register16 InputAddress { get; } = new Register16(0xe000); + //public Register16 OutputAddress { get; } = new Register16(0xe001); + //public Register16 LoadAddress { get; } = new Register16(0xf000); + //public Register16 StartAddress { get; } = new Register16(0xf000); + //public bool AllowKeyRead { get; } = false; + + // Klaus + public string Program { get; } = "6502_functional_test.bin"; + public string Symbols { get; } = ""; public Register16 InputAddress { get; } = new Register16(0xf004); - public Register16 OutputAddress { get; } = new Register16(0xf001); + public Register16 LoadAddress { get; } = new Register16(0x400); + public Register16 StartAddress { get; } = new Register16(0x400); + public bool AllowKeyRead { get; } = true; public int PollingTickInterval { get; } = 10000000; public string RomDirectory { get; } = "roms"; - - public string Program { get; } = "6502_functional_test.bin"; } } \ No newline at end of file