Assembly jne不跳吗?(汇编x86 NASM)

Assembly jne不跳吗?(汇编x86 NASM),assembly,x86,nasm,cmp,Assembly,X86,Nasm,Cmp,出于某种原因,我这里的cmp语句总是导致je到DoubleScore,而从不jne到regularcore函数。我对组装相当陌生,所以这可能是一个简单的错误 Approved: mov eax,[prev] mov edi, dword[buffermaze+eax] mov eax,edi call

出于某种原因,我这里的cmp语句总是导致
je
DoubleScore
,而从不
jne
regularcore
函数。我对组装相当陌生,所以这可能是一个简单的错误

  Approved:
                        mov eax,[prev]
                        mov edi,  dword[buffermaze+eax]
                        mov eax,edi
                        call print_nl
                        call print_int
                        mov eax, 45
                        call print_nl
                        call print_int

                        cmp eax,edi
                        je DoubleScore
                        dump_regs 1
                        jne RegularScore
                        dump_regs 2

                                DoubleScore:
                                        mov ebx,0
                                        ret
                                RegularScore:

                                        mov edx, 0
                                        mov eax,[new]

                                            ret


The Output for this part of the code is 
774778411
45
Register Dump # 1
EAX = 0000002D EBX = F7704FF4 ECX = 00000000 EDX = 00000000
ESI = 0804A434 EDI = 2E2E2E2B EBP = FFF2D4E8 ESP = FFF2D4C4
EIP = 080487B0 FLAGS = 0283       SF          CF

我想这是因为代码片段

 call print_nl 
 call print_int
这两个函数可能对寄存器eax和edi起作用。你试过调试代码吗

编辑:
jne RegularScore
指的是DumpRegs2,而不是
cmp eax、edi

我认为应该是这样的:

                cmp eax,edi
                je DoubleScore
                dump_regs 1
                ;here we will handle the regularScore


                                mov edx, 0
                                mov eax,[new]

                                    ret


                        DoubleScore:
                                mov ebx,0
                                ret
这会起作用吗

    cmp eax,edi
    je DoubleScore // if equal jmps to DoubleScore and jmps back to passedNotEqual
    jmp RegularScore // if je fails, jmps to RegularScore and returns normal
passedNotEqual:

        DoubleScore:
                mov ebx,0
                dump_regs 1
                jmp passedNotEqual

        RegularScore:

                mov edx, 0
                mov eax,[new]
                dump_regs 2
                ret

我测试了它,删除了代码片段。这些值保持不变。我真的一点也不知道,他们显然是不平等的,那么到底为什么它会认为他们是平等的呢?@user3043234老实说,这是唯一的选择。您是否尝试过删除4条通话线路而不仅仅是2条?@user3043234我认为问题出在其他地方。您的另一条跳转指令
jne regularcore
引用的是DumpRegs2,而不是
cmp eax,edi
删除转储regs没有任何效果,它只输出所有寄存器及其值,我尝试删除它,但什么都没有发生。我有相当多的其他代码在这个程序中,但没有我知道应该干扰。我还有很多其他的跳跃动作,它们都很好。即使我明目张胆地把1放在edi中,把5放在eax中,并对它们进行比较,它仍然会相等地跳转是的,但我的意思是删除
jne RegularScore
部分,因为程序中的顺序是首先比较2个寄存器(它设置标志),然后跳转(它在跳转后也设置标志)-然后应该有一部分代码用于处理regularscore,而不是跳转。显示print\u nl+print\u int的代码