Skip to content

Commit

Permalink
Fix TST setting carry flag
Browse files Browse the repository at this point in the history
  • Loading branch information
TollyH committed Dec 23, 2022
1 parent 86dc141 commit 2254097
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Processor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public bool Step()
default:
throw new InvalidOperationException($"{opcodeLow:X} is not a recognised shifting low opcode");
}
if (opcodeLow is 0x0 or 0x1 or 0x2 or 0x3 ? Registers[targetRegister] < initial : Registers[targetRegister] > initial)
if (opcodeLow <= 0x3 ? Registers[targetRegister] < initial : Registers[targetRegister] > initial)
{
Registers[Data.Register.rsf] |= 0b10;
}
Expand Down Expand Up @@ -644,7 +644,7 @@ public bool Step()
default:
throw new InvalidOperationException($"{opcodeLow:X} is not a recognised comparison low opcode");
}
if (newValue > Registers[targetRegister])
if (opcodeLow >= 0x4 && newValue > Registers[targetRegister])
{
Registers[Data.Register.rsf] |= 0b10;
}
Expand Down

0 comments on commit 2254097

Please sign in to comment.