package rebelsky.pal; /** * The PAL instruction to write a floating-point value. * * @author Samuel A. Rebelsky * @version 1.1 of December 2002. */ public class FWrite implements Instruction { // +--------+------------------------------------------------------------ // | Fields | // +--------+ /** The container to write. */ Variable value; // +--------------+------------------------------------------------------ // | Constructors | // +--------------+ /** * Create a new instruction to write a value. */ public FWrite(Variable value) { this.value = value; } // IWrite(Variable) // +---------+----------------------------------------------------------- // | Methods | // +---------+ /** * Execute the instruction on a machine. * * @exception Exception * If the memory location is invalid. */ public void execute(Computer hal) throws Exception { hal.out.println(value.fget(hal)); } // execute(Computer) /** Convert the instruction to a string (usually for printing). */ public String toString() { return " FWRITE " + value.toString(); } // toString() } // class FWrite