PageRenderTime 16ms CodeModel.GetById 7ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/source2/Users/Gero Landmann/Cosmos.Assembler.X86/OpCodeBuilder.cs

https://bitbucket.org/mvptracker/cosmos
C# | 150 lines | 100 code | 25 blank | 25 comment | 3 complexity | bcf761ff226eaeeabaeed834b54dd14b MD5 | raw file
  1using System;
  2using System.Collections.Generic;
  3using System.Linq;
  4using System.Text;
  5using System.Net;
  6using System.Reflection;
  7using System.IO;
  8using System.Xml;
  9using System.Xml.Linq;
 10using System.Xml.XPath;
 11using Cosmos.Assembler.X86;
 12
 13namespace Cosmos.Assembler.X86.Generator
 14{
 15
 16    public class OpCodeBuilder
 17    {
 18        [STAThread]
 19        static void Main( string[] args )
 20        {
 21
 22        }
 23
 24
 25        public Operand[] GetOperands(int OpCount, ulong[] aData )
 26        { 
 27            Operand[] ops = new Operand[OpCount];
 28            Operand op;
 29            int x = 0;
 30            bool OpFinish = false;
 31            for( int i = 0; i < OpCount; i++ )
 32            {
 33                ops[ i ] = new Operand();
 34                op = ops[ i ];
 35                for(; x < aData.Length; x++ )
 36                {
 37                    switch( aData[ x ] )
 38                    {
 39                        case OpCodeData.MEMORY:
 40                            break;
 41                        case OpCodeData.REG8:
 42                            break;
 43                        case OpCodeData.REG16:
 44                            break;
 45                        case OpCodeData.REG32:
 46                            break;
 47                        case OpCodeData.REG64:
 48                            break;
 49                        case OpCodeData.FPUREG:
 50                            break;
 51                        case OpCodeData.XMMREG:
 52                            break;
 53                        case OpCodeData.YMMREG:
 54                            break;
 55                        case OpCodeData.IMMEDIATE:
 56                            break;
 57                        case OpCodeData.BITS8:
 58                            break;
 59                        case OpCodeData.BITS16:
 60                            break;
 61                        case OpCodeData.BITS32:
 62                            break;
 63                        case OpCodeData.BITS64:
 64                            break;
 65                        case OpCodeData.BITS80:
 66                            break;
 67                        case OpCodeData.BITS128:
 68                            break;
 69                        case OpCodeData.BITS256:
 70                            break;
 71
 72                        
 73
 74                    }
 75
 76                    if( OpFinish )
 77                        break;
 78                }
 79            }
 80
 81            return ops;
 82        }
 83
 84        public string GetInstructionVariant( OpCodeData.itemplate node )
 85        {
 86            string code = "";
 87            code += "new InstructionVariant()" + Environment.NewLine;
 88            code += "{" + Environment.NewLine;
 89            
 90
 91
 92            code += "    " + Environment.NewLine;
 93            code += "}" + Environment.NewLine;
 94
 95            return code;
 96        }
 97
 98        public string GetInstruction( )
 99        {
100            string code = "";
101            code += "public void {0} : Instruction" + Environment.NewLine;
102            code += "{" + Environment.NewLine;
103            code += "    public {0}()" + Environment.NewLine;
104            code += "    {" + Environment.NewLine;
105            code += "        Mnemonic = \"{0}\"" + Environment.NewLine;
106            code += "    }" + Environment.NewLine;
107            code += Environment.NewLine;
108            code += "    public override bool Initialize()" + Environment.NewLine;
109            code += "    {" + Environment.NewLine;
110
111            code += "       Variants = new List<InstructionVariant>()" + Environment.NewLine;
112
113
114            code += "    }" + Environment.NewLine;
115            code += "}" + Environment.NewLine;
116
117            return code;        
118        }
119
120
121        /*
122            using System;
123            using System.Collections.Generic;
124            using System.Linq;
125            using System.Text;
126
127            namespace Cosmos.Assembler.X86
128            {
129            
130                [OpCode("dec")]
131                public class Dec : InstructionWithDestinationAndSize 
132                {
133                      aData.EncodingOptions.Add(new InstructionData.InstructionEncodingOption 
134                      {
135                            OpCode = new byte[] { 0xFE },
136                            NeedsModRMByte = true,
137                            InitialModRMByteValue = 0xC8,
138                            OperandSizeByte = 0,
139                            ReverseRegisters=true,
140                            DestinationRegAny = true
141                      }); // reg
142                }
143	        }
144
145         */
146
147
148    }
149}
150