diff --git a/LR35902/LR35902.cs b/LR35902/LR35902.cs index 6628d44..a0efed9 100644 --- a/LR35902/LR35902.cs +++ b/LR35902/LR35902.cs @@ -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; diff --git a/LR35902/SM83.HarteTest/Checker.cs b/LR35902/SM83.HarteTest/Checker.cs index b9bb397..bf98b29 100644 --- a/LR35902/SM83.HarteTest/Checker.cs +++ b/LR35902/SM83.HarteTest/Checker.cs @@ -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}");