Compare commits

...

1 Commits

Author SHA1 Message Date
Darkress
30deff96a8 implemented Movwf instruction 2023-06-05 23:58:15 +02:00
3 changed files with 27 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ class Main
ArrayList<Command> program = new ArrayList<>();
Memory.workingRegister = 0x1A;
Memory.setRegister(0x14, 0x1B);
program.add(CommandDecoder.decode(0x0894));
program.add(CommandDecoder.decode(0x0094));
for(int i = 0; i < program.size(); i++)
{
program.get(ProgramCounter.getPc()).execute();

View File

@@ -0,0 +1,25 @@
package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.microcontroller.Memory;
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
public class Movwf extends FileRegisterCommandUtils implements Command
{
private final int address;
private final boolean destinationBit;
public Movwf(int input)
{
address = input & 0x007F;
destinationBit = true;
}
@Override
public void execute()
{
int result = Memory.workingRegister;
writeToDestination(destinationBit, address, result);
ProgramCounter.incPC();
}
}

View File

@@ -56,8 +56,7 @@ public class CommandDecoder
case 0x100:
return new Clrw();
case 0x80:
//movwf();
break;
return new Movwf(input);
}
switch(input & 0x3C00)