Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. section .bss
  2. a resb 1
  3.  
  4. section .data
  5. nwln db 10
  6.  
  7. section .text
  8. global _start
  9. _start:
  10. ;; Initialise a=0
  11. mov [a], byte 0
  12.  
  13. ;; loop 20 times
  14. mov ecx,20
  15. L:
  16. mov eax,20
  17. sub eax,ecx
  18. cmp eax, 10
  19. jl INCREMENT
  20. dec byte [a]
  21. loop L
  22.  
  23. ;; a+48 + echo a
  24. ETTER:
  25. mov al,[a]
  26. add al,'0'
  27. mov [a],al
  28. mov ecx,a
  29. mov edx,1
  30. call echo
  31.  
  32. call exit
  33.  
  34. INCREMENT:
  35. inc byte [a]
  36. loop L
  37. jmp ETTER
  38.  
  39. echo:
  40. mov ebx,1
  41. mov eax,4
  42. int 0x80
  43. mov ecx,nwln
  44. mov edx,2
  45. mov ebx,1
  46. mov eax,4
  47. int 0x80
  48. ret
  49.  
  50. exit:
  51. mov eax,1
  52. int 0x80
  53. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement