开发者

What's the difference between normal opcodes and opcodes with their MSB set?

开发者 https://www.devze.com 2023-03-22 08:33 出处:网络
What\'s the difference between normal opcodes and opcodes with their MSB (Most Significant Bit) set? Example:

What's the difference between normal opcodes and opcodes with their MSB (Most Significant Bit) set?

Example:

0036  5E000001           [4] return     1   2
003A  1E008000           [5] return     0   1

The first opcode (0x5E/1011110) has its MSB s开发者_如何学Goet and the second opcode (0x1E/0011110) hasn't.

Edit: Corrected 'byte' to 'bit', duh.


After some googling, I found a header of the Lua source (lopcodes.h) explaining the instruction format a bit better.

It looks like it's wrong to read the opcode as a byte, it should be read as 6 bits:

All instructions have an opcode in the first 6 bits.
Instructions can have the following fields:
`A' : 8 bits
`B' : 9 bits
`C' : 9 bits
`Bx' : 18 bits (`B' and `C' together)
`sBx' : signed Bx
0

精彩评论

暂无评论...
验证码 换一张
取 消