问题
Memory Segment Below.
On the first add instruction (add eax, 3), it moves the pointer for eax 3 spots to the right.
Thus, EAX = 12, 17, A3, 00. (This I understand)
But, on the second add instruction (add ebx, 5), it actually adds the value 5 to ebx,
making EBX = 12, 17, A3, 05.
Why is that?
(Little Endian)
回答1:
'add reg, (something)' adds that value to the register, period. The difference you are seeing is how you are using the registers.
As you are doing 'mov ebx,[eax]' you are using the value in eax as a pointer, because you are de-referencing it with the square brackets.
来源:https://stackoverflow.com/questions/42887105/x86-assembly-memory-what-does-the-add-instruction-do