字节码转操作码

Opcodes List

ID Hex Name Description Length
0 0x00 NOP No operation 1 byte
1 0x01 IADD Adds the top 2 items on the stack 1 byte
2 0x02 ISUB Subtracts the top 2 items on the stack 1 byte
3 0x03 IMUL Multiplies the top 2 items on the stack 1 byte
4 0x04 IDIV Divides the top 2 items on the stack 1 byte
5 0x05 IMOD Mods the top 2 items on the stack 1 byte
6 0x06 INOT Checks the first item on the stack to see if it equals 0 1 byte
7 0x07 INEG Reverses the sign on the item on the top of the stack 1 byte
8 0x08 IEQ Compares the top 2 integers on the stack to see if they are equal 1 byte
9 0x09 INE Compares the top 2 integers on the stack to see if they are not equal 1 byte
10 0x0A IGT Compares the top 2 integers on the stack to see if the first one is greater than the second one 1 byte
11 0x0B IGE Compares the top 2 integers on the stack to see if the first one is greater than or equal to the second one 1 byte
12 0x0C ILT Compares the top 2 integers on the stack to see if the first one is less than the second one 1 byte
13 0x0D ILE Compares the top 2 integers on the stack to see if the first one is less than or equal to the second one 1 byte
14 0x0E FADD Adds the top 2 floats on the stack 1 byte
15 0x0F FSUB Subtracts the top 2 floats on the stack 1 byte
16 0x10 FMUL Multiplies the top 2 floats on the stack 1 byte
17 0x11 FDIV Divides the top 2 floats on the stack 1 byte
18 0x12 FMOD Mods the top 2 floats on the stack 1 byte
19 0x13 FNEG Reverses the sign on the first float on the stack 1 byte
20 0x14 FEQ Compares the top 2 floats on the stack to see if they are equal 1 byte
21 0x15 FNE Compares the top 2 floats on the stack to see if they are not equal 1 byte
22 0x16 FGT Compares the top 2 floats on the stack to see if the first one is greater than the second one 1 byte
23 0x17 FGE Compares the top 2 floats on the stack to see if the first one is greater than or equal to the second one 1 byte
24 0x18 FLT Compares the top 2 floats on the stack to see if the first one is less than the second one 1 byte
25 0x19 FLE Compares the top 2 floats on the stack to see if the first one is less than or equal to the second one 1 byte
26 0x1A VADD Adds the top 2 Vectors on the stack 1 byte
27 0x1B VSUB Subtracts the top 2 Vectors on the stack 1 byte
28 0x1C VMUL Multiplies the top 2 Vectors on the stack 1 byte
29 0x1D VDIV Divides the top 2 Vectors on the stack 1 byte
30 0x1E VNEG Reverses the sign on the first vector on the stack 1 byte
31 0x1F IAND Performs an And operation to the first 2 integers on the stack 1 byte
32 0x20 IOR Performs an Or operation to the first 2 integers on the stack 1 byte
33 0x21 IXOR Performs a Xor operation to the first 2 integers on the stack 1 byte
34 0x22 I2F Converts the top integer on the stack to a float, and puts that float on the stack 1 byte
35 0x23 F2I Converts the top float on the stack to an integer, and puts that integer on the stack 1 byte
36 0x24 F2V Converts the top float into a Vector containing 3 instances of the same float, and pushes the pointer to that Vector onto the top of the stack 1 byte
37 0x25 PUSH_CONST_U8 Pushes a byte onto the stack, the byte is defined as the next byte after the opcode 2 bytes
38 0x26 PUSH_CONST_U8_U8 Pushes 2 bytes onto the stack, the bytes are the next 2 bytes after the opcode 3 bytes
39 0x27 PUSH_CONST_U8_U8_U8 Pushes 3 bytes onto the stack, the bytes are the next 3 bytes after the opcode 4 bytes
40 0x28 PUSH_CONST_U32 Pushes an int onto the stack, the integer is defined in the next 4 bytes after the opcode 5 bytes
41 0x29 PUSH_CONST_F Pushes a float onto the stack, the float is defined in the next 4 bytes after the opcode 5 bytes
42 0x2A DUP Duplicates the first item on the stack, and pushes it back onto the stack 1 byte
43 0x2B DROP Pops the top item off the stack 1 byte
44 0x2C NATIVE Calls a native function. The number of arguments for the native to take is defined in the first 6 bits of the next byte after the opcode(0-63). The number of returns is stored in the following 2 bits(0-3). The hash of the native functions is stored in the native table at the index specified by the following 2 bytes(expressed as an unsigned short) 4 bytes
45 0x2D ENTER Indicates the beginning of an internal function. The byte after the opcode indicates the amount of arguments the function takes off the stack, and the next 2 bytes after that indicate the number of variables the function will have to generate on the stack. The following byte indicates how many bytes to skip past after the opcode(usually so a name can be appended to the function definition) 5 bytes + value of 5th byte
46 0x2E LEAVE Indicates the end of an internal function. The byte after the opcode indicates the amount of arguments that will have to be popped off the stack, and the next byte after that indicates the stack number of the return address 3 bytes
47 0x2F LOAD Pops a pointer off the stack and pushes the value stored in that pointer back onto the stack 1 byte
48 0x30 STORE Pops 2 items off the stack and stores the second item at the location of the first item (the first item being a pointer) 1 byte
49 0x31 STORE_REV Pops the first item off the stack and peeks at the second item on the stack, then stores the first item at the location pointed to by the second item on the stack 1 byte
50 0x32 LOAD_N Pops 2 items off the stack, the first being the number of items, second being the memory address. It then pushes that many items to the stack from the memory address 1 byte
51 0x33 STORE_N Pops 2 items off the stack, the first being the number of items, second being the memory address. It then pops that many items from the stack to the memory address 1 byte
52 0x34 ARRAY_U8 Pops 2 items off the stack, the first being an array index, second being the pointer to an array. It then pushes the pointer to theindex in the array to the top of the stack. The size each item in the array is determined by the byte following the opcode 2 bytes
53 0x35 ARRAY_U8_LOAD Pops 2 items off the stack, the first being an array index, second being the pointer to an array. It then pushes the item at the array index to the top of the stack. The size each item in the array is determined by the byte following the opcode 2 bytes
54 0x36 ARRAY_U8_STORE Pops 3 items off the stack, the first being the value to set, second being an array index and last being the pointer to an array. It the sets the value at the index in the array to first value. The size each item in the array is determined by the byte following the opcode 2 bytes
55 0x37 LOCAL_U8 Pushes the pointer to the frame variable at the index specified by the byte following the opcode 2 bytes
56 0x38 LOCAL_U8_LOAD Pushes the value of the frame variable at the index specified by the byte following the opcode 2 bytes
57 0x39 LOCAL_U8_STORE Pops an item off the stack, then sets the frame variable at the index specified by the byte following the opcode to the item 2 bytes
58 0x3A STATIC_U8 Pushes the pointer to the static variable at the index specified by the byte following the opcode 2 bytes
59 0x3B STATIC_U8_LOAD Pushes the value of the static variable at the index specified by the byte following the opcode 2 bytes
60 0x3C STATIC_U8_STORE Pops an item off the stack, then sets the static variable at the index specified by the byte following the opcode to the item 2 bytes
61 0x3D IADD_U8 Adds the byte directly after the opcode to the integer value at the top of the stack, then pushes the new value to the top of the stack 2 bytes
62 0x3E IMUL_U8 Multiplies the byte directly after the opcode to the integer value at the top of the stack, then pushes the new value to the top of the stack 2 bytes
63 0x3F IOFFSET Pops an index and a pointer to a struct off the stack, pushes the pointer to the item at 8 times the index in the struct 1 byte
64 0x40 IOFFSET_U8 Pops an pointer to a struct off the stack, pushes the pointer to the item at the index specified by 8 times the byte following the opcode 2 bytes
65 0x41 IOFFSET_U8_LOAD Pops an pointer to a struct off the stack, pushes the value of the item at the index specified by 8 times the byte following the opcode 2 bytes
66 0x42 IOFFSET_U8_STORE Pops an value and a pointer to a struct off the stack, sets the item at the index specified by 8 times the byte following the opcode to the value popped of the stack 2 bytes
67 0x43 PUSH_CONST_S16 Pushes a signed short to the stack, the value is the 2 bytes following the opcode 3 bytes
68 0x44 IADD_S16 Adds the short directly after the opcode to the integer value at the top of the stack, then pushes the new value to the top of the stack 3 bytes
69 0x45 IMUL_S16 Multiplies the short directly after the opcode to the integer value at the top of the stack, then pushes the new value to the top of the stack 3 bytes
70 0x46 IOFFSET_S16 Pops an pointer to a struct off the stack, pushes the pointer to the item at the index specified by 8 times the 2 bytes following the opcode 3 bytes
71 0x47 IOFFSET_S16_LOAD Pops an pointer to a struct off the stack, pushes the value of the item at the index specified by 8 times the 2 bytes following the opcode 3 bytes
72 0x48 IOFFSET_S16_STORE Pops an value and a pointer to a struct off the stack, sets the item at the index specified by 8 times the 2 bytes following the opcode to the value popped of the stack 3 bytes
73 0x49 ARRAY_U16 Pops 2 items off the stack, the first being an array index, second being the pointer to an array. It then pushes the pointer to theindex in the array to the top of the stack. The size each item in the array is determined by the 2 bytes following the opcode 3 bytes
74 0x4A ARRAY_U16_LOAD Pops 2 items off the stack, the first being an array index, second being the pointer to an array. It then pushes the item at the array index to the top of the stack. The size each item in the array is determined by the 2 bytes following the opcode 3 bytes
75 0x4B ARRAY_U16_STORE Pops 3 items off the stack, the first being the value to set, second being an array index and last being the pointer to an array. It the sets the value at the index in the array to first value. The size each item in the array is determined by the 2 bytes following the opcode 3 bytes
76 0x4C LOCAL_U16 Pushes the pointer to the frame variable at the index specified by the 2 bytes following the opcode 3 bytes
77 0x4D LOCAL_U16_LOAD Pushes the value of the frame variable at the index specified by the 2 bytes following the opcode 3 bytes
78 0x4E LOCAL_U16_STORE Pops an item off the stack, then sets the frame variable at the index specified by the 2 bytes following the opcode to the item 3 bytes
79 0x4F STATIC_U16 Pushes the pointer to the static variable at the index specified by the 2 bytes following the opcode 3 bytes
80 0x50 STATIC_U16_LOAD Pushes the value of the static variable at the index specified by the 2 bytes following the opcode 3 bytes
81 0x51 STATIC_U16_STORE Pops an item off the stack, then sets the static variable at the index specified by the 2 bytes following the opcode to the item 3 bytes
82 0x52 GLOBAL_U16 Pushes the pointer to the global variable at the index specified by the 2 bytes following the opcode 3 bytes
83 0x53 GLOBAL_U16_LOAD Pushes the value of the global variable at the index specified by the 2 bytes following the opcode 3 bytes
84 0x54 GLOBAL_U16_STORE Pops an item off the stack, then sets the global variable at the index specified by the 2 bytes following the opcode to the item 3 bytes
85 0x55 J Performs a relative jump to a new location in the code, the relative offset is the signed short following the opcode 3 bytes
86 0x56 JZ Performs a relative jump to a new location in the code if the item at the top of the stack is zero, the relative offset is the signed short following the opcode 3 bytes
87 0x57 IEQ_JZ Pops 2 items off the stack, Performs an integer comparison on them and performs a relative jump to a new location in the code if the first is not equal to the second. The relative offset is the signed short following the opcode 3 bytes
88 0x58 INE_JZ Pops 2 items off the stack, Performs an integer comparison on them and performs a relative jump to a new location in the code if the first is equal to the second. The relative offset is the signed short following the opcode 3 bytes
89 0x59 IGT_JZ Pops 2 items off the stack, Performs an integer comparison on them and performs a relative jump to a new location in the code if the first is less than or equal to the second. The relative offset is the signed short following the opcode 3 bytes
90 0x5A IGE_JZ Pops 2 items off the stack, Performs an integer comparison on them and performs a relative jump to a new location in the code if the first is less than the second. The relative offset is the signed short following the opcode 3 bytes
91 0x5B ILT_JZ Pops 2 items off the stack, Performs an integer comparison on them and performs a relative jump to a new location in the code if the first is greater than or equal to the second. The relative offset is the signed short following the opcode 3 bytes
92 0x5C ILE_JZ Pops 2 items off the stack, Performs an integer comparison on them and performs a relative jump to a new location in the code if the first is greater than the second. The relative offset is the signed short following the opcode 3 bytes
93 0x5D CALL Calls a function within the script, and puts the return address on top of the stack. The location of the function is defined in the next 3 bytes after the opcode 4 bytes
94 0x5E LOCAL_U24 Pushes the pointer to the frame variable at the index specified by the 3 bytes following the opcode 4 bytes
95 0x5F LOCAL_U24_LOAD Pushes the value of the frame variable at the index specified by the 3 bytes following the opcode 4 bytes
96 0x60 LOCAL_U24_STORE Pops an item off the stack, then sets the frame variable at the index specified by the 3 bytes following the opcode to the item 4 bytes
97 0x61 GLOBAL_U24 Pushes the pointer to the global variable at the index specified by the 3 bytes following the opcode 4 bytes
98 0x62 GLOBAL_U24_LOAD Pushes the value of the global variable at the index specified by the 3 bytes following the opcode 4 bytes
99 0x63 GLOBAL_U24_STORE Pops an item off the stack, then sets the global variable at the index specified by the 3 bytes following the opcode to the item 4 bytes
100 0x64 PUSH_CONST_U24 Pushes an unsigned 24 bit integer to the stack, the value is the 3 bytes following the opcode 4 bytes
101 0x65 SWITCH Pops the item to compare off the stack, and then jumps to location corresponding to that item. After the opcode byte it contains a byte defining the number of possible entries, and after that the number of possible entries times 6 are taken up with repeating instances of 4 bytes of the index identifier, and 2 bytes of the relative jump offset to jump to if that index is correct (note jump offset is unsigned unlike branch instructions) (Byte after opcode * 6) + 2 bytes
102 0x66 STRING Pops an integer off the stack, then returns the pointer to the string stored at that index in the String Table 1 byte
103 0x67 STRINGHASH Pops the pointer to a string off the stack. The computes a jenkins-one-at-a-time hash on the string and pushes the result to the stack 1 byte
104 0x68 TEXT_LABEL_ASSIGN_STRING Pops a pointer to a destination buffer and a string, copies the string to the destination buffer. The size of the buffer is specified in the byte following the opcode 2 bytes
105 0x69 TEXT_LABEL_ASSIGN_INT Pops a pointer to a destination buffer and a integer, converts the integer to a string and stores it in the destination buffer. The size of the buffer is specified in the byte following the opcode 2 bytes
106 0x6A TEXT_LABEL_APPEND_STRING Pops a pointer to a destination buffer and a string, appends the string to the string in the destination buffer. The size of the buffer is specified in the byte following the opcode 2 bytes
107 0x6B TEXT_LABEL_APPEND_INT Pops a pointer to a destination buffer and a integer, converts the integer to a string and appends it to the string in the destination buffer. The size of the buffer is specified in the byte following the opcode 2 bytes
108 0x6C TEXT_LABEL_COPY Pops 3 items off the stack. Copies the third item's memory into the first item's memory with repeating defined by the second item. It then appends a null terminator to the first item's memory 1 byte
109 0x6D CATCH Sets up a safe area that has the ability to catch errors - not used in release builds of GTA 1 byte
110 0x6E THROW Indicates an area that handles a script error relative to the catch opcode - not used in release builds of GTA 1 byte
111 0x6F CALLINDIRECT Calls a function within the script, and puts the return address on top of the stack. The location of the function is defined in the integer at the top of the stack 1 byte
112 0x70 PUSH_CONST_M1 Pushes the integer -1 to the top of the stack 1 byte
113 0x71 PUSH_CONST_0 Pushes the integer 0 to the top of the stack 1 byte
114 0x72 PUSH_CONST_1 Pushes the integer 1 to the top of the stack 1 byte
115 0x73 PUSH_CONST_2 Pushes the integer 2 to the top of the stack 1 byte
116 0x74 PUSH_CONST_3 Pushes the integer 3 to the top of the stack 1 byte
117 0x75 PUSH_CONST_4 Pushes the integer 4 to the top of the stack 1 byte
118 0x76 PUSH_CONST_5 Pushes the integer 5 to the top of the stack 1 byte
119 0x77 PUSH_CONST_6 Pushes the integer 6 to the top of the stack 1 byte
120 0x78 PUSH_CONST_7 Pushes the integer 7 to the top of the stack 1 byte
121 0x79 PUSH_CONST_FM1 Pushes the float -1.0 to the top of the stack 1 byte
122 0x7A PUSH_CONST_F0 Pushes the float 0.0 to the top of the stack 1 byte
123 0x7B PUSH_CONST_F1 Pushes the float 1.0 to the top of the stack 1 byte
124 0x7C PUSH_CONST_F2 Pushes the float 2.0 to the top of the stack 1 byte
125 0x7D PUSH_CONST_F3 Pushes the float 3.0 to the top of the stack 1 byte
126 0x7E PUSH_CONST_F4 Pushes the float 4.0 to the top of the stack 1 byte
127 0x7F PUSH_CONST_F5 Pushes the float 5.0 to the top of the stack 1 byte
128 0x80 PUSH_CONST_F6 Pushes the float 6.0 to the top of the stack 1 byte
129 0x81 PUSH_CONST_F7 Pushes the float 7.0 to the top of the stack 1 byte
130 0x82 IS_BIT_SET Pops the value and the bit to test from the stack and pushes the result of value & (1 << bit). Replaced the IS_BIT_SET native 1 byte