Exemple #1
0
 string IRunningInstruction.ToString()
 {
     return(Address.ToString().PadRight(5) +
            Operation.ToString() + "." + Modifier.ToString().PadRight(3) +
            ModeHelper.ToString(ModeA) + ValueA.ToString().PadLeft(6) + ", " +
            ModeHelper.ToString(ModeB) + ValueB.ToString().PadLeft(6) + "     ");
 }
        public override string GetLine(ParserOptions options, bool start)
        {
            StringBuilder sb = new StringBuilder();

            if (options.Offset)
            {
                sb.Append(Address.ToString("00 "));
            }

            if (options.Labels)
            {
                if (Label != null)
                {
                    sb.Append(Label.PadRight(13));
                }
                else
                {
                    sb.Append("             ");
                }
            }
            else
            {
                if (start)
                {
                    sb.Append("START  ");
                }
                else
                {
                    sb.Append("       ");
                }
            }

            //operation and modifier
            sb.Append(Operation);
            sb.Append(".");
            sb.Append(Modifier.ToString().PadRight(3));

            //A
            sb.Append(ModeHelper.ToString(ModeA));
            if (options.Expressions)
            {
                if (ExpressionA != null)
                {
                    sb.Append(ExpressionA.PadLeft(12));
                }
                else
                {
                    sb.Append(ValueA.ToString().PadLeft(12));
                }
            }
            else
            {
                sb.Append(ValueA.ToString().PadLeft(6));
            }

            //B
            sb.Append(", ");
            sb.Append(ModeHelper.ToString(ModeB));
            if (options.Expressions)
            {
                if (ExpressionB != null)
                {
                    sb.Append(ExpressionB.PadLeft(12));
                }
                else
                {
                    sb.Append(ValueB.ToString().PadLeft(12));
                }
            }
            else
            {
                sb.Append(ValueB.ToString().PadLeft(6));
            }

            //comment
            if (options.Comments && Comment != null && Comment.Length > 0)
            {
                int c = 35;
                if (options.Labels)
                {
                    c += 6;
                }
                if (options.Expressions)
                {
                    c += 19;
                }
                if (sb.Length < c)
                {
                    sb.Append(' ', c);
                }
                sb.Append(";");
                sb.Append(Comment);
            }
            return(sb.ToString());
        }
Exemple #3
0
 public override string ToString()
 {
     return
         (Operation + "." + Modifier.ToString().PadRight(3) + ModeHelper.ToString(ModeA) +
          ValueA.ToString().PadLeft(6) + ", " + ModeHelper.ToString(ModeB) + ValueB.ToString().PadLeft(6));
 }
 public override string ToString() => ValueA?.ToString() + ":" + ValueB?.ToString();