package lab05;

public class InstructionNOT extends Instruction {

	public InstructionNOT(int opcode,int mode, int argument) { 
		super(opcode, mode, argument);
	}
	
	@Override
	public boolean isModeValid() { return getMode()==findMode("NOM"); }

	@Override
	public void execute(CPU cpu) { 
		int newValue = ((cpu.getAccumulator() != 0) ? 0 : 1);
		cpu.setAccumulator(newValue);
		Trace.message(this + " acc=" + cpu.getAccumulator());
	}
}
