Beispiel #1
0
 public CompiledByte(OpCode op, Value a, Value b)
 {
     ushort[] output = compile(op,a,b);
     for (int i = 0; i < output.Length; i++)
     {
         ;
     }
 }
Beispiel #2
0
        ushort[] compile(OpCode op, Value a, Value b)
        {
            ushort result = 0;
            result |= op.binary;
            bool litA = false;
            bool litB = false;
            if (a.binary < 0x20)
            {
                result |= (ushort)(a.binary << 4);
            }
            else
            {
                result |= (ushort)Values.RD_LITERAL << 4;
                litA = true;
            }
            if (b.binary < 0x20)
            {
                result |= (ushort)(b.binary << 10);
            }
            else
            {
                result |= (ushort)Values.RD_LITERAL << 10;
                litB = true;
            }
            ushort[] output = new ushort[1 + (litA ? 1 : 0) + (litB ? 1 : 0)];
            output[0] = result;
            if (litA)
            {
                output[1] = a.binary;
            } else if (!litA && litB)
            {
                output[1] = b.binary;
            }
            else if (litA && litB)
            {
                output[2] = b.binary;
            }

            return output;
        }