Compare commits
1 Commits
RlfInstruc
...
clrfInstru
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a21d9256f |
@@ -12,8 +12,8 @@ class Main
|
||||
public static void main(String[] args) {
|
||||
|
||||
ArrayList<Command> program = new ArrayList<>();
|
||||
Memory.workingRegister = 0x10;
|
||||
program.add(CommandDecoder.decode(0x123)); //Write 0x11 to W
|
||||
Memory.setRegister(0x14, 0xFF);
|
||||
program.add(CommandDecoder.decode(0x0194));
|
||||
for(int i = 0; i < program.size(); i++)
|
||||
{
|
||||
program.get(ProgramCounter.getPc()).execute();
|
||||
|
||||
27
de/darkress/pic16f84sim/commands/Clrf.java
Normal file
27
de/darkress/pic16f84sim/commands/Clrf.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 Clrf extends FileRegisterCommandUtils implements Command
|
||||
{
|
||||
private final int address;
|
||||
private final boolean destinationBit;
|
||||
|
||||
public Clrf(int input)
|
||||
{
|
||||
address = input & 0x007F;
|
||||
destinationBit = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute()
|
||||
{
|
||||
final int result = 0;
|
||||
|
||||
checkZeroBit(result);
|
||||
|
||||
writeToDestination(destinationBit, address, result);
|
||||
ProgramCounter.incPC();
|
||||
}
|
||||
}
|
||||
@@ -54,8 +54,7 @@ public class CommandDecoder
|
||||
switch(input & 0x3F80)
|
||||
{
|
||||
case 0x180:
|
||||
//clrf();
|
||||
break;
|
||||
return new Clrf(input);
|
||||
case 0x100:
|
||||
return new Clrw();
|
||||
case 0x80:
|
||||
|
||||
Reference in New Issue
Block a user