implemented Retlw instruction (#5)

Co-authored-by: Darkress <30271678+DarkressX@users.noreply.github.com>
Reviewed-on: darkress/pic16f84-sim#5
This commit was merged in pull request #5.
This commit is contained in:
darkress
2023-05-31 02:00:25 +02:00
parent eed0b2e3eb
commit 2cfc14ba78
3 changed files with 27 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.microcontroller.Memory;
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
import de.darkress.pic16f84sim.microcontroller.Stack;
public class Retlw extends CommandUtils implements Command
{
private final int literal;
public Retlw(int input)
{
literal = input & 0x00FF;
}
@Override
public void execute()
{
Memory.workingRegister = literal;
ProgramCounter.setPcFrom11BitLiteral(Stack.pop());
//TODO: This may need some rework since it does not really load all 13 Bit into the PC. Only 8 Bit are
// effectively set
}
}

View File

@@ -9,5 +9,7 @@ public class Return extends CommandUtils implements Command
public void execute()
{
ProgramCounter.setPcFrom11BitLiteral(Stack.pop());
//TODO: This may need some rework since it does not really load all 13 Bit into the PC. Only 8 Bit are
// effectively set
}
}