HateLace/app/src/main/java/hatelace/instructions/Print.java
2024-04-21 22:17:49 +02:00

29 lines
639 B
Java

package hatelace.instructions;
import hatelace.*;
public class Print implements Instruction {
private Address address;
/** Print content of memory address */
public Print(Address address) {
this.address = address;
}
public void execute(Memory memory, ProgramCounter PC) {
System.out.println(memory.read(this.address));
PC.incPC();
}
public String opcode() {
return "PRT";
}
public Object[] operands() {
return new Object[] { this.address };
}
public String toString() {
return String.format("%s [%s]", this.opcode(), this.address);
}
}