示例#1
0
 /// <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;
 }
示例#2
0
 /// <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;
 }
示例#3
0
 public Operand(string labelName, EnumOperandType type)
 {
     isRegister     = false;
     register       = null;
     value          = 0;
     this.type      = type;
     this.labelName = labelName;
 }
示例#4
0
        /// <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
            }
        }
示例#5
0
 /// <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;
 }
示例#6
0
 /// <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;
 }
示例#7
0
 /// <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;
 }
示例#8
0
 public virtual void SetRegisterValue(string value, EnumOperandType type)
 {
     throw new NotSupportedException();
 }
示例#9
0
 /// <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;
 }