Fixed exceptions not setting the correct branch delay value.
parent
eb41337dce
commit
c15c1d0b18
|
@ -32,7 +32,7 @@
|
|||
|
||||
if (!cpu.CP0.Status.EXL)
|
||||
{
|
||||
if (cpu.CP0.Cause.BD = cpu.DelaySlot.HasValue) // FIXME: Step() nullifies the delay slot before executing it.
|
||||
if ((cpu.CP0.Cause.BD = cpu.branchDelay))
|
||||
cpu.CP0.Registers[(int)SystemControlUnit.RegisterIndex.EPC] = cpu.PC - Instruction.Size;
|
||||
else
|
||||
cpu.CP0.Registers[(int)SystemControlUnit.RegisterIndex.EPC] = cpu.PC;
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace DotN64.CPU
|
|||
public partial class VR4300
|
||||
{
|
||||
#region Fields
|
||||
private bool branchDelay;
|
||||
private readonly IReadOnlyDictionary<Instruction, Action<Instruction>> operations;
|
||||
private readonly IReadOnlyDictionary<byte, float> divModeMultipliers = new Dictionary<byte, float>
|
||||
{
|
||||
|
@ -253,8 +254,9 @@ namespace DotN64.CPU
|
|||
private void Step()
|
||||
{
|
||||
Instruction instruction;
|
||||
branchDelay = DelaySlot.HasValue;
|
||||
|
||||
if (!DelaySlot.HasValue)
|
||||
if (!branchDelay)
|
||||
{
|
||||
instruction = ReadWord(PC);
|
||||
PC += Instruction.Size;
|
||||
|
|
Loading…
Reference in New Issue