Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. extern printf
  2. extern fflush
  3. extern scanf
  4.  
  5. section .data
  6. fmt db "%d", 0
  7. fmtPrint db "%d", 10, 0
  8.  
  9. num0 dd 0
  10. num1 dd 1
  11.  
  12. section .bss
  13. num resd 1
  14. temp resd 1
  15.  
  16. section .text
  17. global main
  18.  
  19. main:
  20. push num
  21. push fmt
  22. call scanf
  23. add esp, 8
  24.  
  25. mov dword[temp], 0
  26. mov dword[temp + 4], 1
  27.  
  28. mov esi, 2
  29.  
  30. looping:
  31. mov ecx, esi
  32. dec ecx
  33. mov eax, [temp + 4*ecx]
  34. dec ecx
  35. add eax, [temp + 4*ecx]
  36.  
  37. mov dword[temp + 4*esi], eax
  38.  
  39. inc esi
  40. cmp esi, [num]
  41. jbe looping
  42.  
  43. mov edi, [num]
  44. mov eax, [temp + 4*edi]
  45.  
  46. ; printf
  47. push eax
  48. push fmtPrint
  49. call printf
  50. add esp, 8
  51.  
  52. exit:
  53. push 0
  54. call fflush
  55.  
  56. mov eax, 1
  57. mov ebx, 0
  58. int 0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement