This commit is contained in:
2024-04-22 12:18:40 +02:00
parent 7be45ed266
commit 59c77f8b8a
3 changed files with 7 additions and 5 deletions

View File

@ -40,7 +40,7 @@ public class Commands {
return;
case 0b01010000000000:
System.out.println("BSF: " + f + " " + b);
DataRegister.clearBit(f, b);
DataRegister.setBit(f, b);
return;
case 0b01100000000000:
System.out.println("BTFSC: " + f + " " + b);

View File

@ -48,7 +48,6 @@ public class Controller_FileSelect {
}
}
}
public int[] getProg() {
return prog;
}

View File

@ -48,11 +48,15 @@ public class DataRegister {
}
public static void clearBit(int address, int bit) {
dataRegister[bank() + address] -= (int) Math.pow(2, bit);
if (getBit(address, bit) == 1) {
dataRegister[bank() + address] -= (int) Math.pow(2, bit);
}
}
public static void setBit(int address, int bit) {
dataRegister[bank() + address] += (int) Math.pow(2, bit);
if (getBit(address, bit) == 0) {
dataRegister[bank() + address] += (int) Math.pow(2, bit);
}
}
private static int programCounter = 0;
@ -81,5 +85,4 @@ public class DataRegister {
public static int getPC(){
return programCounter;
}
}