我试图将命令行中的参数与'+'进行比较.如果它相等,它应该添加: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
Run Code Online (Sandbox Code Playgroud)
mov esi,[eax+12] //third argument
mov eax,esi
cmp eax,'+'
Run Code Online (Sandbox Code Playgroud)
你在这里做的是将一个字符(通常是一个字节)与作为第三个参数的字符串的32位地址进行比较.这显然不会匹配.
适当的比较是:
mov esi,[eax+12] //third argument
cmp byte [esi],'+' ; compare the first character of the third argument with '+'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
116 次 |
| 最近记录: |