Compare commits
1 Commits
decfInstru
...
returnInst
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87bacdb1e6 |
@@ -12,13 +12,14 @@ class Main
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
ArrayList<Command> program = new ArrayList<>();
|
ArrayList<Command> program = new ArrayList<>();
|
||||||
Memory.workingRegister = 0xAA;
|
|
||||||
int input1 = 0x27FF;
|
int input1 = 0x27FF;
|
||||||
program.add(CommandDecoder.decode(input1));
|
program.add(CommandDecoder.decode(0x3011));
|
||||||
|
program.add(CommandDecoder.decode(0x2003));
|
||||||
Memory.setPCLATH(0xFF);
|
program.add(CommandDecoder.decode(0x3022));
|
||||||
program.get(0).execute();
|
program.add(CommandDecoder.decode(0x0008));
|
||||||
|
while(true)
|
||||||
//ProgramCounter.incPC();
|
{
|
||||||
|
program.get(ProgramCounter.getPc()).execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
13
de/darkress/pic16f84sim/commands/Return.java
Normal file
13
de/darkress/pic16f84sim/commands/Return.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package de.darkress.pic16f84sim.commands;
|
||||||
|
|
||||||
|
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
|
||||||
|
import de.darkress.pic16f84sim.microcontroller.Stack;
|
||||||
|
|
||||||
|
public class Return extends CommandUtils implements Command
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void execute()
|
||||||
|
{
|
||||||
|
ProgramCounter.setPcFrom11BitLiteral(Stack.pop());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -131,8 +131,7 @@ public class CommandDecoder
|
|||||||
|
|
||||||
if (input == 0x0008)
|
if (input == 0x0008)
|
||||||
{
|
{
|
||||||
//return();
|
return new Return();
|
||||||
//This is the function name. Do not mistake this for a normal return!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input == 0x0063)
|
if (input == 0x0063)
|
||||||
|
|||||||
@@ -14,9 +14,8 @@ public class Stack
|
|||||||
|
|
||||||
public static int pop()
|
public static int pop()
|
||||||
{
|
{
|
||||||
int tmp = stack[stackPointer];
|
|
||||||
pointPrevious();
|
pointPrevious();
|
||||||
return tmp;
|
return stack[stackPointer];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int peek()
|
public static int peek()
|
||||||
|
|||||||
Reference in New Issue
Block a user