@Test public void executeTargetImm() { int memorySize = ConfigHelper.getConfig().getInt("memory_size"); Memory memory = new Memory(memorySize); memory.clear(); Status status = new Status(); status.clear(); AndInstruction andInstruction = new AndInstruction(); memory.clear(); memory.set(0, 0x1010); andInstruction.execute(memory, 0, 0x0101, status); assertEquals(0, memory.get(0)); assertEquals(false, status.isSignFlag()); assertEquals(true, status.isZeroFlag()); assertEquals(false, status.isOverflowFlag()); assertEquals(false, status.isCarryFlag()); }
@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); int result = (a & b); status.setSignFlag(Util.checkSign16(result)); status.setZeroFlag((char) result == 0); status.setOverflowFlag(false); status.setCarryFlag(false); dst.set(dstIndex, result); return status; }
AndInstruction 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); int result = (a & b); status.setSignFlag(Util.checkSign16(result)); status.setZeroFlag((char) result == 0); status.setOverflowFlag(false); status.setCarryFlag(false); dst.set(dstIndex, result); return status; } }
AndInstruction 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); int result = (a & b); status.setSignFlag(Util.checkSign16(result)); status.setZeroFlag((char) result == 0); status.setOverflowFlag(false); status.setCarryFlag(false); dst.set(dstIndex, result); return status; } AndInstruction(); }
AndInstruction 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); int result = (a & b); status.setSignFlag(Util.checkSign16(result)); status.setZeroFlag((char) result == 0); status.setOverflowFlag(false); status.setCarryFlag(false); dst.set(dstIndex, result); return status; } AndInstruction(); @Override Status execute(Target dst, int dstIndex, Target src, int srcIndex, Status status); @Override Status execute(Target dst, int dstIndex, int src, Status status); }
AndInstruction 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); int result = (a & b); status.setSignFlag(Util.checkSign16(result)); status.setZeroFlag((char) result == 0); status.setOverflowFlag(false); status.setCarryFlag(false); dst.set(dstIndex, result); return status; } AndInstruction(); @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; }