Compare commits

...

1 Commits

Author SHA1 Message Date
darkress
54381896c3 increment PC after every Instruction 2023-06-12 13:24:11 +02:00
6 changed files with 10 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package de.darkress.pic16f84sim.commands; package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.microcontroller.Memory; import de.darkress.pic16f84sim.microcontroller.Memory;
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
public class Andlw extends LiteralCommandUtils implements Command public class Andlw extends LiteralCommandUtils implements Command
{ {
@@ -18,5 +19,6 @@ public class Andlw extends LiteralCommandUtils implements Command
checkZeroBit(result); checkZeroBit(result);
Memory.workingRegister = result % 256; Memory.workingRegister = result % 256;
ProgramCounter.incPC();
} }
} }

View File

@@ -25,8 +25,7 @@ public class Decfsz extends FileRegisterCommandUtils implements Command
if((result % 256) == 0) if((result % 256) == 0)
{ {
Nop nop = new Nop(); ProgramCounter.incPC();
nop.execute(); // TODO: What happens if an interrupt gets triggered during the nop execution?
} }
ProgramCounter.incPC(); ProgramCounter.incPC();
} }

View File

@@ -25,8 +25,7 @@ public class Incfsz extends FileRegisterCommandUtils implements Command
if((result % 256) == 0) if((result % 256) == 0)
{ {
Nop nop = new Nop(); ProgramCounter.incPC();
nop.execute(); // TODO: What happens if an interrupt gets triggered during the nop execution?
} }
ProgramCounter.incPC(); ProgramCounter.incPC();
} }

View File

@@ -1,6 +1,7 @@
package de.darkress.pic16f84sim.commands; package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.microcontroller.Memory; import de.darkress.pic16f84sim.microcontroller.Memory;
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
public class Iorlw extends LiteralCommandUtils implements Command public class Iorlw extends LiteralCommandUtils implements Command
{ {
@@ -18,5 +19,6 @@ public class Iorlw extends LiteralCommandUtils implements Command
checkZeroBit(result); checkZeroBit(result);
Memory.workingRegister = result % 256; Memory.workingRegister = result % 256;
ProgramCounter.incPC();
} }
} }

View File

@@ -1,6 +1,7 @@
package de.darkress.pic16f84sim.commands; package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.microcontroller.Memory; import de.darkress.pic16f84sim.microcontroller.Memory;
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
public class Sublw extends LiteralCommandUtils implements Command public class Sublw extends LiteralCommandUtils implements Command
{ {
@@ -41,5 +42,6 @@ public class Sublw extends LiteralCommandUtils implements Command
checkDigitCarryBit(literal); checkDigitCarryBit(literal);
Memory.workingRegister = result % 256; Memory.workingRegister = result % 256;
ProgramCounter.incPC();
} }
} }

View File

@@ -1,6 +1,7 @@
package de.darkress.pic16f84sim.commands; package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.microcontroller.Memory; import de.darkress.pic16f84sim.microcontroller.Memory;
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
public class Xorlw extends LiteralCommandUtils implements Command public class Xorlw extends LiteralCommandUtils implements Command
{ {
@@ -18,5 +19,6 @@ public class Xorlw extends LiteralCommandUtils implements Command
checkZeroBit(result); checkZeroBit(result);
Memory.workingRegister = result % 256; Memory.workingRegister = result % 256;
ProgramCounter.incPC();
} }
} }