Compare commits

..

2 Commits

Author SHA1 Message Date
Darkress
89f4845df6 implemented decfsz Instruction 2023-05-31 20:50:27 +02:00
Darkress
e18ec6d167 Started implementation of decfsz Instruction 2023-05-31 20:25:25 +02:00
3 changed files with 6 additions and 29 deletions

View File

@@ -15,7 +15,10 @@ class Main
int input1 = 0x27FF;
program.add(CommandDecoder.decode(0x3011)); //Write 0x11 to W
Memory.setRegister(0x14, 0x01);
program.add(CommandDecoder.decode(0x0A94)); //Write 0x11 to W
program.add(CommandDecoder.decode(0x0B94));
program.add(CommandDecoder.decode(0x0B94));
program.add(CommandDecoder.decode(0x0B94));
program.add(CommandDecoder.decode(0x3F05));
for(int i = 0; i < program.size(); i++)
{
program.get(ProgramCounter.getPc()).execute();

View File

@@ -1,27 +0,0 @@
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();
}
}

View File

@@ -19,7 +19,8 @@ public class CommandDecoder
case 0xB00:
return new Decfsz(input);
case 0xA00:
return new Incf(input);
//incf();
break;
case 0xF00:
//incfsz();
break;