Skip to content

Instantly share code, notes, and snippets.

@raminfp
Forked from sanjibnarzary/loop.asm
Created January 8, 2017 00:34
Show Gist options
  • Save raminfp/218b0c35f6ec90e40a289ef56fbf8e26 to your computer and use it in GitHub Desktop.
Save raminfp/218b0c35f6ec90e40a289ef56fbf8e26 to your computer and use it in GitHub Desktop.
Lets count 10 to 0 in Assembly Language (Assenbly Language program to loop 10 times)
;Author : Sanjib Narzary
;Institute: NIT Calicut
;Email: o-._.-o@live.com
;Assembly Code
section .text
global main
extern printf
main:
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
ret
message db "Value = %d",10,0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment