Exemplo n.º 1
0
        private void ProcessOperations()
        {
            foreach (MethodInfo method in (typeof(CPU)).GetMethods())
            {
                foreach (var attribute in method.GetCustomAttributes(typeof(CPUFunction), true))
                {
                    CPUFunction function = attribute as CPUFunction;
                    Delegate    methodDelegate;

                    try
                    {
                        switch (method.GetParameters().Length)
                        {
                        case 0:
                            methodDelegate = Delegate.CreateDelegate(typeof(CPUCallbackNoargs), this, method);
                            break;

                        case 1:
                            methodDelegate = Delegate.CreateDelegate(typeof(CPUCallback1args), this, method);
                            break;

                        case 2:
                            methodDelegate = Delegate.CreateDelegate(typeof(CPUCallback2args), this, method);
                            break;

                        case 3:
                            methodDelegate = Delegate.CreateDelegate(typeof(CPUCallback3args), this, method);
                            break;

                        case 4:
                            methodDelegate = Delegate.CreateDelegate(typeof(CPUCallback4args), this, method);
                            break;

                        default:
                            throw new Exception("Method signature not supported");
                        }
                    }
                    catch (Exception)
                    {
                        throw new Exception("Method signature not supported");
                    }

                    for (int i = 0; i < function.Count; i++)
                    {
                        disasm.AddOperation((uint)(function.OpCode + i), methodDelegate, method.GetParameters().Length);
                    }
                }
            }
        }
Exemplo n.º 2
0
 public Instruct(string fnName, Operand destination = null, Operand source = null)
 {
     Function    = CUal.GetFunction(fnName);
     Destination = destination;
     Source      = source;
 }
Exemplo n.º 3
0
 public Instruct(byte hashFn, Operand destination = null, Operand source = null)
 {
     Function    = CUal.GetFunction(hashFn);
     Destination = destination;
     Source      = source;
 }
Exemplo n.º 4
0
 protected Instruct(byte hashFn)
 {
     Function = CUal.GetFunction(hashFn);
 }
Exemplo n.º 5
0
 protected Instruct(string fnName)
 {
     Function = CUal.GetFunction(fnName);
 }