From c0aa7c5ff590a56beaa113603f4141c7d0cf584e Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Thu, 21 Feb 2019 01:10:17 +0000 Subject: [PATCH] Correct a few small mistakes in the Z80 emulation. Signed-off-by: Adrian Conlon --- Z80/Z80.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Z80/Z80.cs b/Z80/Z80.cs index 2678e92..e44443f 100644 --- a/Z80/Z80.cs +++ b/Z80/Z80.cs @@ -1833,7 +1833,7 @@ namespace EightBit 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 result = (byte)(this.A() - value); @@ -1852,7 +1852,7 @@ namespace EightBit private void CPI() { - this.BlockCompare(this.HL()++, this.BC()); + this.BlockCompare(this.HL()++, ref this.BC()); ++this.MEMPTR(); } @@ -1864,7 +1864,7 @@ namespace EightBit private void CPD() { - this.BlockCompare(this.HL()--, this.BC()); + this.BlockCompare(this.HL()--, ref this.BC()); --this.MEMPTR(); } @@ -1904,7 +1904,7 @@ namespace EightBit private bool LDDR() { 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) @@ -2010,7 +2010,7 @@ namespace EightBit var memory = this.Bus.Read(); this.Bus.Write((byte)(PromoteNibble(memory) | LowNibble(this.A()))); 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); }