x86 Assembly Memory - What does the “add” instruction do?

Deadly 提交于 2019-12-12 13:01:42

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!