在此代码块中,Sub的目的是什么?使用SUB的替代方法是什么?
.386
.MODEL FLAT, stdcall
.STACK 4096
ExitProcess PROTO, dwExitCode:DWORD
.data
arr1 DWORD 25, 89, 49, 80
arr2 DWORD 30, 100, 50, 150
.code
_main PROC
sub eax, eax
add eax, [arr1 + 0]
add eax, [arr1 + 4]
add eax, [arr1 + 8]
add eax, [arr1 + 12]
INVOKE ExitProcess, 0
_main ENDP
END
当我取出sub
添加数组中值的总和是错误的,但我不明白为什么。为了理解sub eax,eax
清除了寄存器,但我可能错了。我被告知使用movsx
而不是sub
,但不是MOVSX
仅在不同的数据类型大小之间使用时才使用?
.386
.MODEL FLAT, stdcall
.STACK 4096
ExitProcess PROTO, dwExitCode:DWORD
.data
arr1 DWORD 25, 89, 49, 80
arr2 DWORD 30, 100, 50, 150
.code
_main PROC
sub eax, eax
add eax, [arr1 + 0]
add eax, [arr1 + 4]
add eax, [arr1 + 8]
add eax, [arr1 + 12]
INVOKE ExitProcess, 0
_main ENDP
END
When I took out sub
the sum of adding the values in the array was wrong but I don't understand why. To my understanding sub eax, eax
clears the register but I could be wrong. I was told to use something like movsx
instead of sub
but isn't movsx
only used when going between different data type sizes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论