implemented Rrf Instruction (#21)

Co-authored-by: Darkress <30271678+DarkressX@users.noreply.github.com>
Reviewed-on: darkress/pic16f84-sim#21
This commit was merged in pull request #21.
This commit is contained in:
darkress
2023-06-06 02:42:28 +02:00
parent 01bd5acb46
commit d25a66134a
4 changed files with 43 additions and 10 deletions

View File

@@ -18,15 +18,14 @@ public class Rlf extends FileRegisterCommandUtils implements Command
public void execute()
{
int register = Memory.getRegister(address);
int carry = Memory.getCarryBit();
int tmp = carry;
carry = register >>7;
register = ((register <<1) + tmp) & 0xFF;
int newCarry = register >>7;
int oldCarry = Memory.getCarryBit();
register = ((register <<1) + oldCarry) & 0xFF;
if(carry == 1)
if(newCarry == 1)
{
Memory.setCarryBit();
} else if(carry == 0){
} else if(newCarry == 0){
Memory.clearCarryBit();
}