Compare commits

..

1 Commits

Author SHA1 Message Date
Darkress
87bacdb1e6 implemented return instruction; Fixed Bug in Stack.pop() 2023-05-31 01:29:26 +02:00
3 changed files with 2 additions and 27 deletions

View File

@@ -1,24 +0,0 @@
package de.darkress.pic16f84sim.commands;
import de.darkress.pic16f84sim.microcontroller.Memory;
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
import de.darkress.pic16f84sim.microcontroller.Stack;
public class Retlw extends CommandUtils implements Command
{
private final int literal;
public Retlw(int input)
{
literal = input & 0x00FF;
}
@Override
public void execute()
{
Memory.workingRegister = literal;
ProgramCounter.setPcFrom11BitLiteral(Stack.pop());
//TODO: This may need some rework since it does not really load all 13 Bit into the PC. Only 8 Bit are
// effectively set
}
}

View File

@@ -9,7 +9,5 @@ public class Return extends CommandUtils implements Command
public void execute()
{
ProgramCounter.setPcFrom11BitLiteral(Stack.pop());
//TODO: This may need some rework since it does not really load all 13 Bit into the PC. Only 8 Bit are
// effectively set
}
}

View File

@@ -110,7 +110,8 @@ public class CommandDecoder
case 0x3000:
return new Movlw(input);
case 0x3400:
return new Retlw(input);
//retlw();
break;
}
if ((input | 0x0060) == 0x0060)