Esempio n. 1
0
		public PopInstruction(int offset, Operand operand)
			: base(offset, operand)
		{
		}
Esempio n. 2
0
		/// <summary>
		/// Determines if a given operand is 8 bit compatible
		/// If both operands of a binary operation are 8 bit, then it is a 8 bit operation, otherwise it is a 16 bit operation
		/// </summary>
		/// <remarks>
		/// Operands of type sbyte are acounted for as 16 bit operands, as they will always be sign-extended to 16 bit
		/// </remarks>
		/// <param name="operand">The operand to test</param>
		/// <returns>Returns true if the operand is 8 bit compatible, false otherwise</returns>
		public static bool IsByteOperand(Operand operand)
		{
			return !operand.IsDirect || operand.ValueType == typeof(Register8) || operand.ValueType == typeof(byte);
		}
		public ArithmeticInstruction(int offset, ArithmeticOperation operation, Operand destination, Operand source)
			: base(offset, destination, source)
		{
			this.operation = operation;
		}
Esempio n. 4
0
		private static ushort GetOperandRawValue(SimulationContext context, Operand operand)
		{
			if (operand is Operand<Register8>)
				return context.GetRegister8(((Operand<Register8>)operand).Value);
			else if (operand is Operand<Register16>)
				return context.GetRegister16(((Operand<Register16>)operand).Value);
			else if (operand is Operand<byte>)
				return ((Operand<byte>)operand).Value;
			else if (operand is Operand<ushort>)
				return ((Operand<ushort>)operand).Value;
			else if (operand is Operand<sbyte>)
			{
				if (operand.IsDirect)
					return (ushort)(context.SP + ((Operand<sbyte>)operand).Value);
				else
					return (ushort)(short)((Operand<sbyte>)operand).Value;
			}
			else
				throw new InvalidOperationException();
		}
Esempio n. 5
0
		public UnaryInstruction(int offset, Operand operand)
			: base(offset)
		{
			this.operand = operand;
		}
Esempio n. 6
0
		public LoadInstruction(int offset, LoadOperationType operation, Operand destination, Operand source)
			: base(offset, destination, source)
		{
			this.operation = operation;
		}
Esempio n. 7
0
		public LoadInstruction(int offset, Operand destination, Operand source)
			: this(offset, LoadOperationType.Normal, destination, source)
		{
		}
Esempio n. 8
0
		public BinaryInstruction(int offset, Operand destination, Operand source)
			: base(offset)
		{
			this.destination = destination;
			this.source = source;
		}
Esempio n. 9
0
		public BitInstruction(int offset, BitOperation operation, Operand destination, Operand source)
			: base(offset, destination, source)
		{
			this.operation = operation;
		}