Synchronise HALT implementation for Intel style processors with the C++ version.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-08-29 09:05:31 +01:00
parent 08111f8590
commit bc491884b0
4 changed files with 9 additions and 34 deletions

View File

@ -62,8 +62,6 @@ namespace EightBit
public ref PinLevel HALT => ref this.haltLine; public ref PinLevel HALT => ref this.haltLine;
protected bool Halted => this.HALT.Lowered();
public IntelOpCodeDecoded GetDecodedOpCode(byte opCode) => this.decodedOpCodes[opCode]; public IntelOpCodeDecoded GetDecodedOpCode(byte opCode) => this.decodedOpCodes[opCode];
public override void RaisePOWER() public override void RaisePOWER()
@ -196,17 +194,5 @@ namespace EightBit
base.Return(); base.Return();
this.MEMPTR.Word = this.PC.Word; this.MEMPTR.Word = this.PC.Word;
} }
protected void Halt()
{
--this.PC.Word;
this.LowerHALT();
}
protected void Proceed()
{
++this.PC.Word;
this.RaiseHALT();
}
} }
} }

View File

@ -66,7 +66,7 @@ namespace EightBit
{ {
this.HandleINT(); this.HandleINT();
} }
else if (this.Halted) else if (this.HALT.Lowered())
{ {
this.Execute(0); // NOP this.Execute(0); // NOP
} }
@ -401,7 +401,7 @@ namespace EightBit
case 1: // 8-bit loading case 1: // 8-bit loading
if (z == 6 && y == 6) if (z == 6 && y == 6)
{ {
this.Halt(); // Exception (replaces LD (HL), (HL)) this.LowerHALT(); // Exception (replaces LD (HL), (HL))
} }
else else
{ {

View File

@ -86,10 +86,7 @@ namespace EightBit.GameBoy
} }
else else
{ {
if (this.Halted) this.RaiseHALT();
{
this.Proceed();
}
} }
} }
@ -101,7 +98,7 @@ namespace EightBit.GameBoy
{ {
this.HandleINT(); this.HandleINT();
} }
else if (this.Halted) else if (this.HALT.Lowered())
{ {
this.Execute(0); // NOP this.Execute(0); // NOP
} }
@ -557,7 +554,7 @@ namespace EightBit.GameBoy
case 1: // 8-bit loading case 1: // 8-bit loading
if (z == 6 && y == 6) if (z == 6 && y == 6)
{ {
this.Halt(); // Exception (replaces LD (HL), (HL)) this.LowerHALT(); // Exception (replaces LD (HL), (HL))
} }
else else
{ {

View File

@ -214,7 +214,7 @@ namespace EightBit
{ {
this.HandleINT(); this.HandleINT();
} }
else if (this.Halted) else if (this.HALT.Lowered())
{ {
this.Execute(0); // NOP this.Execute(0); // NOP
} }
@ -258,11 +258,7 @@ namespace EightBit
protected override void HandleINT() protected override void HandleINT()
{ {
base.HandleINT(); base.HandleINT();
if (this.Halted) this.RaiseHALT();
{
this.Proceed();
}
if (this.IFF1) if (this.IFF1)
{ {
this.DisableInterrupts(); this.DisableInterrupts();
@ -1149,7 +1145,7 @@ namespace EightBit
} }
else else
{ {
this.Halt(); // Exception (replaces LD (HL), (HL)) this.LowerHALT(); // Exception (replaces LD (HL), (HL))
} }
this.Tick(4); this.Tick(4);
@ -1396,11 +1392,7 @@ namespace EightBit
private void HandleNMI() private void HandleNMI()
{ {
this.RaiseNMI(); this.RaiseNMI();
if (this.Halted) this.RaiseHALT();
{
this.Proceed();
}
this.IFF1 = false; this.IFF1 = false;
this.Restart(0x66); this.Restart(0x66);
this.Tick(13); this.Tick(13);