import Location; import java.io.PrintWriter; /** * A constant value used as an argument for some instructions, such * as MOV $2, %eax. Part of the amazingly abstract assembly language. * * @author Samuel A. Rebelsky * @version 1.0 of April 2001 */ public class Value implements Location { // +--------+------------------------------------------------------------ // | Fields | // +--------+ /** The value of the constant. */ protected int value; // +--------------+------------------------------------------------------ // | Constructors | // +--------------+ /** * Build a new constant with specified value. */ public Value(int initialValue) { this.value = initialValue; } // Value(int) // +------------------+-------------------------------------------------- // | Location Methods | // +------------------+ /** * Print the value. */ public void print(PrintWriter out) { out.print("$" + this.value); } // print(PrintWriter) } // class Value