Exemplo n.º 1
0
        public static string GetCode(params object[] code)
        {
            string asmcode = "";

            for (int i = 0; i < code.Length; i++)
            {
                if (!(code[i] is ASM))
                {
                    if (!(code[i] is int))
                    {
                        if (!(code[i] is REG))
                        {
                            if (!(code[i] is MEM))
                            {
                                if (!(code[i] is string))
                                {
                                    if (!(code[i] is Label))
                                    {
                                        if (!(code[i] is RawAssemblyCode))
                                        {
                                            throw new ArrayTypeMismatchException("Not supported type");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                var cnt = InstructionPattern.CheckPattern(code, i);
                if (cnt < 0)
                {
                    throw new FormatException("Format error");
                }
                asmcode += $"{FromInline(code.Skip(i).Take(cnt + 1).ToArray())}\n";
                i       += cnt;
            }

            return(asmcode);
        }