/// <summary> /// Constructor for an operand which is a register /// </summary> /// <param name="reg">the register to be passed as an operand</param> /// <param name="type"> the type of the operand i.e memory address or intermediate value</param> public Operand(Register reg, EnumOperandType type) { isRegister = true; register = reg; value = reg.Value; this.type = type; }
/// <summary> /// Constructor for an operand which is an intermediate value /// </summary> /// <param name="value"> the value of the operand </param> /// <param name="type"> the type of the operand i.e memory address or intermediate value</param> public Operand(int value, EnumOperandType type) { this.value = value; this.type = type; IsRegister = false; register = null; }
public Operand(string labelName, EnumOperandType type) { isRegister = false; register = null; value = 0; this.type = type; this.labelName = labelName; }
/// <summary> /// Primary constructor for a special register /// </summary> /// <param name="name"> The name of the register</param> protected SpecialRegister(string name) { this.name = name; value = 0; type = EnumOperandType.VALUE; if (name.Equals("SP")) { Value = 8096; // initialize the stack pointer to 8096 } }
/// <summary> /// Sets the string value in a special register /// </summary> /// <param name="value"> the value to store in the register</param> /// <param name="type">the type of data memory or value</param> public override void SetRegisterValue(string value, EnumOperandType type) { valueString = value; this.type = type; }
/// <summary> /// Sets the value in a special register /// </summary> /// <param name="value"> the value to store in the register</param> /// <param name="type">the type of data memory or value</param> public override void SetRegisterValue(int value, EnumOperandType type) { this.value = value; this.type = type; }
/// <summary> /// Protected constructor for a register /// this is the primary constructor for a register. /// </summary> /// <param name="name"> the name of the register</param> protected Register(string name) { this.name = name; value = 0; type = EnumOperandType.VALUE; }
public virtual void SetRegisterValue(string value, EnumOperandType type) { throw new NotSupportedException(); }
/// <summary> /// Sets the value in a register /// </summary> /// <param name="value"> the value to store in the register</param> /// <param name="type">the type of data memory or value</param> public virtual void SetRegisterValue(int value, EnumOperandType type) { this.value = value; this.type = type; }