Simplify switching processor pin handling

This commit is contained in:
Adrian Conlon
2025-06-22 21:07:02 +01:00
parent 3105930027
commit 3bbf300e05
7 changed files with 500 additions and 122 deletions

View File

@@ -28,9 +28,14 @@ namespace EightBit
public byte ReadInputPort(ushort port)
{
ReadingPort?.Invoke(this, new PortEventArgs(port));
var value = this._input[port];
ReadPort?.Invoke(this, new PortEventArgs(port));
return value;
try
{
return this._input[port];
}
finally
{
ReadPort?.Invoke(this, new PortEventArgs(port));
}
}
public void WriteInputPort(ushort port, byte value) => this._input[port] = value;
@@ -40,8 +45,14 @@ namespace EightBit
public void WriteOutputPort(ushort port, byte value)
{
WritingPort?.Invoke(this, new PortEventArgs(port));
this._output[port] = value;
WrittenPort?.Invoke(this, new PortEventArgs(port));
try
{
this._output[port] = value;
}
finally
{
WrittenPort?.Invoke(this, new PortEventArgs(port));
}
}
}
}