HateLace/app/src/main/java/hatelace/instructions/Copy.java
2024-04-16 12:54:33 +02:00

30 lines
664 B
Java

package hatelace.instructions;
import hatelace.Address;
import hatelace.Word;
import hatelace.Memory;
import hatelace.ProgramCounter;
import hatelace.Instruction;
public class Copy extends Instruction {
private Word word;
private Address address;
public Copy(Word word, Address address) {
this.word = word;
this.address = address;
}
public void execute(Memory memory, ProgramCounter PC) {
memory.write(this.address, this.word);
PC.incPC();
}
protected String opcode() {
return "copy";
}
protected Object[] operands() {
return new Object[] {this.word, this.address};
}
}