mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-10-24 14:05:42 +00:00
Modified so I can run my 6809 sudoku solver, similar to 6502 version.
This commit is contained in:
1 parent
d67c03b18f
commit
b64c997f89
4 files changed
+20
-45
No files matched your search
@@ -23,9 +23,10 @@ namespace MC6809.Test
|
||||
private readonly Disassembler _disassembler;
|
||||
private readonly Profiler _profiler;
|
||||
|
||||
private ulong _totalCycleCount;
|
||||
private long _frameCycleCount;
|
||||
|
||||
private readonly Register16 _oldPC = new((ushort)Mask.Sixteen);
|
||||
|
||||
// The _disassembleAt and _ignoreDisassembly are used to skip pin events
|
||||
private ushort _disassembleAt;
|
||||
private bool _ignoreDisassembly;
|
||||
@@ -101,9 +102,13 @@ namespace MC6809.Test
|
||||
{
|
||||
Console.TreatControlCAsInput = true;
|
||||
|
||||
// Load our BASIC interpreter
|
||||
var directory = this._configuration.RomDirectory + "\\";
|
||||
LoadHexFile(directory + "ExBasROM.hex");
|
||||
|
||||
// Load our BASIC interpreter
|
||||
LoadHexFile(directory + "searle\\ExBasROM.hex");
|
||||
|
||||
// Load our Sudoku solver
|
||||
//LoadHexFile(directory + "6809_sudoku\\sudoku.hex");
|
||||
|
||||
// Catch a byte being transmitted
|
||||
this.ACIA.Transmitting += ACIA_Transmitting;
|
||||
@@ -163,8 +168,11 @@ namespace MC6809.Test
|
||||
|
||||
private void CPU_ExecutedInstruction_Termination(object? sender, EventArgs e)
|
||||
{
|
||||
this._totalCycleCount += (ulong)this.CPU.Cycles;
|
||||
if (this._totalCycleCount > Configuration.TerminationCycles)
|
||||
if (this._oldPC != this.CPU.PC)
|
||||
{
|
||||
this._oldPC.Assign(this.CPU.PC);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.LowerPOWER();
|
||||
}
|
||||
|
||||
@@ -8,12 +8,11 @@ namespace EightBit
|
||||
{
|
||||
public static readonly ulong CyclesPerSecond = 2 * 1024 * 1024;
|
||||
public static readonly ulong FrameCycleInterval = CyclesPerSecond / 60;
|
||||
public static readonly ulong TerminationCycles = CyclesPerSecond * 10 * 10;
|
||||
|
||||
|
||||
public bool DebugMode { get; set; } = false;
|
||||
|
||||
public bool TerminatesEarly { get; } = false;
|
||||
public bool TerminatesEarly { get; } = true;
|
||||
|
||||
public string RomDirectory { get; } = "roms\\searle";
|
||||
public string RomDirectory { get; } = "roms";
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
namespace EightBit
|
||||
{
|
||||
using MC6809.Test;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
@@ -14,7 +16,8 @@ namespace EightBit
|
||||
configuration.DebugMode = true;
|
||||
#endif
|
||||
|
||||
var harness = new TestHarness(configuration);
|
||||
var board = new Board(configuration);
|
||||
var harness = new EightBit.TestHarness<Board, MC6809.MC6809>(board, board.CPU);
|
||||
harness.Run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// <copyright file="TestHarness.cs" company="Adrian Conlon">
|
||||
// Copyright (c) Adrian Conlon. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace EightBit
|
||||
{
|
||||
using MC6809.Test;
|
||||
using System.Diagnostics;
|
||||
|
||||
internal sealed class TestHarness(Configuration configuration)
|
||||
{
|
||||
private readonly Stopwatch timer = new();
|
||||
private readonly Board board = new(configuration);
|
||||
private long totalCycles;
|
||||
|
||||
public void Run()
|
||||
{
|
||||
this.board.Initialize();
|
||||
this.board.RaisePOWER();
|
||||
|
||||
var cpu = this.board.CPU;
|
||||
|
||||
this.timer.Start();
|
||||
while (cpu.Powered)
|
||||
{
|
||||
this.totalCycles += cpu.Step();
|
||||
}
|
||||
|
||||
this.timer.Stop();
|
||||
|
||||
System.Console.Out.WriteLine($"\n\nGuest cycles = {this.totalCycles}");
|
||||
System.Console.Out.WriteLine($"Seconds = {this.timer.ElapsedMilliseconds / 1000.0}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user