Compare commits
1 Commits
RrfInstruc
...
movwfInstr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30deff96a8 |
@@ -14,7 +14,7 @@ class Main
|
|||||||
ArrayList<Command> program = new ArrayList<>();
|
ArrayList<Command> program = new ArrayList<>();
|
||||||
Memory.workingRegister = 0x1A;
|
Memory.workingRegister = 0x1A;
|
||||||
Memory.setRegister(0x14, 0x1B);
|
Memory.setRegister(0x14, 0x1B);
|
||||||
program.add(CommandDecoder.decode(0x0894));
|
program.add(CommandDecoder.decode(0x0094));
|
||||||
for(int i = 0; i < program.size(); i++)
|
for(int i = 0; i < program.size(); i++)
|
||||||
{
|
{
|
||||||
program.get(ProgramCounter.getPc()).execute();
|
program.get(ProgramCounter.getPc()).execute();
|
||||||
|
|||||||
25
de/darkress/pic16f84sim/commands/Movwf.java
Normal file
25
de/darkress/pic16f84sim/commands/Movwf.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,8 +56,7 @@ public class CommandDecoder
|
|||||||
case 0x100:
|
case 0x100:
|
||||||
return new Clrw();
|
return new Clrw();
|
||||||
case 0x80:
|
case 0x80:
|
||||||
//movwf();
|
return new Movwf(input);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(input & 0x3C00)
|
switch(input & 0x3C00)
|
||||||
|
|||||||
Reference in New Issue
Block a user