Compare commits
1 Commits
movwfInstr
...
retlwInstr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0f6179059 |
24
de/darkress/pic16f84sim/commands/Retlw.java
Normal file
24
de/darkress/pic16f84sim/commands/Retlw.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,5 +9,7 @@ public class Return extends CommandUtils implements Command
|
|||||||
public void execute()
|
public void execute()
|
||||||
{
|
{
|
||||||
ProgramCounter.setPcFrom11BitLiteral(Stack.pop());
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,8 +110,7 @@ public class CommandDecoder
|
|||||||
case 0x3000:
|
case 0x3000:
|
||||||
return new Movlw(input);
|
return new Movlw(input);
|
||||||
case 0x3400:
|
case 0x3400:
|
||||||
//retlw();
|
return new Retlw(input);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((input | 0x0060) == 0x0060)
|
if ((input | 0x0060) == 0x0060)
|
||||||
|
|||||||
Reference in New Issue
Block a user