Correct a few small mistakes in the Z80 emulation.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2019-02-21 01:10:17 +00:00
parent c7feb58815
commit c0aa7c5ff5

View File

@@ -1833,7 +1833,7 @@ namespace EightBit
this.HL2().High = this.MEMPTR().High; this.HL2().High = this.MEMPTR().High;
} }
private void BlockCompare(Register16 source, Register16 counter) private void BlockCompare(Register16 source, ref Register16 counter)
{ {
var value = this.Bus.Read(source); var value = this.Bus.Read(source);
var result = (byte)(this.A() - value); var result = (byte)(this.A() - value);
@@ -1852,7 +1852,7 @@ namespace EightBit
private void CPI() private void CPI()
{ {
this.BlockCompare(this.HL()++, this.BC()); this.BlockCompare(this.HL()++, ref this.BC());
++this.MEMPTR(); ++this.MEMPTR();
} }
@@ -1864,7 +1864,7 @@ namespace EightBit
private void CPD() private void CPD()
{ {
this.BlockCompare(this.HL()--, this.BC()); this.BlockCompare(this.HL()--, ref this.BC());
--this.MEMPTR(); --this.MEMPTR();
} }
@@ -1904,7 +1904,7 @@ namespace EightBit
private bool LDDR() private bool LDDR()
{ {
this.LDD(); this.LDD();
return (this.F() & (byte)StatusBits.PF) == 0; // See LDD return (this.F() & (byte)StatusBits.PF) != 0; // See LDD
} }
private void BlockIn(Register16 source, Register16 destination) private void BlockIn(Register16 source, Register16 destination)
@@ -2010,7 +2010,7 @@ namespace EightBit
var memory = this.Bus.Read(); var memory = this.Bus.Read();
this.Bus.Write((byte)(PromoteNibble(memory) | LowNibble(this.A()))); this.Bus.Write((byte)(PromoteNibble(memory) | LowNibble(this.A())));
this.A() = (byte)(HigherNibble(this.A()) | HighNibble(memory)); this.A() = (byte)(HigherNibble(this.A()) | HighNibble(memory));
AdjustSZPXY(this.F(), this.A()); F() = AdjustSZPXY(this.F(), this.A());
this.F() = ClearFlag(this.F(), StatusBits.NF | StatusBits.HC); this.F() = ClearFlag(this.F(), StatusBits.NF | StatusBits.HC);
} }