Compare commits
1 Commits
timer0
...
movfInstru
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36f018835f |
@@ -12,9 +12,9 @@ class Main
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
ArrayList<Command> program = new ArrayList<>();
|
ArrayList<Command> program = new ArrayList<>();
|
||||||
Memory.workingRegister = 0B11001100;
|
Memory.workingRegister = 0x1A;
|
||||||
Memory.setRegister(0x14, 0B11110000);
|
Memory.setRegister(0x14, 0x1B);
|
||||||
program.add(CommandDecoder.decode(0x0414));
|
program.add(CommandDecoder.decode(0x0894));
|
||||||
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();
|
||||||
|
|||||||
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,8 +25,7 @@ public class CommandDecoder
|
|||||||
case 0x400:
|
case 0x400:
|
||||||
return new Iorwf(input);
|
return new Iorwf(input);
|
||||||
case 0x800:
|
case 0x800:
|
||||||
//movf();
|
return new Movf(input);
|
||||||
break;
|
|
||||||
case 0xD00:
|
case 0xD00:
|
||||||
//rlf();
|
//rlf();
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user