<<< Conditional Jumps, Cont     Index     Logical Instructions >>>

34. LOOP Instruction


  • Loop 50 times example:

        mov    ecx, 50
    repeat:
        ; loop body:
        ..
        loop   repeat
        ..
    
  • Equivalent to:

        mov    ecx, 50
    repeat:
        ; loop body:
        ..
        dec   ecx
        jnz   repeat
        ..
    
  • Surprisingly,

        dec   ecx
        jnz   repeat 
    
  • executes faster than

        loop  repeat
    

<<< Conditional Jumps, Cont     Index     Logical Instructions >>>