Help for this page

Select Code to Download


  1. or download this
        mov r1,0     // sometimes, xor r1,r1 needs less program space and/
    +or time
        mov r2,N
    ...
        inc r1       // may or may not set flags, depending on the impleme
    +ntation
        cmp r1,r2    // often imlemented as sub r1,r2 but without actually
    + writing the result back to the register, just setting flags
        jne loop     // if implemented as sub r1,r2, jne (jump if not rqua
    +l) is equal to jnz (jump if not zero)
    
  2. or download this
        xor r1,r1
    loop:
    ...
        inc r1  
        cmp r1,N
        jne loop
    
  3. or download this
        mov r1,N
    loop:
        // do something with r1
        dec r1     // must set/clear zero flag depending on value of r1
        jnz loop