Esempio n. 1
0
        public static string GetDestinationAsString(this IInstructionWithDestination aThis)
        {
            string xDest = string.Empty;

            if ((aThis.DestinationValue.HasValue || aThis.DestinationRef != null) &&
                aThis.DestinationIsIndirect &&
                aThis.DestinationReg != null && aThis.DestinationDisplacement > 0)
            {
                throw new Exception("[Scale*index+base] style addressing not supported at the moment");
            }
            if (aThis.DestinationRef != null)
            {
                xDest = aThis.DestinationRef.ToString();
            }
            else
            {
                if (aThis.DestinationReg != null)
                {
                    xDest = Registers.GetRegisterName(aThis.DestinationReg.Value);
                }
                else
                {
                    if (aThis.DestinationValue.HasValue)
                    {
                        xDest = "0x" + aThis.DestinationValue.GetValueOrDefault().ToString("X").ToUpperInvariant();
                    }
                }
            }
            if (aThis.DestinationDisplacement != 0)
            {
                if (aThis.DestinationDisplacement > 255)
                {
                    xDest += " + 0x" + aThis.DestinationDisplacement.ToString("X");
                }
                else
                {
                    xDest += (aThis.DestinationDisplacement < 0 ? " - " : " + ") + Math.Abs(aThis.DestinationDisplacement);
                }
            }
            if (aThis.DestinationIsIndirect)
            {
                return(String.Intern("[" + xDest + "]"));
            }
            else
            {
                return(String.Intern(xDest));
            }
        }
Esempio n. 2
0
 public static void DetermineSize(this IInstructionWithDestination aThis, IInstructionWithSize aThis2, byte aSize)
 {
     if (aSize == 0)
     {
         if (aThis.DestinationReg != null && !aThis.DestinationIsIndirect)
         {
             aThis2.Size = Registers.GetSize(aThis.DestinationReg.Value);
             return;
         }
         if (aThis.DestinationRef != null && !aThis.DestinationIsIndirect)
         {
             aThis2.Size = 32;
             return;
         }
     }
 }