diff --git a/Server/src/net/simon987/server/assembly/CPU.java b/Server/src/net/simon987/server/assembly/CPU.java index 06808f2..da5778a 100755 --- a/Server/src/net/simon987/server/assembly/CPU.java +++ b/Server/src/net/simon987/server/assembly/CPU.java @@ -93,6 +93,7 @@ public class CPU implements JSONSerialisable{ instructionSet.add(new JsInstruction(this)); instructionSet.add(new HwiInstruction(this)); instructionSet.add(new HwqInstruction(this)); + instructionSet.add(new XchgInstruction(this)); status = new Status(); memory = new Memory(config.getInt("memory_size")); diff --git a/Server/src/net/simon987/server/assembly/instruction/LeaInstruction.java b/Server/src/net/simon987/server/assembly/instruction/LeaInstruction.java new file mode 100644 index 0000000..b18bd2e --- /dev/null +++ b/Server/src/net/simon987/server/assembly/instruction/LeaInstruction.java @@ -0,0 +1,14 @@ +package net.simon987.server.assembly.instruction; + +import net.simon987.server.assembly.Instruction; + +public class LeaInstruction extends Instruction { + + public static final int OPCODE = 30; + + public LeaInstruction() { + super("lea", OPCODE); + } + + +} diff --git a/Server/src/net/simon987/server/assembly/instruction/XchgInstruction.java b/Server/src/net/simon987/server/assembly/instruction/XchgInstruction.java new file mode 100644 index 0000000..29b875b --- /dev/null +++ b/Server/src/net/simon987/server/assembly/instruction/XchgInstruction.java @@ -0,0 +1,33 @@ +package net.simon987.server.assembly.instruction; + +import net.simon987.server.assembly.CPU; +import net.simon987.server.assembly.Instruction; +import net.simon987.server.assembly.Status; +import net.simon987.server.assembly.Target; + + +/** + * Swap operands. Does not alter the flags + */ +public class XchgInstruction extends Instruction { + + public static final int OPCODE = 31; + + private CPU cpu; + + public XchgInstruction(CPU cpu) { + super("xchg", OPCODE); + + this.cpu = cpu; + } + + @Override + public Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status) { + + int tmp = dst.get(dstIndex); + dst.set(dstIndex, src.get(srcIndex)); + src.set(srcIndex, tmp); + + return status; + } +} diff --git a/plugins/Cubot.jar b/plugins/Cubot.jar index b6ea076..2810bdf 100644 Binary files a/plugins/Cubot.jar and b/plugins/Cubot.jar differ