This commit is contained in:
Adrian Conlon committed 2026-09-12 16:22:25 +01:00
commit a70583984f
4 files changed
+12 -13

No files matched your search

+3 -1
View File
@@ -155,7 +155,9 @@ namespace EightBit
}
}
protected virtual void HandleRESET() => this.RaiseRESET();
protected virtual void HandleRESET()
{
}
protected virtual void HandleINT() => this.RaiseINT();
+3 -3
View File
@@ -63,10 +63,10 @@ namespace Z80
+ $"I={i:x2} R={(byte)r:x2} "
+ $"IM={im} "
+ $"IFF1={(cpu.IFF1 ? 1 : 0)} "
+ $"{(cpu.RESET.Lowered() ? "R" : "-")}"
+ $"{(cpu.INT.Lowered() ? "I" : "-")}"
+ $"{(cpu.HALT.Lowered() ? "H" : "-")}"
+ $"{(cpu.NMI.Lowered() ? "N" : "-")}";
+ $"{(cpu.RESET.Lowered() ? "R" : "-")}"
+ $"{(cpu.NMI.Lowered() ? "N" : "-")}"
+ $"{(cpu.INT.Lowered() ? "I" : "-")}";
}
public string Disassemble(Z80 cpu)
+2 -2
View File
@@ -64,12 +64,12 @@ namespace Z80.UnitTests
}
[TestMethod]
public void Reset_Deasserts_Reset_Pin()
public void Reset_Ignores_Reset_Pin()
{
this.cpu.LowerRESET(); // asserts RESET — fires LoweredRESET event
Assert.IsTrue(this.cpu.RESET.Lowered(), "RESET pin must be asserted before step");
this.cpu.Step();
Assert.IsTrue(this.cpu.RESET.Raised(), "HandleRESET must deassert the RESET pin");
Assert.IsTrue(this.cpu.RESET.Lowered());
}
[TestMethod]
+4 -7
View File
@@ -17,14 +17,12 @@ namespace Z80
this.UpdateRegisterBank();
this.UpdateAFBank();
this.RaisedPOWER += this.Z80_RaisedPOWER;
this.LoweredRESET += this.Z80_LoweredRESET;
this.LoweredNMI += this.Z80_LoweredNMI;
this.LoweredINT += this.Z80_LoweredINT;
}
private bool _interruptPending;
private bool _nonMaskableInterruptPending;
private bool _resetPending;
private readonly InputOutput _ports;
@@ -182,9 +180,8 @@ namespace Z80
this._modifiedF = 0;
this._displaced = this._prefixCB = this._prefixDD = this._prefixED = this._prefixFD = false;
if (this._resetPending)
if (this.RESET.Lowered())
{
this._resetPending = false;
this.HandleRESET();
return;
}
@@ -204,6 +201,8 @@ namespace Z80
}
}
Debug.Assert(this.RESET.Raised());
// ** From the Z80 CPU User Manual
// When a software HALT instruction is executed, the CPU executes NOPs until an interrupt
// is received(either a non-maskable or a maskable interrupt while the interrupt flip-flop is
@@ -252,8 +251,6 @@ namespace Z80
private void Z80_LoweredNMI(object? sender, EventArgs e) => this._nonMaskableInterruptPending = true;
private void Z80_LoweredRESET(object? sender, EventArgs e) => this._resetPending = true;
#region Z80 specific pins
#region NMI pin
@@ -594,10 +591,10 @@ namespace Z80
protected override void HandleRESET()
{
base.HandleRESET();
this.DisableInterrupts();
this.IM = 0;
this.IV = this.REFRESH = 0;
this.SP.Joined = this.AF.Joined = (ushort)Mask.Sixteen;
this.Tick();
}
private byte ReadDataUnderInterrupt()