Assembly Language program to count 10 tuimes

section .text
global main
extern printf
mov ebx,10 ;number 10 to ebx
loop: push ebx ;first parameter
push message ;second parameter
call printf ;call inbuilt printf statement for outputting
dec ebx ;decrement the value of ebx by 1
jnz loop ;if not equal to zero go to loop
add esp,80 ;clear all the stack
message db “Value = %d”,10,0
To run this program
$ nasm -f elf loop.asm
$gcc -m32 -o loop loop.o
//for this you need to have a gcc multilib just install by typing #sudo apt-get install gcc-multilib
Value = 10
Value = 9
Value = 8
Value = 7
Value = 6
Value = 5
Value = 4
Value = 3
Value = 2
Value = 1
You are finished. Now your task is to print 0 to 10;