Start with a value at 0. Loop while value mod 6 is not equal to 0.
Each time through the loop, add 1 to the value then print it.
The loop must execute at least once.



Related tasks

   Loop over multiple arrays simultaneously
   Loops/Break
   Loops/Continue
   Loops/Do-while
   Loops/Downward for
   Loops/For
   Loops/For with a specified step
   Loops/Foreach
   Loops/Increment loop index within loop body
   Loops/Infinite
   Loops/N plus one half
   Loops/Nested
   Loops/While
   Loops/with multiple ranges
   Loops/Wrong ranges


Reference

 Do while loop Wikipedia.


 
extern _printf
 
section .data
    output db 0,0
 
section .text
global _main
_main:
    mov bl, 0
    looping:
        add bl, 0x31 ;0x30 to 0x39 is 0 to 9 in ASCII
        mov [output], bl
        sub bl, 0x30
        push output
        call _printf
        add esp, 4
        xor eax, eax
        xor edx, edx
        mov al, bl
        mov ecx, 6
        div ecx ; remainder is saved in edx
        cmp edx, 0
        jne looping ; if n & 6 != 0 do looping again
    xor eax, eax
    ret
 