implemented PC (#11)

This commit is contained in:
DarkressX
2023-05-29 00:25:37 +02:00
committed by GitHub
parent 29ec2afe04
commit 769c37e5f3
10 changed files with 29 additions and 15 deletions

View File

@@ -1,11 +1,6 @@
package de.darkress.pic16f84sim; package de.darkress.pic16f84sim;
import de.darkress.pic16f84sim.commands.Command; import de.darkress.pic16f84sim.microcontroller.Stack;
import de.darkress.pic16f84sim.decoder.CommandDecoder;
import de.darkress.pic16f84sim.registers.Memory;
import de.darkress.pic16f84sim.registers.Stack;
import java.util.ArrayList;
class Main class Main
{ {
@@ -15,7 +10,8 @@ class Main
int input1 = 0x3EFF; int input1 = 0x3EFF;
program.add(CommandDecoder.decode(input1)); program.add(CommandDecoder.decode(input1));
program.get(0).execute(); program.get(0).execute();
*/ */
for(int i = 0; i < 8; i++) for(int i = 0; i < 8; i++)
{ {

View File

@@ -1,6 +1,6 @@
package de.darkress.pic16f84sim.commands; package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.registers.Memory; import de.darkress.pic16f84sim.microcontroller.Memory;
public class Addlw extends CommandUtils implements Command public class Addlw extends CommandUtils implements Command
{ {

View File

@@ -1,6 +1,6 @@
package de.darkress.pic16f84sim.commands; package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.registers.Memory; import de.darkress.pic16f84sim.microcontroller.Memory;
public class Andlw extends CommandUtils implements Command public class Andlw extends CommandUtils implements Command
{ {

View File

@@ -1,6 +1,6 @@
package de.darkress.pic16f84sim.commands; package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.registers.Memory; import de.darkress.pic16f84sim.microcontroller.Memory;
public class CommandUtils public class CommandUtils
{ {

View File

@@ -1,6 +1,6 @@
package de.darkress.pic16f84sim.commands; package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.registers.Memory; import de.darkress.pic16f84sim.microcontroller.Memory;
public class Iorlw extends CommandUtils implements Command public class Iorlw extends CommandUtils implements Command
{ {

View File

@@ -1,6 +1,6 @@
package de.darkress.pic16f84sim.commands; package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.registers.Memory; import de.darkress.pic16f84sim.microcontroller.Memory;
public class Movlw extends CommandUtils implements Command public class Movlw extends CommandUtils implements Command
{ {

View File

@@ -1,6 +1,6 @@
package de.darkress.pic16f84sim.commands; package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.registers.Memory; import de.darkress.pic16f84sim.microcontroller.Memory;
public class Sublw extends CommandUtils implements Command public class Sublw extends CommandUtils implements Command
{ {

View File

@@ -1,4 +1,4 @@
package de.darkress.pic16f84sim.registers; package de.darkress.pic16f84sim.microcontroller;
import java.util.Arrays; import java.util.Arrays;

View File

@@ -0,0 +1,18 @@
package de.darkress.pic16f84sim.microcontroller;
public class ProgramCounter
//This class is not actual part of the µC. It is a storage for the current value of the PC
{
private static int PC = 0;
public static int getPC()
{
return PC;
}
public static void setPC(int PC)
{
ProgramCounter.PC = PC;
}
}

View File

@@ -1,4 +1,4 @@
package de.darkress.pic16f84sim.registers; package de.darkress.pic16f84sim.microcontroller;
public class Stack public class Stack