MC6809: Correct a branching problem due to the use of reference PC object.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-05-04 17:17:54 +01:00
parent f8757b3014
commit 430ecd8a7a
3 changed files with 10 additions and 6 deletions

View File

@ -49,7 +49,6 @@
this.cpu.CC = 0;
this.cpu.Step();
this.cpu.Step();
this.cpu.Step();
Assert.AreEqual(2, this.cpu.A);
}
@ -70,7 +69,6 @@
this.cpu.CC = (byte)(StatusBits.NF | StatusBits.VF);
this.cpu.Step();
this.cpu.Step();
this.cpu.Step();
Assert.AreEqual(2, this.cpu.A);
}

View File

@ -59,7 +59,6 @@
this.cpu.CC = (byte)StatusBits.NF;
this.cpu.Step();
this.cpu.Step();
this.cpu.Step();
Assert.AreEqual(2, this.cpu.A);
}
@ -79,7 +78,6 @@
this.cpu.CC = (byte)(StatusBits.ZF | StatusBits.NF);
this.cpu.Step();
this.cpu.Step();
this.cpu.Step();
Assert.AreEqual(2, this.cpu.A);
}
}

View File

@ -447,9 +447,17 @@
}
}
private Register16 Address_relative_byte() => new Register16(this.PC.Word + (sbyte)this.FetchByte());
private Register16 Address_relative_byte()
{
var offset = (sbyte)this.FetchByte();
return new Register16(this.PC.Word + offset);
}
private Register16 Address_relative_word() => new Register16(this.PC.Word + (short)this.FetchWord().Word);
private Register16 Address_relative_word()
{
var offset = (short)this.FetchWord().Word;
return new Register16(this.PC.Word + offset);
}
private Register16 Address_direct() => new Register16(this.FetchByte(), this.DP);