Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly x86汇编-masm32:指令操作数无效_Assembly_X86_Masm - Fatal编程技术网

Assembly x86汇编-masm32:指令操作数无效

Assembly x86汇编-masm32:指令操作数无效,assembly,x86,masm,Assembly,X86,Masm,我试图使一个密码文件,你输入密码,它显示你所有的密码。我当前的代码如下,但有一个错误: .386 .model flat,stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\masm32.inc includelib \masm32\lib\kernel32.lib inc

我试图使一个密码文件,你输入密码,它显示你所有的密码。我当前的代码如下,但有一个错误:

.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\masm32.inc
includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\masm32.lib

.data
        input   db 'Enter the password:',13,10,0
        string  db 'The passwords are:',0
        space db '       ',0
        pass1 db 'example password 1',0
        pass2 db 'example password 2',0
        pass3 db 'example password 3',0
        pass4 db 'example password 4',0
        ermsg db 'Incorrect Password. Exiting....',0
        count dd 0
            comp dd 13243546

.data?
        buffer db 100 dup(?)
.code
start:
_top:
        invoke StdOut,ADDR input
        invoke StdIn,ADDR buffer,100 ; receive text input
        cmp buffer, comp ;sorry for not pointing this out - this is line 32
        jz _next
        jmp _error
_next:
        invoke StdOut, ADDR string
        invoke StdOut, ADDR space
        invoke StdOut, ADDR pass1
        invoke StdOut, ADDR pass2
        invoke StdOut, ADDR pass3
        invoke StdOut, ADDR pass4
        invoke ExitProcess,0
_error:
        invoke StdOut, ADDR ermsg
        mov eax, 1
            mov count, eax
            cmp count, 3
            jz _exit
            jmp _top:
_exit:
            invoke ExitProcess, 0
这就是错误:

 test.asm(32) : error a2070: invalid instruction operands

为什么会这样。我知道错误在第32行,但我不知道错误是什么。

cmp
用于。因此,您基本上要求它将
buffer
的前四个字节与
comp
的四个字节进行比较,并使用无效语法执行此操作

要比较字符串,需要使用或手动循环


此外,
comp
应声明为
comp db'13243546',0
。您声明它的方式现在使它变成了一个dword
00CA149A
,它相当于C字符串
“\x9A\x14\xCA”
-键入起来相当复杂:)

cmp缓冲区,comp
-您想在这里做什么?@Soohjun-我编辑了这篇文章以显示行32@DCoder-我试图将缓冲区与comp进行比较,换句话说,比较缓冲区和13243546(这将是查看程序中存储的其他密码所需的密码)啊,我明白了。。。。因此,当我从“缓冲区”获取输入时,它是字符串格式的。所以我需要将'comp'声明为字符串,以使其匹配。非常感谢。