implemented Movf Instruction
This commit is contained in:
27
de/darkress/pic16f84sim/commands/Movf.java
Normal file
27
de/darkress/pic16f84sim/commands/Movf.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package de.darkress.pic16f84sim.commands;
|
||||
|
||||
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
|
||||
|
||||
public class Movf extends FileRegisterCommandUtils implements Command
|
||||
{
|
||||
private final int address;
|
||||
private final boolean destinationBit;
|
||||
|
||||
public Movf(int input)
|
||||
{
|
||||
address = input & 0x007F;
|
||||
destinationBit = checkDestinationBit(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute()
|
||||
{
|
||||
int result = Memory.getRegister(address);
|
||||
|
||||
checkZeroBit(result);
|
||||
|
||||
writeToDestination(destinationBit, address, result);
|
||||
ProgramCounter.incPC();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user