Simplify parity adjustment in block IO repeat code.

This commit is contained in:
Adrian Conlon committed 2026-05-03 11:37:02 +01:00
1 parent 88d4ab5126
commit 2bb004598e
1 file changed
+5 -8
+5 -8
View File
@@ -2142,19 +2142,16 @@ namespace Z80
private void AdjustBlockRepeatFlagsIO()
{
var direction = this.B;
if (this.Carry() != 0)
{
var negative = SignTest(this.Bus.Data) != 0;
var direction = (byte)(this.B + (negative ? -1 : +1));
var parity = (this.Parity() >> 2) ^ (EvenParity((byte)(direction & (byte)Mask.Three)) ? 1 : 0) ^ 1;
this.SetBit(StatusBits.PF, parity != 0);
direction += (byte)(negative ? -1 : +1);
this.SetBit(StatusBits.HC, (this.B & (byte)Mask.Four) == (negative ? 0 : (int)Mask.Four));
}
else
{
var parity = (this.Parity() >> 2) ^ (EvenParity((byte)(this.B & (byte)Mask.Three)) ? 1 : 0) ^ 1;
this.SetBit(StatusBits.PF, parity != 0);
}
var parity = (this.Parity() >> 2) ^ (EvenParity((byte)(direction & (byte)Mask.Three)) ? 1 : 0) ^ 1;
this.SetBit(StatusBits.PF, parity != 0);
}
private void AdjustBlockInputOutputFlags(int basis)