Compare commits
2 Commits
watchdog
...
XorlwInstr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbe1229670 | ||
|
|
0d1db917c0 |
@@ -1,29 +1,18 @@
|
||||
package de.darkress.pic16f84sim;
|
||||
|
||||
import de.darkress.pic16f84sim.microcontroller.Stack;
|
||||
import de.darkress.pic16f84sim.commands.Command;
|
||||
import de.darkress.pic16f84sim.decoder.CommandDecoder;
|
||||
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class Main
|
||||
{
|
||||
public static void main(String[] args) {
|
||||
/*
|
||||
ArrayList<Command> program = new ArrayList<>();
|
||||
int input1 = 0x3EFF;
|
||||
Memory.workingRegister = 0xAA;
|
||||
int input1 = 0x3AFF;
|
||||
program.add(CommandDecoder.decode(input1));
|
||||
program.get(0).execute();
|
||||
*/
|
||||
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
Stack.push(i);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 16; i++)
|
||||
{
|
||||
System.out.println(Stack.peek());
|
||||
Stack.pop();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
22
de/darkress/pic16f84sim/commands/Xorlw.java
Normal file
22
de/darkress/pic16f84sim/commands/Xorlw.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package de.darkress.pic16f84sim.commands;
|
||||
|
||||
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||
|
||||
public class Xorlw extends CommandUtils implements Command
|
||||
{
|
||||
private final int literal;
|
||||
|
||||
public Xorlw(int input)
|
||||
{
|
||||
literal = input & 0x00FF;
|
||||
}
|
||||
@Override
|
||||
public void execute()
|
||||
{
|
||||
int result = literal ^ Memory.workingRegister;
|
||||
|
||||
checkZeroBit(result);
|
||||
|
||||
Memory.workingRegister = result % 256;
|
||||
}
|
||||
}
|
||||
@@ -55,8 +55,7 @@ public class CommandDecoder
|
||||
case 0x3800:
|
||||
return new Iorlw(input);
|
||||
case 0x3A00:
|
||||
//xorlw();
|
||||
break;
|
||||
return new Xorlw(input);
|
||||
}
|
||||
|
||||
switch(input & 0x3F80)
|
||||
|
||||
@@ -15,4 +15,9 @@ public class ProgramCounter
|
||||
{
|
||||
ProgramCounter.PC = PC;
|
||||
}
|
||||
|
||||
public static void incPC()
|
||||
{
|
||||
PC++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user