回到另一个组装问题。我很难看到方括号和汇编中的ptr有什么区别。
mov dword ptr eax, 1234 ; this should write 1234 to the memory address stored at eax right?
mov dword ptr [eax], 1234; this writes to the memory address that is stored at the memory address that is stored in eax?
mov [eax], 1234 ; this does the same as the first one right? it writes 1234 to the memory address that is stored in eax?
任何人都可以阐明这个话题吗?
dword PTR
只是后面的大小说明符。由于eax
的大小是已知的,因此dword PTR
在第一种情况下是多余的。
即,mov dword ptr eax, 1234
与仅写入mov eax, 1234
相同。
[mov dword ptr [eax], 1234
意味着在eax
给定的地址处的内存中的双字中写入1234。
mov [eax], 1234
模棱两可,甚至不应该汇编。汇编器无法知道您打算存储一个字还是一个双字。