gpt4 book ai didi

assembly - 比较 '+' 符号程序集 x86

转载 作者:行者123 更新时间:2023-12-04 02:30:11 26 4
gpt4 key购买 nike

我正在尝试将命令行中的参数与“+”进行比较。如果相等就应该去添加:label。我得到三个参数,2 个数字和符号,我想对其进行比较。不幸的是,它的比较不起作用。

我的代码:

main:
mov eax,[esp+8]
mov ecx,[eax+4] //first argument
mov ebx,[eax+8] //second argument
mov esi,[eax+12] //third argument
mov eax,esi
cmp eax,'+'
je add
jmp end

add:
//rest of code

最佳答案

mov esi,[eax+12] //third argument
mov eax,esi
cmp eax,'+'

您在这里所做的是将字符(通常是单个字节)与作为第三个参数的字符串的 32 位地址进行比较。这显然不匹配。

适当的比较是:

mov esi,[eax+12] //third argument
cmp byte [esi],'+' ; compare the first character of the third argument with '+'

关于assembly - 比较 '+' 符号程序集 x86,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34716817/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com