mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2025-09-25 03:24:30 +00:00
Add support for checking deferred EI correctness
This commit is contained in:
@@ -56,7 +56,7 @@ namespace LR35902
|
||||
|
||||
private bool Stopped { get; set; }
|
||||
|
||||
private bool _deferredInterruptEnable;
|
||||
public bool EI { get; set; }
|
||||
|
||||
#region MWR pin
|
||||
|
||||
@@ -196,10 +196,10 @@ namespace LR35902
|
||||
{
|
||||
this.prefixCB = false;
|
||||
|
||||
if ( this._deferredInterruptEnable)
|
||||
if (this.EI)
|
||||
{
|
||||
this.EnableInterrupts();
|
||||
this._deferredInterruptEnable = false;
|
||||
this.EI = false;
|
||||
}
|
||||
|
||||
if (this.MaskedInterrupts != 0)
|
||||
@@ -235,7 +235,7 @@ namespace LR35902
|
||||
this.RaiseWR();
|
||||
this.RaiseRD();
|
||||
this.RaiseMWR();
|
||||
this._deferredInterruptEnable = false;
|
||||
this.EI = false;
|
||||
}
|
||||
|
||||
protected override void HandleRESET()
|
||||
@@ -839,7 +839,7 @@ namespace LR35902
|
||||
this.DisableInterrupts();
|
||||
break;
|
||||
case 7: // EI
|
||||
this._deferredInterruptEnable = true;
|
||||
this.EI = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@@ -219,6 +219,12 @@
|
||||
ie_good = this.Check("IE", final.IE.Value, cpu.IE);
|
||||
}
|
||||
|
||||
var ei_good = true;
|
||||
if (final.EI is not null)
|
||||
{
|
||||
ei_good = this.Check("EI", final.EI.Value, (byte)(cpu.EI ? 1 : 0));
|
||||
}
|
||||
|
||||
if (!f_good)
|
||||
{
|
||||
this.Messages.Add($"Expected flags: {LR35902.Disassembler.AsFlags(final.F)}");
|
||||
@@ -255,7 +261,7 @@
|
||||
&& d_good && e_good
|
||||
&& h_good && l_good
|
||||
&& ime_good
|
||||
&& ie_good;
|
||||
&& ie_good && ei_good;
|
||||
}
|
||||
|
||||
private void Raise(string what, ushort expected, ushort actual) => this.Messages.Add($"{what}: expected: {expected:X4}, actual: {actual:X4}");
|
||||
|
Reference in New Issue
Block a user