Compare commits
2 Commits
decfszInst
...
incfInstru
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd6649ab59 | ||
|
|
c896b4f199 |
@@ -15,10 +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, 0x01);
|
Memory.setRegister(0x14, 0x01);
|
||||||
program.add(CommandDecoder.decode(0x0B94));
|
program.add(CommandDecoder.decode(0x0A94)); //Write 0x11 to W
|
||||||
program.add(CommandDecoder.decode(0x0B94));
|
|
||||||
program.add(CommandDecoder.decode(0x0B94));
|
|
||||||
program.add(CommandDecoder.decode(0x3F05));
|
|
||||||
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/Incf.java
Normal file
27
de/darkress/pic16f84sim/commands/Incf.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 Incf extends FileRegisterCommandUtils implements Command
|
||||||
|
{
|
||||||
|
private final int address;
|
||||||
|
private final boolean destinationBit;
|
||||||
|
|
||||||
|
public Incf(int input)
|
||||||
|
{
|
||||||
|
address = input & 0x007F;
|
||||||
|
destinationBit = checkDestinationBit(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute()
|
||||||
|
{
|
||||||
|
int result = Memory.getRegister(address) + 1; // Allow underflow
|
||||||
|
|
||||||
|
checkZeroBit(result);
|
||||||
|
|
||||||
|
writeToDestination(destinationBit, address, result % 256); // Catch underflow
|
||||||
|
ProgramCounter.incPC();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,8 +19,7 @@ public class CommandDecoder
|
|||||||
case 0xB00:
|
case 0xB00:
|
||||||
return new Decfsz(input);
|
return new Decfsz(input);
|
||||||
case 0xA00:
|
case 0xA00:
|
||||||
//incf();
|
return new Incf(input);
|
||||||
break;
|
|
||||||
case 0xF00:
|
case 0xF00:
|
||||||
//incfsz();
|
//incfsz();
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user