Compare commits
1 Commits
timer0
...
andwfInstr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ccc7f72c61 |
@@ -15,7 +15,7 @@ class Main
|
|||||||
int input1 = 0x27FF;
|
int input1 = 0x27FF;
|
||||||
program.add(CommandDecoder.decode(0x3011)); //Write 0x11 to W
|
program.add(CommandDecoder.decode(0x3011)); //Write 0x11 to W
|
||||||
Memory.setRegister(0x14, 0x14);
|
Memory.setRegister(0x14, 0x14);
|
||||||
program.add(CommandDecoder.decode(0x0714));
|
program.add(CommandDecoder.decode(0x0594));
|
||||||
for(int i = 0; i < 2; i++)
|
for(int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
program.get(ProgramCounter.getPc()).execute();
|
program.get(ProgramCounter.getPc()).execute();
|
||||||
|
|||||||
27
de/darkress/pic16f84sim/commands/Andwf.java
Normal file
27
de/darkress/pic16f84sim/commands/Andwf.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 Andwf extends FileRegisterCommandUtils implements Command
|
||||||
|
{
|
||||||
|
private final int address;
|
||||||
|
private final boolean destinationBit;
|
||||||
|
|
||||||
|
public Andwf(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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,8 +11,7 @@ public class CommandDecoder
|
|||||||
case 0x700:
|
case 0x700:
|
||||||
return new Addwf(input);
|
return new Addwf(input);
|
||||||
case 0x500:
|
case 0x500:
|
||||||
//andwf();
|
return new Andwf(input);
|
||||||
break;
|
|
||||||
case 0x900:
|
case 0x900:
|
||||||
//comf();
|
//comf();
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user