1

According to this hex to instruction chart, it mentions that E9 maps to the jump instruction, and the DE instruction maps to the add instruction. But, it also mentions that DEE9 maps to the "subtract and pop" instruction.

So, when the processor loads and tries decoding the binary for DEE9..., how would it know whether to execute 2 single byte instructions or 1 two byte instruction? There are likely many more combinations of ambiguous strings of instructions, but this is the first example that I found. Thanks!

declspecl
  • 11
  • 3
  • 2
    `fsubp` is `DE E9`, not `E9 DE`. The instruction is distinguished from `fadd` and `faddp` according to what the modr/m byte following the opcode byte holds. This can be seen in columns `o`, `op1`, and `op2` of the chart. – fuz Apr 25 '23 at 17:16
  • @fuz sorry about that! I mixed them up in my head and just updated the post. Thanks for pointing it out – declspecl Apr 25 '23 at 17:28
  • @fuz What specifically are `o`, `op1`, and `op2` referring to? And not every byte has a byte after it to denote its ending, so what do you mean by "following the opcode byte"? Are there any resources you know of that explain the precise details on this topic? Thanks! – declspecl Apr 25 '23 at 17:34
  • `o` refers to the register field in the modr/m byte. If it is empty, there is no modr/m byte. If it is `r`, the modr/m byte encodes an operand. If it is a number, the modr/m byte is an opcode extension that must hold this value (in the reg field) to encode the given instruction. `op1` and `op2` are the operands; for x87 instructions, memory and register addressing modes may encode distinct instructions. – fuz Apr 25 '23 at 17:51
  • 1
    Since it seems this is just a mis-reading of the table and the correct interpretation has been reached in the comments I have voted to close as "caused by a typo". – Tom V Apr 25 '23 at 17:54

0 Answers0