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

@@ -43,9 +43,14 @@ namespace EightBit
public byte Read() public byte Read()
{ {
this.ReadingByte?.Invoke(this, EventArgs.Empty); this.ReadingByte?.Invoke(this, EventArgs.Empty);
var returned = this.Data = this.Reference(); try
ReadByte?.Invoke(this, EventArgs.Empty); {
return returned; return this.Data = this.Reference();
}
finally
{
ReadByte?.Invoke(this, EventArgs.Empty);
}
} }
public byte Read(ushort absolute) public byte Read(ushort absolute)
@@ -68,8 +73,14 @@ namespace EightBit
public void Write() public void Write()
{ {
this.WritingByte?.Invoke(this, EventArgs.Empty); this.WritingByte?.Invoke(this, EventArgs.Empty);
this.Reference() = this.Data; try
this.WrittenByte?.Invoke(this, EventArgs.Empty); {
this.Reference() = this.Data;
}
finally
{
this.WrittenByte?.Invoke(this, EventArgs.Empty);
}
} }
public void Write(byte value) public void Write(byte value)

View File

@@ -26,8 +26,14 @@ namespace EightBit
if (this.POWER.Lowered()) if (this.POWER.Lowered())
{ {
RaisingPOWER?.Invoke(this, EventArgs.Empty); RaisingPOWER?.Invoke(this, EventArgs.Empty);
this.POWER.Raise(); try
RaisedPOWER?.Invoke(this, EventArgs.Empty); {
this.POWER.Raise();
}
finally
{
RaisedPOWER?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -36,8 +42,14 @@ namespace EightBit
if (this.POWER.Raised()) if (this.POWER.Raised())
{ {
LoweringPOWER?.Invoke(this, EventArgs.Empty); LoweringPOWER?.Invoke(this, EventArgs.Empty);
this.POWER.Lower(); try
LoweredPOWER?.Invoke(this, EventArgs.Empty); {
this.POWER.Lower();
}
finally
{
LoweredPOWER?.Invoke(this, EventArgs.Empty);
}
} }
} }
} }

View File

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

View File

@@ -69,8 +69,14 @@ namespace EightBit
if (this.HALT.Lowered()) if (this.HALT.Lowered())
{ {
RaisingHALT?.Invoke(this, EventArgs.Empty); RaisingHALT?.Invoke(this, EventArgs.Empty);
this.HALT.Raise(); try
RaisedHALT?.Invoke(this, EventArgs.Empty); {
this.HALT.Raise();
}
finally
{
RaisedHALT?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -79,8 +85,14 @@ namespace EightBit
if (this.HALT.Raised()) if (this.HALT.Raised())
{ {
LoweringHALT?.Invoke(this, EventArgs.Empty); LoweringHALT?.Invoke(this, EventArgs.Empty);
this.HALT.Lower(); try
LoweredHALT?.Invoke(this, EventArgs.Empty); {
this.HALT.Lower();
}
finally
{
LoweredHALT?.Invoke(this, EventArgs.Empty);
}
} }
} }

View File

@@ -69,11 +69,17 @@ namespace EightBit
{ {
this.ResetCycles(); this.ResetCycles();
ExecutingInstruction?.Invoke(this, EventArgs.Empty); ExecutingInstruction?.Invoke(this, EventArgs.Empty);
if (this.Powered) try
{ {
this.PoweredStep(); if (this.Powered)
{
this.PoweredStep();
}
}
finally
{
ExecutedInstruction?.Invoke(this, EventArgs.Empty);
} }
ExecutedInstruction?.Invoke(this, EventArgs.Empty);
return this.Cycles; return this.Cycles;
} }
@@ -115,8 +121,14 @@ namespace EightBit
if (this.RESET.Lowered()) if (this.RESET.Lowered())
{ {
RaisingRESET?.Invoke(this, EventArgs.Empty); RaisingRESET?.Invoke(this, EventArgs.Empty);
this.RESET.Raise(); try
RaisedRESET?.Invoke(this, EventArgs.Empty); {
this.RESET.Raise();
}
finally
{
RaisedRESET?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -125,8 +137,14 @@ namespace EightBit
if (this.RESET.Raised()) if (this.RESET.Raised())
{ {
LoweringRESET?.Invoke(this, EventArgs.Empty); LoweringRESET?.Invoke(this, EventArgs.Empty);
this.RESET.Lower(); try
LoweredRESET?.Invoke(this, EventArgs.Empty); {
this.RESET.Lower();
}
finally
{
LoweredRESET?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -136,8 +154,14 @@ namespace EightBit
if (this.INT.Lowered()) if (this.INT.Lowered())
{ {
RaisingINT?.Invoke(this, EventArgs.Empty); RaisingINT?.Invoke(this, EventArgs.Empty);
this.INT.Raise(); try
RaisedINT?.Invoke(this, EventArgs.Empty); {
this.INT.Raise();
}
finally
{
RaisedINT?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -146,8 +170,14 @@ namespace EightBit
if (this.INT.Raised()) if (this.INT.Raised())
{ {
LoweringINT?.Invoke(this, EventArgs.Empty); LoweringINT?.Invoke(this, EventArgs.Empty);
this.INT.Lower(); try
LoweredINT?.Invoke(this, EventArgs.Empty); {
this.INT.Lower();
}
finally
{
LoweredINT?.Invoke(this, EventArgs.Empty);
}
} }
} }

View File

@@ -33,8 +33,14 @@ namespace M6502
if (this.NMI.Lowered()) if (this.NMI.Lowered())
{ {
RaisingNMI?.Invoke(this, EventArgs.Empty); RaisingNMI?.Invoke(this, EventArgs.Empty);
this.NMI.Raise(); try
RaisedNMI?.Invoke(this, EventArgs.Empty); {
this.NMI.Raise();
}
finally
{
RaisedNMI?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -43,8 +49,14 @@ namespace M6502
if (this.NMI.Raised()) if (this.NMI.Raised())
{ {
LoweringNMI?.Invoke(this, EventArgs.Empty); LoweringNMI?.Invoke(this, EventArgs.Empty);
this.NMI.Lower(); try
LoweredNMI?.Invoke(this, EventArgs.Empty); {
this.NMI.Lower();
}
finally
{
LoweredNMI?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -65,8 +77,14 @@ namespace M6502
if (this.SO.Lowered()) if (this.SO.Lowered())
{ {
RaisingSO?.Invoke(this, EventArgs.Empty); RaisingSO?.Invoke(this, EventArgs.Empty);
this.SO.Raise(); try
RaisedSO?.Invoke(this, EventArgs.Empty); {
this.SO.Raise();
}
finally
{
RaisedSO?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -75,8 +93,14 @@ namespace M6502
if (this.SO.Raised()) if (this.SO.Raised())
{ {
LoweringSO?.Invoke(this, EventArgs.Empty); LoweringSO?.Invoke(this, EventArgs.Empty);
this.SO.Lower(); try
LoweredSO?.Invoke(this, EventArgs.Empty); {
this.SO.Lower();
}
finally
{
LoweredSO?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -97,8 +121,14 @@ namespace M6502
if (this.SYNC.Lowered()) if (this.SYNC.Lowered())
{ {
RaisingSYNC?.Invoke(this, EventArgs.Empty); RaisingSYNC?.Invoke(this, EventArgs.Empty);
this.SYNC.Raise(); try
RaisedSYNC?.Invoke(this, EventArgs.Empty); {
this.SYNC.Raise();
}
finally
{
RaisedSYNC?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -107,8 +137,14 @@ namespace M6502
if (this.SYNC.Raised()) if (this.SYNC.Raised())
{ {
LoweringSYNC?.Invoke(this, EventArgs.Empty); LoweringSYNC?.Invoke(this, EventArgs.Empty);
this.SYNC.Lower(); try
LoweredSYNC?.Invoke(this, EventArgs.Empty); {
this.SYNC.Lower();
}
finally
{
LoweredSYNC?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -129,8 +165,14 @@ namespace M6502
if (this.RDY.Lowered()) if (this.RDY.Lowered())
{ {
RaisingRDY?.Invoke(this, EventArgs.Empty); RaisingRDY?.Invoke(this, EventArgs.Empty);
this.RDY.Raise(); try
RaisedRDY?.Invoke(this, EventArgs.Empty); {
this.RDY.Raise();
}
finally
{
RaisedRDY?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -139,8 +181,14 @@ namespace M6502
if (this.RDY.Raised()) if (this.RDY.Raised())
{ {
LoweringRDY?.Invoke(this, EventArgs.Empty); LoweringRDY?.Invoke(this, EventArgs.Empty);
this.RDY.Lower(); try
LoweredRDY?.Invoke(this, EventArgs.Empty); {
this.RDY.Lower();
}
finally
{
LoweredRDY?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -161,8 +209,14 @@ namespace M6502
if (this.RW.Lowered()) if (this.RW.Lowered())
{ {
RaisingRW?.Invoke(this, EventArgs.Empty); RaisingRW?.Invoke(this, EventArgs.Empty);
this.RW.Raise(); try
RaisedRW?.Invoke(this, EventArgs.Empty); {
this.RW.Raise();
}
finally
{
RaisedRW?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -171,8 +225,14 @@ namespace M6502
if (this.RW.Raised()) if (this.RW.Raised())
{ {
LoweringRW?.Invoke(this, EventArgs.Empty); LoweringRW?.Invoke(this, EventArgs.Empty);
this.RW.Lower(); try
LoweredRW?.Invoke(this, EventArgs.Empty); {
this.RW.Lower();
}
finally
{
LoweredRW?.Invoke(this, EventArgs.Empty);
}
} }
} }

View File

@@ -205,8 +205,14 @@ namespace Z80
if (this.NMI.Lowered()) if (this.NMI.Lowered())
{ {
RaisingNMI?.Invoke(this, EventArgs.Empty); RaisingNMI?.Invoke(this, EventArgs.Empty);
this.NMI.Raise(); try
RaisedNMI?.Invoke(this, EventArgs.Empty); {
this.NMI.Raise();
}
finally
{
RaisedNMI?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -215,8 +221,36 @@ namespace Z80
if (this.NMI.Raised()) if (this.NMI.Raised())
{ {
LoweringNMI?.Invoke(this, EventArgs.Empty); LoweringNMI?.Invoke(this, EventArgs.Empty);
this.NMI.Lower(); try
LoweredNMI?.Invoke(this, EventArgs.Empty); {
this.NMI.Lower();
}
finally
{
LoweredNMI?.Invoke(this, EventArgs.Empty);
}
}
}
protected sealed class AutoNMI : IDisposable
{
private readonly Z80 _cpu;
private bool _disposed;
public AutoNMI(Z80 cpu)
{
_cpu = cpu;
_cpu.LowerNMI();
}
public void Dispose()
{
if (!_disposed)
{
_cpu.RaiseNMI();
_disposed = true;
}
GC.SuppressFinalize(this);
} }
} }
@@ -246,8 +280,14 @@ namespace Z80
if (this.M1.Lowered()) if (this.M1.Lowered())
{ {
RaisingM1?.Invoke(this, EventArgs.Empty); RaisingM1?.Invoke(this, EventArgs.Empty);
this.M1.Raise(); try
RaisedM1?.Invoke(this, EventArgs.Empty); {
this.M1.Raise();
}
finally
{
RaisedM1?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -256,8 +296,35 @@ namespace Z80
if (this.M1.Raised()) if (this.M1.Raised())
{ {
LoweringM1?.Invoke(this, EventArgs.Empty); LoweringM1?.Invoke(this, EventArgs.Empty);
this.M1.Lower(); try
LoweredM1?.Invoke(this, EventArgs.Empty); {
this.M1.Lower();
}
finally
{
LoweredM1?.Invoke(this, EventArgs.Empty);
}
}
}
protected sealed class AutoM1 : IDisposable
{
private readonly Z80 _cpu;
private bool _disposed;
public AutoM1(Z80 cpu)
{
_cpu = cpu;
_cpu.LowerM1();
}
public void Dispose()
{
if (!_disposed)
{
_cpu.RaiseM1();
_disposed = true;
}
GC.SuppressFinalize(this);
} }
} }
@@ -288,9 +355,15 @@ namespace Z80
if (this.RFSH.Lowered()) if (this.RFSH.Lowered())
{ {
RaisingRFSH?.Invoke(this, EventArgs.Empty); RaisingRFSH?.Invoke(this, EventArgs.Empty);
this.RFSH.Raise(); try
++this.REFRESH; {
RaisedRFSH?.Invoke(this, EventArgs.Empty); this.RFSH.Raise();
++this.REFRESH;
}
finally
{
RaisedRFSH?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -299,8 +372,36 @@ namespace Z80
if (this.RFSH.Raised()) if (this.RFSH.Raised())
{ {
LoweringRFSH?.Invoke(this, EventArgs.Empty); LoweringRFSH?.Invoke(this, EventArgs.Empty);
this.RFSH.Lower(); try
LoweredRFSH?.Invoke(this, EventArgs.Empty); {
this.RFSH.Lower();
}
finally
{
LoweredRFSH?.Invoke(this, EventArgs.Empty);
}
}
}
protected sealed class AutoRFSH : IDisposable
{
private readonly Z80 _cpu;
private bool _disposed;
public AutoRFSH(Z80 cpu)
{
_cpu = cpu;
_cpu.LowerRFSH();
}
public void Dispose()
{
if (!_disposed)
{
_cpu.RaiseRFSH();
_disposed = true;
}
GC.SuppressFinalize(this);
} }
} }
@@ -326,8 +427,14 @@ namespace Z80
if (this.MREQ.Lowered()) if (this.MREQ.Lowered())
{ {
RaisingMREQ?.Invoke(this, EventArgs.Empty); RaisingMREQ?.Invoke(this, EventArgs.Empty);
this.MREQ.Raise(); try
RaisedMREQ?.Invoke(this, EventArgs.Empty); {
this.MREQ.Raise();
}
finally
{
RaisedMREQ?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -336,8 +443,36 @@ namespace Z80
if (this.MREQ.Raised()) if (this.MREQ.Raised())
{ {
LoweringMREQ?.Invoke(this, EventArgs.Empty); LoweringMREQ?.Invoke(this, EventArgs.Empty);
this.MREQ.Lower(); try
LoweredMREQ?.Invoke(this, EventArgs.Empty); {
this.MREQ.Lower();
}
finally
{
LoweredMREQ?.Invoke(this, EventArgs.Empty);
}
}
}
protected sealed class AutoMREQ : IDisposable
{
private readonly Z80 _cpu;
private bool _disposed;
public AutoMREQ(Z80 cpu)
{
_cpu = cpu;
_cpu.LowerMREQ();
}
public void Dispose()
{
if (!_disposed)
{
_cpu.RaiseMREQ();
_disposed = true;
}
GC.SuppressFinalize(this);
} }
} }
@@ -363,8 +498,14 @@ namespace Z80
if (this.IORQ.Lowered()) if (this.IORQ.Lowered())
{ {
RaisingIORQ?.Invoke(this, EventArgs.Empty); RaisingIORQ?.Invoke(this, EventArgs.Empty);
this.IORQ.Raise(); try
RaisedIORQ?.Invoke(this, EventArgs.Empty); {
this.IORQ.Raise();
}
finally
{
RaisedIORQ?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -378,6 +519,28 @@ namespace Z80
} }
} }
protected sealed class AutoIORQ : IDisposable
{
private readonly Z80 _cpu;
private bool _disposed;
public AutoIORQ(Z80 cpu)
{
_cpu = cpu;
_cpu.LowerIORQ();
}
public void Dispose()
{
if (!_disposed)
{
_cpu.RaiseIORQ();
_disposed = true;
}
GC.SuppressFinalize(this);
}
}
#endregion #endregion
#region RD pin #region RD pin
@@ -400,8 +563,14 @@ namespace Z80
if (this.RD.Lowered()) if (this.RD.Lowered())
{ {
RaisingRD?.Invoke(this, EventArgs.Empty); RaisingRD?.Invoke(this, EventArgs.Empty);
this.RD.Raise(); try
RaisedRD?.Invoke(this, EventArgs.Empty); {
this.RD.Raise();
}
finally
{
RaisedRD?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -410,8 +579,36 @@ namespace Z80
if (this.RD.Raised()) if (this.RD.Raised())
{ {
LoweringRD?.Invoke(this, EventArgs.Empty); LoweringRD?.Invoke(this, EventArgs.Empty);
this.RD.Lower(); try
LoweredRD?.Invoke(this, EventArgs.Empty); {
this.RD.Lower();
}
finally
{
LoweredRD?.Invoke(this, EventArgs.Empty);
}
}
}
protected sealed class AutoRD : IDisposable
{
private readonly Z80 _cpu;
private bool _disposed;
public AutoRD(Z80 cpu)
{
_cpu = cpu;
_cpu.LowerRD();
}
public void Dispose()
{
if (!_disposed)
{
_cpu.RaiseRD();
_disposed = true;
}
GC.SuppressFinalize(this);
} }
} }
@@ -437,8 +634,14 @@ namespace Z80
if (this.WR.Lowered()) if (this.WR.Lowered())
{ {
RaisingWR?.Invoke(this, EventArgs.Empty); RaisingWR?.Invoke(this, EventArgs.Empty);
this.WR.Raise(); try
RaisedWR?.Invoke(this, EventArgs.Empty); {
this.WR.Raise();
}
finally
{
RaisedWR?.Invoke(this, EventArgs.Empty);
}
} }
} }
@@ -447,8 +650,36 @@ namespace Z80
if (this.WR.Raised()) if (this.WR.Raised())
{ {
LoweringWR?.Invoke(this, EventArgs.Empty); LoweringWR?.Invoke(this, EventArgs.Empty);
this.WR.Lower(); try
LoweredWR?.Invoke(this, EventArgs.Empty); {
this.WR.Lower();
}
finally
{
LoweredWR?.Invoke(this, EventArgs.Empty);
}
}
}
protected sealed class AutoWR : IDisposable
{
private readonly Z80 _cpu;
private bool _disposed;
public AutoWR(Z80 cpu)
{
_cpu = cpu;
_cpu.LowerWR();
}
public void Dispose()
{
if (!_disposed)
{
_cpu.RaiseWR();
_disposed = true;
}
GC.SuppressFinalize(this);
} }
} }
@@ -459,13 +690,17 @@ namespace Z80
protected void MemoryUpdate(int ticks) protected void MemoryUpdate(int ticks)
{ {
this.OnWritingMemory(); this.OnWritingMemory();
this.LowerMREQ(); try
this.LowerWR(); {
this.Tick(ticks); using var _ = new AutoMREQ(this);
base.MemoryWrite(); using var __ = new AutoWR(this);
this.RaiseWR(); this.Tick(ticks);
this.RaiseMREQ(); base.MemoryWrite();
this.OnWroteMemory(); }
finally
{
this.OnWroteMemory();
}
} }
protected override void MemoryWrite() protected override void MemoryWrite()
@@ -476,25 +711,32 @@ namespace Z80
protected override byte MemoryRead() protected override byte MemoryRead()
{ {
this.OnReadingMemory(); this.OnReadingMemory();
this.Tick(); try
this.LowerMREQ();
this.LowerRD();
this.Tick();
var returned = base.MemoryRead();
this.RaiseRD();
this.RaiseMREQ();
if (this.M1.Lowered())
{ {
this.Bus.Address.Assign(this.REFRESH, this.IV);
this.LowerRFSH();
this.Tick(); this.Tick();
this.LowerMREQ(); try
this.RaiseMREQ(); {
this.RaiseRFSH(); using var __ = new AutoMREQ(this);
using var _ = new AutoRD(this);
this.Tick();
return base.MemoryRead();
}
finally
{
if (this.M1.Lowered())
{
this.Bus.Address.Assign(this.REFRESH, this.IV);
using var _ = new AutoRFSH(this);
this.Tick();
using var __ = new AutoMREQ(this);
}
this.Tick();
}
}
finally
{
this.OnReadMemory();
} }
this.Tick();
this.OnReadMemory();
return returned;
} }
// From Zilog Z80 manual // From Zilog Z80 manual
@@ -516,15 +758,18 @@ namespace Z80
this.Tick(3); this.Tick(3);
} }
private byte ReadDataUnderInterrupt()
{
using var _ = new AutoM1(this);
using var __ = new AutoIORQ(this);
return this.Bus.Data;
}
protected override void HandleINT() protected override void HandleINT()
{ {
base.HandleINT(); base.HandleINT();
this.LowerM1(); var data = this.ReadDataUnderInterrupt();
this.LowerIORQ();
var data = this.Bus.Data;
this.RaiseIORQ();
this.RaiseM1();
this.DisableInterrupts(); this.DisableInterrupts();
this.Tick(5); this.Tick(5);
@@ -1560,9 +1805,8 @@ namespace Z80
this.RaiseHALT(); this.RaiseHALT();
this.IFF2 = this.IFF1; this.IFF2 = this.IFF1;
this.IFF1 = false; this.IFF1 = false;
this.LowerM1(); using var __ = new AutoM1(this);
_ = this.Bus.Data; _ = this.Bus.Data;
this.RaiseM1();
this.Restart(0x66); this.Restart(0x66);
} }
@@ -1582,10 +1826,8 @@ namespace Z80
// instruction so that no other concurrent operation can be performed. // instruction so that no other concurrent operation can be performed.
protected override byte FetchInstruction() protected override byte FetchInstruction()
{ {
this.LowerM1(); using var _ = new AutoM1(this);
var returned = base.FetchInstruction(); return base.FetchInstruction();
this.RaiseM1();
return returned;
} }
private byte Subtract(byte operand, byte value, int carry = 0) private byte Subtract(byte operand, byte value, int carry = 0)
@@ -2321,12 +2563,12 @@ namespace Z80
{ {
this.MEMPTR.Assign(this.Bus.Address); this.MEMPTR.Assign(this.Bus.Address);
this.Tick(2); this.Tick(2);
this.LowerIORQ(); {
this.LowerWR(); using var _ = new AutoIORQ(this);
this.Ports.Write(this.Bus.Address, this.Bus.Data); using var __ = new AutoWR(this);
this.Tick(); this.Ports.Write(this.Bus.Address, this.Bus.Data);
this.RaiseWR(); this.Tick();
this.RaiseIORQ(); }
this.Tick(); this.Tick();
} }
@@ -2341,12 +2583,12 @@ namespace Z80
{ {
this.MEMPTR.Assign(this.Bus.Address); this.MEMPTR.Assign(this.Bus.Address);
this.Tick(2); this.Tick(2);
this.LowerIORQ(); {
this.LowerRD(); using var _ = new AutoIORQ(this);
this.Bus.Data = this.Ports.Read(this.Bus.Address); using var __ = new AutoRD(this);
this.Tick(); this.Bus.Data = this.Ports.Read(this.Bus.Address);
this.RaiseRD(); this.Tick();
this.RaiseIORQ(); }
this.Tick(); this.Tick();
} }