mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-10-22 02:02:24 +00:00
Try and reduce the number of virtual calls in EightBit library
This commit is contained in:
1 parent
ee5f38e76b
commit
38a8d2d850
19 files changed
+153
-139
No files matched your search
+2
-2
@@ -21,7 +21,7 @@ namespace EightBit
|
||||
public ref PinLevel POWER => ref this._powerLine;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
public virtual void RaisePOWER()
|
||||
public void RaisePOWER()
|
||||
{
|
||||
if (this.POWER.Lowered())
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace EightBit
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void LowerPOWER()
|
||||
public void LowerPOWER()
|
||||
{
|
||||
if (this.POWER.Raised())
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace EightBit
|
||||
public IntelOpCodeDecoded GetDecodedOpCode(byte opCode) => this._decodedOpCodes[opCode];
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
public virtual void RaiseHALT()
|
||||
public void RaiseHALT()
|
||||
{
|
||||
if (this.HALT.Lowered())
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace EightBit
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void LowerHALT()
|
||||
public void LowerHALT()
|
||||
{
|
||||
if (this.HALT.Raised())
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace EightBit
|
||||
public static sbyte SignExtend(int b, int x) => SignExtend(b, (byte)x);
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "Not using VB.NET")]
|
||||
public virtual int Step()
|
||||
public int Step()
|
||||
{
|
||||
this.ResetCycles();
|
||||
this.ExecutingInstruction?.Invoke(this, EventArgs.Empty);
|
||||
@@ -114,7 +114,7 @@ namespace EightBit
|
||||
public void PokeShort(ushort address, ushort value) => this.PokeShort(address, new Register16(value));
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
public virtual void RaiseRESET()
|
||||
public void RaiseRESET()
|
||||
{
|
||||
if (this.RESET.Lowered())
|
||||
{
|
||||
@@ -124,7 +124,7 @@ namespace EightBit
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void LowerRESET()
|
||||
public void LowerRESET()
|
||||
{
|
||||
if (this.RESET.Raised())
|
||||
{
|
||||
@@ -135,7 +135,7 @@ namespace EightBit
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
public virtual void RaiseINT()
|
||||
public void RaiseINT()
|
||||
{
|
||||
if (this.INT.Lowered())
|
||||
{
|
||||
@@ -145,7 +145,7 @@ namespace EightBit
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void LowerINT()
|
||||
public void LowerINT()
|
||||
{
|
||||
if (this.INT.Raised())
|
||||
{
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace EightBit
|
||||
|
||||
public void Run()
|
||||
{
|
||||
this._logger.Verbosity = ILogger.LogLevel.Information;
|
||||
|
||||
this._board.Initialize();
|
||||
this._board.RaisePOWER();
|
||||
|
||||
|
||||
+11
-6
@@ -9,9 +9,9 @@
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public abstract class Game(ILogger.LogLevel logging) : Device
|
||||
public abstract class Game : Device
|
||||
{
|
||||
private readonly Wrapper _wrapper = new(logging);
|
||||
private readonly Wrapper _wrapper;
|
||||
private bool _vsync;
|
||||
|
||||
private readonly SortedDictionary<uint, GameController> _gameControllers = [];
|
||||
@@ -48,16 +48,21 @@
|
||||
|
||||
protected abstract uint[] Pixels();
|
||||
|
||||
public override void RaisePOWER()
|
||||
protected Game(ILogger.LogLevel logging)
|
||||
{
|
||||
this._wrapper = new(logging);
|
||||
this.RaisedPOWER += this.Game_RaisedPOWER;
|
||||
this.LoweringPOWER += this.Game_LoweringPOWER;
|
||||
}
|
||||
|
||||
private void Game_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.Initialise();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
private void Game_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.Terminate();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
public virtual void Initialise()
|
||||
|
||||
+13
-7
@@ -4,26 +4,32 @@
|
||||
using EightBit;
|
||||
using System;
|
||||
|
||||
public class Wrapper(ILogger.LogLevel logging = ILogger.LogLevel.Warning) : Device
|
||||
public class Wrapper : Device
|
||||
{
|
||||
private readonly ILogger _logger = new ConsoleLogger("Unnamed Game");
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private ILogger.LogLevel _verbosity = logging;
|
||||
private readonly ILogger.LogLevel _verbosity;
|
||||
|
||||
public ILogger Logger => this._logger;
|
||||
|
||||
public ILogger.LogLevel Verbosity => this._verbosity;
|
||||
|
||||
public override void RaisePOWER()
|
||||
public Wrapper(ILogger.LogLevel logging = ILogger.LogLevel.Warning)
|
||||
{
|
||||
this._logger = new ConsoleLogger("Unnamed Game");
|
||||
this._verbosity = logging;
|
||||
this.RaisedPOWER += this.Wrapper_RaisedPOWER;
|
||||
this.LoweringPOWER += this.Wrapper_LoweringPOWER;
|
||||
}
|
||||
|
||||
private void Wrapper_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.Initialise();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
private void Wrapper_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.Terminate();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
public virtual void Initialise()
|
||||
|
||||
@@ -24,22 +24,22 @@ namespace Intel8080.Test
|
||||
this.CPU = new Intel8080(this, this.ports);
|
||||
this.disassembler = new Disassembler(this);
|
||||
this.mapping = new MemoryMapping(this.ram, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);
|
||||
this.RaisedPOWER += this.Board_RaisedPOWER;
|
||||
this.LoweringPOWER += this.Board_LoweringPOWER;
|
||||
}
|
||||
|
||||
public Intel8080 CPU { get; }
|
||||
|
||||
public override void RaisePOWER()
|
||||
private void Board_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseRESET();
|
||||
this.CPU.RaiseINT();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
private void Board_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
|
||||
+14
-14
@@ -55,6 +55,8 @@ namespace LR35902
|
||||
this.IO = new IoRegisters(this, ioTriggers);
|
||||
this.CPU = new LR35902(this);
|
||||
this.CPU.MachineTicked += this.CPU_MachineTicked;
|
||||
this.RaisedPOWER += this.Bus_RaisedPOWER;
|
||||
this.LoweringPOWER += this.Bus_LoweringPOWER;
|
||||
|
||||
this._bootRomMapping = new(this._bootRom, 0x0000, Mask.Sixteen, AccessLevel.ReadOnly);
|
||||
this._vRamMapping = new(this.VRAM, 0x8000, 0xffff, AccessLevel.ReadWrite);
|
||||
@@ -69,6 +71,18 @@ namespace LR35902
|
||||
this.CPU.WrittenMemory += Bus_WrittenByte;
|
||||
}
|
||||
|
||||
private void Bus_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseINT();
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
private void Bus_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
}
|
||||
|
||||
public LR35902 CPU { get; }
|
||||
|
||||
public Ram VRAM { get; } = new Ram(0x2000);
|
||||
@@ -81,20 +95,6 @@ namespace LR35902
|
||||
|
||||
public bool GameRomEnabled => !this.GameRomDisabled;
|
||||
|
||||
public override void RaisePOWER()
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseINT();
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
this.IO.Reset();
|
||||
|
||||
@@ -16,17 +16,38 @@ namespace LR35902.FuseTest
|
||||
PC,
|
||||
}
|
||||
|
||||
public class TestRunner<T>(Test<T> test, Result<T> result) : Bus
|
||||
where T : IRegisterState, new()
|
||||
public class TestRunner<T> : Bus where T : IRegisterState, new()
|
||||
{
|
||||
private readonly Test<T> test = test;
|
||||
private readonly Result<T> result = result;
|
||||
private readonly Test<T> test;
|
||||
private readonly Result<T> result;
|
||||
private readonly EightBit.Ram ram = new(0x10000);
|
||||
private EightBit.MemoryMapping? mapping;
|
||||
|
||||
public bool Failed { get; private set; } = false;
|
||||
public bool Failed { get; private set; }
|
||||
|
||||
public bool Unimplemented { get; private set; } = false;
|
||||
public bool Unimplemented { get; private set; }
|
||||
|
||||
public TestRunner(Test<T> test, Result<T> result)
|
||||
{
|
||||
this.test = test;
|
||||
this.result = result;
|
||||
this.RaisedPOWER += this.TestRunner_RaisedPOWER;
|
||||
this.LoweringPOWER += this.TestRunner_LoweringPOWER;
|
||||
}
|
||||
|
||||
private void TestRunner_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseRESET();
|
||||
this.CPU.RaiseINT();
|
||||
this.InitialiseRegisters();
|
||||
this.InitialiseMemory();
|
||||
}
|
||||
|
||||
private void TestRunner_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
}
|
||||
|
||||
public override EightBit.MemoryMapping Mapping(ushort address) =>
|
||||
this.mapping ??= new EightBit.MemoryMapping(this.ram, 0, EightBit.Mask.Sixteen, EightBit.AccessLevel.ReadWrite);
|
||||
@@ -48,22 +69,6 @@ namespace LR35902.FuseTest
|
||||
}
|
||||
}
|
||||
|
||||
public override void RaisePOWER()
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseRESET();
|
||||
this.CPU.RaiseINT();
|
||||
this.InitialiseRegisters();
|
||||
this.InitialiseMemory();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
public override void Initialize() => this.DisableGameRom();
|
||||
|
||||
private static void DumpDifference(string description, byte expected, byte actual)
|
||||
|
||||
@@ -9,9 +9,24 @@
|
||||
public Ram RAM { get; } = new(0x10000);
|
||||
|
||||
public TestRunner()
|
||||
: base(false)
|
||||
: base(false)
|
||||
{
|
||||
this._mapping = new(this.RAM, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);
|
||||
this.RaisedPOWER += this.TestRunner_RaisedPOWER;
|
||||
this.LoweringPOWER += this.TestRunner_LoweringPOWER;
|
||||
}
|
||||
|
||||
private void TestRunner_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseRESET();
|
||||
this.CPU.RaiseINT();
|
||||
this.CPU.RaiseHALT();
|
||||
}
|
||||
|
||||
private void TestRunner_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
}
|
||||
|
||||
public override MemoryMapping Mapping(ushort _) => this._mapping;
|
||||
@@ -19,22 +34,5 @@
|
||||
public override void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
|
||||
public override void RaisePOWER()
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseRESET();
|
||||
this.CPU.RaiseINT();
|
||||
this.CPU.RaiseHALT();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+10
-10
@@ -28,7 +28,7 @@ namespace M6502
|
||||
public event EventHandler<EventArgs>? LoweredNMI;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
public virtual void RaiseNMI()
|
||||
public void RaiseNMI()
|
||||
{
|
||||
if (this.NMI.Lowered())
|
||||
{
|
||||
@@ -38,7 +38,7 @@ namespace M6502
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void LowerNMI()
|
||||
public void LowerNMI()
|
||||
{
|
||||
if (this.NMI.Raised())
|
||||
{
|
||||
@@ -60,7 +60,7 @@ namespace M6502
|
||||
public event EventHandler<EventArgs>? LoweredSO;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
public virtual void RaiseSO()
|
||||
public void RaiseSO()
|
||||
{
|
||||
if (this.SO.Lowered())
|
||||
{
|
||||
@@ -70,7 +70,7 @@ namespace M6502
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void LowerSO()
|
||||
public void LowerSO()
|
||||
{
|
||||
if (this.SO.Raised())
|
||||
{
|
||||
@@ -92,7 +92,7 @@ namespace M6502
|
||||
public event EventHandler<EventArgs>? LoweredSYNC;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
protected virtual void RaiseSYNC()
|
||||
protected void RaiseSYNC()
|
||||
{
|
||||
if (this.SYNC.Lowered())
|
||||
{
|
||||
@@ -102,7 +102,7 @@ namespace M6502
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void LowerSYNC()
|
||||
protected void LowerSYNC()
|
||||
{
|
||||
if (this.SYNC.Raised())
|
||||
{
|
||||
@@ -124,7 +124,7 @@ namespace M6502
|
||||
public event EventHandler<EventArgs>? LoweredRDY;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
public virtual void RaiseRDY()
|
||||
public void RaiseRDY()
|
||||
{
|
||||
if (this.RDY.Lowered())
|
||||
{
|
||||
@@ -134,7 +134,7 @@ namespace M6502
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void LowerRDY()
|
||||
public void LowerRDY()
|
||||
{
|
||||
if (this.RDY.Raised())
|
||||
{
|
||||
@@ -156,7 +156,7 @@ namespace M6502
|
||||
public event EventHandler<EventArgs>? LoweredRW;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
public virtual void RaiseRW()
|
||||
public void RaiseRW()
|
||||
{
|
||||
if (this.RW.Lowered())
|
||||
{
|
||||
@@ -166,7 +166,7 @@ namespace M6502
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void LowerRW()
|
||||
public void LowerRW()
|
||||
{
|
||||
if (this.RW.Raised())
|
||||
{
|
||||
|
||||
@@ -14,23 +14,12 @@ namespace M6502.HarteTest
|
||||
{
|
||||
this.CPU = cpuFactory(this);
|
||||
this._mapping = new(this.RAM, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);
|
||||
this.RaisedPOWER += this.TestRunner_RaisedPOWER;
|
||||
this.LoweringPOWER += this.TestRunner_LoweringPOWER;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
private void TestRunner_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
public override MemoryMapping Mapping(ushort _) => this._mapping;
|
||||
|
||||
public override void RaisePOWER()
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseRESET();
|
||||
this.CPU.RaiseINT();
|
||||
@@ -38,5 +27,16 @@ namespace M6502.HarteTest
|
||||
this.CPU.RaiseSO();
|
||||
this.CPU.RaiseRDY();
|
||||
}
|
||||
|
||||
private void TestRunner_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public override MemoryMapping Mapping(ushort _) => this._mapping;
|
||||
}
|
||||
}
|
||||
@@ -36,13 +36,14 @@ namespace M6502.Test
|
||||
this.disassembler = new(this, this.CPU, this.symbols);
|
||||
this.mapping = new(this.ram, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);
|
||||
this.profiler = new(this.CPU, this.disassembler, this.symbols, this.configuration.Profile);
|
||||
this.RaisedPOWER += this.Board_RaisedPOWER;
|
||||
this.LoweringPOWER += this.Board_LoweringPOWER;
|
||||
}
|
||||
|
||||
public MOS6502 CPU { get; }
|
||||
|
||||
public override void RaisePOWER()
|
||||
private void Board_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseRESET();
|
||||
this.CPU.RaiseINT();
|
||||
@@ -51,10 +52,9 @@ namespace M6502.Test
|
||||
this.CPU.RaiseRDY();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
private void Board_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
if (this.configuration.Profile)
|
||||
{
|
||||
this.profiler.Generate();
|
||||
|
||||
@@ -41,6 +41,8 @@ namespace MC6809.Test
|
||||
this._unusedMapping = new MemoryMapping(this._unused2000, 0x8000, Mask.Sixteen, AccessLevel.ReadOnly);
|
||||
this._ioMapping = new MemoryMapping(this._io, 0xa000, Mask.Sixteen, AccessLevel.ReadWrite);
|
||||
this._romMapping = new MemoryMapping(this._rom, 0xc000, Mask.Sixteen, AccessLevel.ReadOnly);
|
||||
this.RaisedPOWER += this.Board_RaisedPOWER;
|
||||
this.LoweringPOWER += this.Board_LoweringPOWER;
|
||||
}
|
||||
|
||||
public MC6809 CPU { get; }
|
||||
@@ -67,10 +69,8 @@ namespace MC6809.Test
|
||||
return this._romMapping;
|
||||
}
|
||||
|
||||
public override void RaisePOWER()
|
||||
private void Board_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
base.RaisePOWER();
|
||||
|
||||
// Get the CPU ready for action
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.LowerRESET();
|
||||
@@ -89,14 +89,13 @@ namespace MC6809.Test
|
||||
this.AccessAcia();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
private void Board_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
if (this._configuration.Profile)
|
||||
this._profiler.Generate();
|
||||
|
||||
this.ACIA.LowerPOWER();
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace MC6809.UnitTest
|
||||
{
|
||||
this.CPU = new(this);
|
||||
this.mapping = new(this.ram, 0x0000, 0xffff, AccessLevel.ReadWrite);
|
||||
this.RaisedPOWER += this.Board_RaisedPOWER;
|
||||
this.LoweringPOWER += this.Board_LoweringPOWER;
|
||||
}
|
||||
|
||||
public MC6809 CPU { get; }
|
||||
@@ -24,10 +26,8 @@ namespace MC6809.UnitTest
|
||||
|
||||
public override MemoryMapping Mapping(ushort absolute) => this.mapping;
|
||||
|
||||
public override void RaisePOWER()
|
||||
private void Board_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
base.RaisePOWER();
|
||||
|
||||
this.CPU.RaisePOWER();
|
||||
|
||||
this.CPU.LowerRESET();
|
||||
@@ -40,6 +40,11 @@ namespace MC6809.UnitTest
|
||||
this.RunPowerOnReset();
|
||||
}
|
||||
|
||||
private void Board_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
}
|
||||
|
||||
private void RunPowerOnReset()
|
||||
{
|
||||
this.CPU.RaiseRESET();
|
||||
@@ -47,11 +52,5 @@ namespace MC6809.UnitTest
|
||||
this.CPU.Step();
|
||||
this.CPU.RaiseRESET();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,8 +64,8 @@ namespace Z80.FuseTest
|
||||
|
||||
public void Run()
|
||||
{
|
||||
this.RaisePOWER();
|
||||
this.Initialize();
|
||||
this.RaisePOWER();
|
||||
var allowedCycles = this.test.RegisterState.TStates;
|
||||
try
|
||||
{
|
||||
@@ -79,9 +79,8 @@ namespace Z80.FuseTest
|
||||
}
|
||||
}
|
||||
|
||||
public override void RaisePOWER()
|
||||
private void TestRunner_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.cpu.RaisePOWER();
|
||||
this.cpu.RaiseRESET();
|
||||
this.cpu.RaiseINT();
|
||||
@@ -90,14 +89,15 @@ namespace Z80.FuseTest
|
||||
this.InitialiseMemory();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
private void TestRunner_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.cpu.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
this.RaisedPOWER += this.TestRunner_RaisedPOWER;
|
||||
this.LoweringPOWER += this.TestRunner_LoweringPOWER;
|
||||
this.cpu.ReadMemory += this.Cpu_ReadMemory;
|
||||
this.cpu.WrittenMemory += this.Cpu_WrittenMemory;
|
||||
this.ports.ReadPort += this.Ports_ReadPort;
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
{
|
||||
this.CPU = new(this, this.ports);
|
||||
this._mapping = new(this.RAM, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);
|
||||
this.RaisedPOWER += this.TestRunner_RaisedPOWER;
|
||||
this.LoweringPOWER += this.TestRunner_LoweringPOWER;
|
||||
}
|
||||
|
||||
public override MemoryMapping Mapping(ushort _) => this._mapping;
|
||||
@@ -23,15 +25,13 @@
|
||||
{
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
private void TestRunner_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
public override void RaisePOWER()
|
||||
private void TestRunner_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseRESET();
|
||||
this.CPU.RaiseINT();
|
||||
|
||||
@@ -25,23 +25,23 @@ namespace Z80.Test
|
||||
this.CPU = new(this, this.ports);
|
||||
this.disassembler = new(this);
|
||||
this.mapping = new(this.ram, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);
|
||||
this.RaisedPOWER += this.Board_RaisedPOWER;
|
||||
this.LoweringPOWER += this.Board_LoweringPOWER;
|
||||
}
|
||||
|
||||
public Z80 CPU { get; }
|
||||
|
||||
public override void RaisePOWER()
|
||||
private void Board_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseRESET();
|
||||
this.CPU.RaiseINT();
|
||||
this.CPU.RaiseNMI();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
private void Board_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
|
||||
@@ -15,6 +15,8 @@ namespace Z80.UnitTests
|
||||
{
|
||||
this.CPU = new(this, this.ports);
|
||||
this.mapping = new(this.ram, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);
|
||||
this.RaisedPOWER += this.Board_RaisedPOWER;
|
||||
this.LoweringPOWER += this.Board_LoweringPOWER;
|
||||
}
|
||||
|
||||
public Z80 CPU { get; }
|
||||
@@ -25,19 +27,17 @@ namespace Z80.UnitTests
|
||||
|
||||
public override MemoryMapping Mapping(ushort absolute) => this.mapping;
|
||||
|
||||
public override void RaisePOWER()
|
||||
private void Board_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
base.RaisePOWER();
|
||||
this.CPU.RaisePOWER();
|
||||
this.CPU.RaiseRESET();
|
||||
this.CPU.RaiseINT();
|
||||
this.CPU.RaiseNMI();
|
||||
}
|
||||
|
||||
public override void LowerPOWER()
|
||||
private void Board_LoweringPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.CPU.LowerPOWER();
|
||||
base.LowerPOWER();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user