dword ptr usage confusion

吃可爱长大的小学妹 提交于 2019-11-30 01:53:55

In both cases you ask the processor to move the value from a specified address. It's one level of indirection. In the first case you ask it to take the address from a specified register. In the second case you specify an offset directly.

x86 processors don't support dual level indirection, so it's not possible to request to load a value from an address specified somewhere in memory - you have to load the address onto a register.

Under a number of assemblers (MASM and built into VC++ assembler for example) you could as well write just

mov eax, dword ptr some_variable

without brackets, it would mean the same.

You could write

move eax, dword ptr [variable][ebx]

this would instruct to take the address of "variable", then add value of ebx and use the sum as an address from which to load a value. This is often used for accessing array elements by index.

In all these cases the processor would do the same - load a value from a specified address. It's one level of indirection each time.

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