Tighten up the sequence associated with changing pin levels + fix persistent HALT/PC bug

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2019-09-06 22:50:21 +01:00
parent bc491884b0
commit f01e3e0430
7 changed files with 229 additions and 138 deletions
+44 -33
View File
@@ -108,53 +108,44 @@ namespace EightBit
public void ExxAF() => this.accumulatorFlagsSet ^= 1;
public override void RaisePOWER()
{
base.RaisePOWER();
this.RaiseM1();
this.DisableInterrupts();
this.IM = 0;
this.REFRESH = new RefreshRegister(0);
this.IV = (byte)Mask.Mask8;
this.ExxAF();
this.AF.Word = (ushort)Mask.Mask16;
this.Exx();
this.IX.Word = this.IY.Word = this.BC.Word = this.DE.Word = this.HL.Word = (ushort)Mask.Mask16;
this.prefixCB = this.prefixDD = this.prefixED = false;
}
public virtual void RaiseNMI()
{
this.OnRaisingNMI();
this.NMI.Raise();
this.OnRaisedNMI();
if (this.NMI.Lowered())
{
this.OnRaisingNMI();
this.NMI.Raise();
this.OnRaisedNMI();
}
}
public virtual void LowerNMI()
{
this.OnLoweringNMI();
this.NMI.Lower();
this.OnLoweredNMI();
if (this.NMI.Raised())
{
this.OnLoweringNMI();
this.NMI.Lower();
this.OnLoweredNMI();
}
}
public virtual void RaiseM1()
{
this.OnRaisingM1();
this.M1.Raise();
this.OnRaisedM1();
if (this.M1.Lowered())
{
this.OnRaisingM1();
this.M1.Raise();
this.OnRaisedM1();
}
}
public virtual void LowerM1()
{
this.OnLoweringM1();
this.M1.Lower();
this.OnLoweredM1();
if (this.M1.Raised())
{
this.OnLoweringM1();
this.M1.Lower();
this.OnLoweredM1();
}
}
public override int Execute()
@@ -228,6 +219,26 @@ namespace EightBit
return this.Cycles;
}
protected override void OnRaisedPOWER()
{
this.RaiseM1();
this.DisableInterrupts();
this.IM = 0;
this.REFRESH = new RefreshRegister(0);
this.IV = (byte)Mask.Mask8;
this.AF.Word = this.IX.Word = this.IY.Word = this.BC.Word = this.DE.Word = this.HL.Word = (ushort)Mask.Mask16;
this.ExxAF();
this.Exx();
this.prefixCB = this.prefixDD = this.prefixED = false;
base.OnRaisedPOWER();
}
protected virtual void OnExecutingInstruction() => this.ExecutingInstruction?.Invoke(this, EventArgs.Empty);
protected virtual void OnExecutedInstruction() => this.ExecutedInstruction?.Invoke(this, EventArgs.Empty);