@Test public void addTargetImm() { int memorySize = ConfigHelper.getConfig().getInt("memory_size"); Memory memory = new Memory(memorySize); memory.clear(); Status status = new Status(); status.clear(); AddInstruction addInstruction = new AddInstruction(); memory.clear(); memory.set(0, 10); addInstruction.execute(memory, 0, 10, status); assertEquals(20, memory.get(0)); assertFalse(status.isSignFlag()); assertFalse(status.isZeroFlag()); assertFalse(status.isCarryFlag()); assertFalse(status.isOverflowFlag()); assertFalse(status.isBreakFlag()); }
@Override public Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status) { int a = (char) dst.get(dstIndex); int b = (char) src.get(srcIndex); return add(a, b, status, dst, dstIndex); }
AddInstruction extends Instruction { @Override public Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status) { int a = (char) dst.get(dstIndex); int b = (char) src.get(srcIndex); return add(a, b, status, dst, dstIndex); } }
AddInstruction extends Instruction { @Override public Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status) { int a = (char) dst.get(dstIndex); int b = (char) src.get(srcIndex); return add(a, b, status, dst, dstIndex); } AddInstruction(); }
AddInstruction extends Instruction { @Override public Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status) { int a = (char) dst.get(dstIndex); int b = (char) src.get(srcIndex); return add(a, b, status, dst, dstIndex); } AddInstruction(); @Override Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status); @Override Status execute(Target dst, int dstIndex, int src, Status status); }
AddInstruction extends Instruction { @Override public Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status) { int a = (char) dst.get(dstIndex); int b = (char) src.get(srcIndex); return add(a, b, status, dst, dstIndex); } AddInstruction(); @Override Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status); @Override Status execute(Target dst, int dstIndex, int src, Status status); static final int OPCODE; }