在 Intel 汇编中条件为 true 时循环
section .data
    msg db 'Hello, world!', 0xA
    len equ $ - msg
section .text
global _main
_main:
    mov rax, 0 ; This will be the current number
    mov rcx, 10 ; This will be the last number
    
_loop:
    cmp rax, rcx
    jl .loopbody ; Jump to .loopbody if rax < rcx
    jge _exit ; Jump to _exit if rax ≥ rcx
.loopbody:
    push rax ; Store the rax value for later use
    mov rax, 0x2000004 ; 4 for Linux
    mov rdi, 1 ; STDOUT
    mov rsi, msg
    mov rdx, len
    syscall
    pop rax ; Take it back to rax
    inc rax ; Add 1 to rax. This is required since the loop must have an ending.    
    jmp _loop ; Back to loop
_exit:
    ret    ; Return
只要 rax < rcx,这将执行 .loopbody。