虽然循环中的增量程序集只打印一次,但无法弄清楚为什么(nasm)

While loop in assembly with increment only prints once, can't figure out why(nasm)

我已经尝试了各种 <, <= 退出命令,但它只会打印一次消息。试图让它在每次迭代时打印。我打开了很多选项卡并尝试了很多,但无法弄清楚这个。

    mov rax,0
    mov rbx,6
WhileLoop: 
    Cmp rax,rbx         ;loop termination condition (rax<6)
    jge WhileDone       ;if !<6, exit while loop
    mov rdi, message2   ;print message
    mov al, 0           ;print message
    call printf         ;print message
    inc rax             ;rax=rax+1
    jmp WhileLoop       ;next iteration 
WhileDone:

过程 "printf" 可能正在修改 raxrbx。所以,让我们在 "printf" 之前保留它们,并在 "printf" 之后恢复它们:

    mov rax,0
    mov rbx,6
WhileLoop: 
    Cmp rax,rbx         ;loop termination condition (rax<6)
    jge WhileDone       ;if !<6, exit while loop
    PUSH RAX
    PUSH RBX
    mov rdi, message2   ;print message
    mov al, 0           ;print message
    call printf         ;print message
    POP  RBX
    POP  RAX
    inc rax             ;rax=rax+1
    jmp WhileLoop       ;next iteration 
WhileDone: