implemented PC (#11)
This commit is contained in:
@@ -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++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package de.darkress.pic16f84sim.registers;
|
package de.darkress.pic16f84sim.microcontroller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
18
de/darkress/pic16f84sim/microcontroller/ProgramCounter.java
Normal file
18
de/darkress/pic16f84sim/microcontroller/ProgramCounter.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package de.darkress.pic16f84sim.registers;
|
package de.darkress.pic16f84sim.microcontroller;
|
||||||
|
|
||||||
|
|
||||||
public class Stack
|
public class Stack
|
||||||
Reference in New Issue
Block a user