Skip to content

Commit

Permalink
Make division and bitwise operations unset carry flag
Browse files Browse the repository at this point in the history
  • Loading branch information
TollyH committed Dec 24, 2022
1 parent 98922be commit 4acc0af
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Processor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,10 @@ public bool Step()
default:
throw new InvalidOperationException($"{opcodeLow:X} is not a recognised division low opcode");
}
if ((Registers[Data.Register.rsf] & 0b10) != 0)
{
Registers[Data.Register.rsf] ^= 0b10;
}
if (Registers[targetRegister] == 0)
{
Registers[Data.Register.rsf] |= 0b1;
Expand Down Expand Up @@ -591,6 +595,10 @@ public bool Step()
default:
throw new InvalidOperationException($"{opcodeLow:X} is not a recognised bitwise low opcode");
}
if ((Registers[Data.Register.rsf] & 0b10) != 0)
{
Registers[Data.Register.rsf] ^= 0b10;
}
if (Registers[targetRegister] == 0)
{
Registers[Data.Register.rsf] |= 0b1;
Expand Down

0 comments on commit 4acc0af

Please sign in to comment.