How to loop in assembly language

后端 未结 3 945
遥遥无期
遥遥无期 2021-02-11 08:39

How would I calculate the first 12 values in the Fibonacci number sequence and be able to place it in EAX reg. and display calling DumpRegs? Using Indirect addressing I know I n

3条回答
  •  失恋的感觉
    2021-02-11 09:04

    You can make a loop like this:

    mov ecx,12
    your_label:
    ; your code
    loop your_label
    

    The loop instruction decrements ecx and jumps to the specified label unless ecx is equal to zero. You could also construct the same loop like this:

    mov ecx,12
    your_label:
    ; your code
    dec ecx
    jnz your_label
    

提交回复
热议问题