Esempio n. 1
0
        private int DisassembleConstant(string name, GearsChunk chunk, int offset, EGearsOpCode constantType, Action <string> writeLine)
        {
            int constantIndex = (chunk.ReadCode(ref offset) << 8) + chunk.ReadCode(ref offset);

            switch (constantType)
            {
            case OP_LOAD_CONSTANT: {
                GearsValue value = chunk.ReadConstantValue(constantIndex);
                writeLine($"{name} const[{constantIndex}] ({value})");
            }
            break;

            case OP_LOAD_STRING: {
                string value = chunk.Strings.ReadStringConstant(constantIndex);
                writeLine($"{name} string[{constantIndex}] ({value})");
            }
            break;

            case OP_LOAD_FUNCTION: {
                string value = chunk.ReadConstantValueAsBitStr(constantIndex);
                writeLine($"{name} bitstr[{constantIndex}] ({value})");
            }
            break;
            }
            return(offset);
        }
Esempio n. 2
0
        private int DisassembleInvoke(string name, GearsChunk chunk, int offset, Action <string> writeLine)
        {
            int    args      = chunk.ReadCode(ref offset);
            int    nameIndex = (chunk.ReadCode(ref offset) << 8) + chunk.ReadCode(ref offset);
            string value     = chunk.ReadConstantValueAsBitStr(nameIndex);

            writeLine($"{name} const[{nameIndex}] ({value})");
            return(offset);
        }