Sync with latest C++ version. Fixes a couple of Z80 issues.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
aca81384c3
commit
8ce71f8ab8
|
@ -56,7 +56,12 @@ namespace EightBit
|
|||
+ $"D={d:x2} E={e:x2} "
|
||||
+ $"H={h:x2} L={l:x2} "
|
||||
+ $"I={i:x2} R={(byte)r:x2} "
|
||||
+ $"IM={im}";
|
||||
+ $"IM={im} "
|
||||
+ $"IFF1={(cpu.IFF1 ? 1 : 0)} "
|
||||
+ $"{(cpu.RESET.Lowered() ? "R" : "-")}"
|
||||
+ $"{(cpu.INT.Lowered() ? "I" : "-")}"
|
||||
+ $"{(cpu.HALT.Lowered() ? "H" : "-")}"
|
||||
+ $"{(cpu.NMI.Lowered() ? "N" : "-")}";
|
||||
}
|
||||
|
||||
public string Disassemble(Z80 cpu)
|
||||
|
|
46
Z80/Z80.cs
46
Z80/Z80.cs
|
@ -193,23 +193,31 @@ namespace EightBit
|
|||
{
|
||||
this.displaced = this.prefixCB = this.prefixDD = this.prefixED = false;
|
||||
this.LowerM1();
|
||||
var handled = false;
|
||||
if (this.RESET.Lowered())
|
||||
{
|
||||
this.HandleRESET();
|
||||
handled = true;
|
||||
}
|
||||
else if (this.NMI.Lowered())
|
||||
{
|
||||
this.HandleNMI();
|
||||
handled = true;
|
||||
}
|
||||
else if (this.INT.Lowered())
|
||||
{
|
||||
this.HandleINT();
|
||||
this.RaiseHALT();
|
||||
if (handled = this.IFF1)
|
||||
{
|
||||
this.HandleINT();
|
||||
}
|
||||
}
|
||||
else if (this.HALT.Lowered())
|
||||
{
|
||||
this.Execute(0); // NOP
|
||||
}
|
||||
else
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
this.Execute(this.FetchByte());
|
||||
}
|
||||
|
@ -269,26 +277,22 @@ namespace EightBit
|
|||
protected override void HandleINT()
|
||||
{
|
||||
base.HandleINT();
|
||||
this.RaiseHALT();
|
||||
if (this.IFF1)
|
||||
this.DisableInterrupts();
|
||||
switch (this.IM)
|
||||
{
|
||||
this.DisableInterrupts();
|
||||
switch (this.IM)
|
||||
{
|
||||
case 0: // i8080 equivalent
|
||||
this.Execute(this.Bus.Data);
|
||||
break;
|
||||
case 1:
|
||||
this.Restart(7 << 3);
|
||||
this.Tick(13);
|
||||
break;
|
||||
case 2:
|
||||
this.Call(this.MEMPTR.Word = new Register16(this.Bus.Data, this.IV).Word);
|
||||
this.Tick(19);
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException("Invalid interrupt mode");
|
||||
}
|
||||
case 0: // i8080 equivalent
|
||||
this.Execute(this.Bus.Data);
|
||||
break;
|
||||
case 1:
|
||||
this.Restart(7 << 3);
|
||||
this.Tick(13);
|
||||
break;
|
||||
case 2:
|
||||
this.Call(this.MEMPTR.Word = new Register16(this.Bus.Data, this.IV).Word);
|
||||
this.Tick(19);
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException("Invalid interrupt mode");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue