Tidy for possible klaus/sudoku testing

This commit is contained in:
Adrian Conlon 2024-06-06 00:47:17 +01:00
parent 93e1e903f6
commit 0218652650
3 changed files with 35 additions and 22 deletions

View File

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

View File

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

View File

@ -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";
}
}