mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2025-11-29 00:19:49 +00:00
Simplify switching processor pin handling
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user