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

标签 assembly x86

我正在尝试将命令行中的参数与“+”进行比较。如果相等就应该去添加: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/

相关文章:

assembly - 从哪里开始学习汇编 - IDE、示例

assembly - 不延迟汇编的循环会使我的电脑崩溃吗?

c++ - 使用英特尔PIN修改寄存器

assembly - 将换行符输出到文件时出现问题

assembly - SIMD minmag 和 maxmag

assembly , Hello World 问题

windows - 在运行 Windows XP 的 Intel x86 机器上,内存位置 1 是什么?

汇编:xadd 指令需要锁吗?

c++ - bool返回值的函数,只设置整个寄存器的1个字节

c++ - 使用基于堆的数据调用将堆栈对象作为参数的函数