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

Language C# Lines 151
MD5 Hash c3c45bf35fcad4860e20243aa8ea7c4d Estimated Cost $2,408 (why?)
Repository https://bitbucket.org/mvptracker/cosmos.git View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Reflection;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using Cosmos.Assembler.X86;

namespace Cosmos.Assembler.X86.Generator
{

    public class OpCodeBuilder
    {
        [STAThread]
        static void Main( string[] args )
        {

        }


        public Operand[] GetOperands(int OpCount, ulong[] aData )
        { 
            Operand[] ops = new Operand[OpCount];
            Operand op;
            int x = 0;
            bool OpFinish = false;
            for( int i = 0; i < OpCount; i++ )
            {
                ops[ i ] = new Operand();
                op = ops[ i ];
                for(; x < aData.Length; x++ )
                {
                    switch( aData[ x ] )
                    {
                        case OpCodeData.MEMORY:
                            break;
                        case OpCodeData.REG8:
                            break;
                        case OpCodeData.REG16:
                            break;
                        case OpCodeData.REG32:
                            break;
                        case OpCodeData.REG64:
                            break;
                        case OpCodeData.FPUREG:
                            break;
                        case OpCodeData.XMMREG:
                            break;
                        case OpCodeData.YMMREG:
                            break;
                        case OpCodeData.IMMEDIATE:
                            break;
                        case OpCodeData.BITS8:
                            break;
                        case OpCodeData.BITS16:
                            break;
                        case OpCodeData.BITS32:
                            break;
                        case OpCodeData.BITS64:
                            break;
                        case OpCodeData.BITS80:
                            break;
                        case OpCodeData.BITS128:
                            break;
                        case OpCodeData.BITS256:
                            break;

                        

                    }

                    if( OpFinish )
                        break;
                }
            }

            return ops;
        }

        public string GetInstructionVariant( OpCodeData.itemplate node )
        {
            string code = "";
            code += "new InstructionVariant()" + Environment.NewLine;
            code += "{" + Environment.NewLine;
            


            code += "    " + Environment.NewLine;
            code += "}" + Environment.NewLine;

            return code;
        }

        public string GetInstruction( )
        {
            string code = "";
            code += "public void {0} : Instruction" + Environment.NewLine;
            code += "{" + Environment.NewLine;
            code += "    public {0}()" + Environment.NewLine;
            code += "    {" + Environment.NewLine;
            code += "        Mnemonic = \"{0}\"" + Environment.NewLine;
            code += "    }" + Environment.NewLine;
            code += Environment.NewLine;
            code += "    public override bool Initialize()" + Environment.NewLine;
            code += "    {" + Environment.NewLine;

            code += "       Variants = new List<InstructionVariant>()" + Environment.NewLine;


            code += "    }" + Environment.NewLine;
            code += "}" + Environment.NewLine;

            return code;        
        }


        /*
            using System;
            using System.Collections.Generic;
            using System.Linq;
            using System.Text;

            namespace Cosmos.Assembler.X86
            {
            
                [OpCode("dec")]
                public class Dec : InstructionWithDestinationAndSize 
                {
                      aData.EncodingOptions.Add(new InstructionData.InstructionEncodingOption 
                      {
                            OpCode = new byte[] { 0xFE },
                            NeedsModRMByte = true,
                            InitialModRMByteValue = 0xC8,
                            OperandSizeByte = 0,
                            ReverseRegisters=true,
                            DestinationRegAny = true
                      }); // reg
                }
	        }

         */


    }
}
Back to Top