Advertisement
Guest User

AK

a guest
May 19th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. section .data
  2.     msg db "0123456789"
  3.     lf db 0x0A           ; line feed
  4.  
  5. section .text
  6.     global _start
  7.  
  8. _start:
  9.     mov eax, 4747
  10.     mov ebx, 10
  11.     xor ecx, ecx        ; set ecx to 0
  12.     call loop_dec
  13.  
  14. loop_dec:
  15.     inc ecx
  16.     push edx
  17.     xor edx, edx        ; set edx to 0
  18.     div ebx
  19.     test eax, eax       ; test if eax is 0
  20.     jne loop_dec
  21.  
  22. print_dec:
  23.     dec ecx
  24.     push ecx
  25.     mov eax, 4
  26.     mov ebx, 1
  27.     mov ecx, msg
  28.     add ecx, edx
  29.     mov edx, 1
  30.     int 0x80
  31.     pop ecx
  32.     pop edx
  33.  
  34.     test ecx, ecx       ; test if ecx is 0
  35.     jne print_dec
  36.  
  37.     mov eax, 4
  38.     mov ebx, 1
  39.     mov ecx, lf
  40.     mov edx, 2
  41.     int 0x80
  42.  
  43.     mov eax, 1
  44.     mov ebx, 0
  45.     int 0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement