Skip to content

Instantly share code, notes, and snippets.

@sanjibnarzary
Created January 11, 2012 06:59
Show Gist options
  • Save sanjibnarzary/1593466 to your computer and use it in GitHub Desktop.
Save sanjibnarzary/1593466 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: [email protected]
;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
@toto112358
Copy link

Too much comments...
However, these are useful for beginners, but it impacts readibility a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment