Compare commits
1 Commits
clrwdtInst
...
xorwfInstr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21ee79f6ef |
@@ -14,7 +14,7 @@ class Main
|
|||||||
ArrayList<Command> program = new ArrayList<>();
|
ArrayList<Command> program = new ArrayList<>();
|
||||||
Memory.workingRegister = 0x01;
|
Memory.workingRegister = 0x01;
|
||||||
Memory.setRegister(0x14, 0xA5); //240 << 224
|
Memory.setRegister(0x14, 0xA5); //240 << 224
|
||||||
program.add(CommandDecoder.decode(0x0E94));
|
program.add(CommandDecoder.decode(0x0694));
|
||||||
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/Xorwf.java
Normal file
27
de/darkress/pic16f84sim/commands/Xorwf.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 Xorwf extends FileRegisterCommandUtils implements Command
|
||||||
|
{
|
||||||
|
private final int address;
|
||||||
|
private final boolean destinationBit;
|
||||||
|
|
||||||
|
public Xorwf(int input)
|
||||||
|
{
|
||||||
|
address = input & 0x007F;
|
||||||
|
destinationBit = checkDestinationBit(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute()
|
||||||
|
{
|
||||||
|
int result = Memory.getRegister(address) ^ Memory.workingRegister;
|
||||||
|
|
||||||
|
checkZeroBit(result);
|
||||||
|
|
||||||
|
writeToDestination(destinationBit, address, result);
|
||||||
|
ProgramCounter.incPC();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,8 +35,7 @@ public class CommandDecoder
|
|||||||
case 0xE00:
|
case 0xE00:
|
||||||
return new Swapf(input);
|
return new Swapf(input);
|
||||||
case 0x600:
|
case 0x600:
|
||||||
//xorwf();
|
return new Xorwf(input);
|
||||||
break;
|
|
||||||
case 0x3900:
|
case 0x3900:
|
||||||
return new Andlw(input);
|
return new Andlw(input);
|
||||||
case 0x3800:
|
case 0x3800:
|
||||||
|
|||||||
Reference in New Issue
Block a user