diff --git a/EightBit/IntelProcessor.cs b/EightBit/IntelProcessor.cs index 035884b..e252148 100644 --- a/EightBit/IntelProcessor.cs +++ b/EightBit/IntelProcessor.cs @@ -62,8 +62,6 @@ namespace EightBit public ref PinLevel HALT => ref this.haltLine; - protected bool Halted => this.HALT.Lowered(); - public IntelOpCodeDecoded GetDecodedOpCode(byte opCode) => this.decodedOpCodes[opCode]; public override void RaisePOWER() @@ -196,17 +194,5 @@ namespace EightBit base.Return(); this.MEMPTR.Word = this.PC.Word; } - - protected void Halt() - { - --this.PC.Word; - this.LowerHALT(); - } - - protected void Proceed() - { - ++this.PC.Word; - this.RaiseHALT(); - } } } diff --git a/Intel8080/Intel8080.cs b/Intel8080/Intel8080.cs index e973789..292cc9d 100644 --- a/Intel8080/Intel8080.cs +++ b/Intel8080/Intel8080.cs @@ -66,7 +66,7 @@ namespace EightBit { this.HandleINT(); } - else if (this.Halted) + else if (this.HALT.Lowered()) { this.Execute(0); // NOP } @@ -401,7 +401,7 @@ namespace EightBit case 1: // 8-bit loading if (z == 6 && y == 6) { - this.Halt(); // Exception (replaces LD (HL), (HL)) + this.LowerHALT(); // Exception (replaces LD (HL), (HL)) } else { diff --git a/LR35902/LR35902.cs b/LR35902/LR35902.cs index af9918e..156299c 100644 --- a/LR35902/LR35902.cs +++ b/LR35902/LR35902.cs @@ -86,10 +86,7 @@ namespace EightBit.GameBoy } else { - if (this.Halted) - { - this.Proceed(); - } + this.RaiseHALT(); } } @@ -101,7 +98,7 @@ namespace EightBit.GameBoy { this.HandleINT(); } - else if (this.Halted) + else if (this.HALT.Lowered()) { this.Execute(0); // NOP } @@ -557,7 +554,7 @@ namespace EightBit.GameBoy case 1: // 8-bit loading if (z == 6 && y == 6) { - this.Halt(); // Exception (replaces LD (HL), (HL)) + this.LowerHALT(); // Exception (replaces LD (HL), (HL)) } else { diff --git a/Z80/Z80.cs b/Z80/Z80.cs index bd600f8..fda5382 100644 --- a/Z80/Z80.cs +++ b/Z80/Z80.cs @@ -214,7 +214,7 @@ namespace EightBit { this.HandleINT(); } - else if (this.Halted) + else if (this.HALT.Lowered()) { this.Execute(0); // NOP } @@ -258,11 +258,7 @@ namespace EightBit protected override void HandleINT() { base.HandleINT(); - if (this.Halted) - { - this.Proceed(); - } - + this.RaiseHALT(); if (this.IFF1) { this.DisableInterrupts(); @@ -1149,7 +1145,7 @@ namespace EightBit } else { - this.Halt(); // Exception (replaces LD (HL), (HL)) + this.LowerHALT(); // Exception (replaces LD (HL), (HL)) } this.Tick(4); @@ -1396,11 +1392,7 @@ namespace EightBit private void HandleNMI() { this.RaiseNMI(); - if (this.Halted) - { - this.Proceed(); - } - + this.RaiseHALT(); this.IFF1 = false; this.Restart(0x66); this.Tick(13);