fork(3) download
  1. ;Числа фибоначчи.
  2. global _start
  3.  
  4.  
  5. section .text
  6.  
  7. section .data
  8. n DW 0
  9. buff dw 0h
  10. scale EQU 10
  11. _start:
  12. mov ax,0ah
  13. xor edi,edi
  14. mov edx,buff
  15. int 80h
  16. mov dx,0ah
  17. mov ax,02
  18. int 80h
  19. xor eax,eax
  20. mov ebx,scale
  21.  
  22. _MakeNum:
  23. mov cx,si
  24. cmp cx,0dh
  25. jz FibCalc
  26. sub cx,'0'
  27. mul ebx
  28. add eax,ecx
  29. inc esi
  30. jmp _MakeNum
  31.  
  32. FibCalc:
  33. mov [n], eax
  34. xor eax,eax
  35. mov edx,1
  36. mov ecx,n
  37. sum:
  38. add eax,edx
  39. loop sum
  40. xor ecx, ecx
  41. mov ebx, scale
  42.  
  43. AddStackNum:
  44. xor edx,edx
  45. div ebx
  46. push edx
  47. inc ecx
  48. test eax, eax
  49. jnz AddStackNum
  50. mov ax, 02h
  51.  
  52. PrintSymb:
  53. pop edx
  54. add dx, '0'
  55. int 80h
  56. loop PrintSymb
  57. exit:
  58. mov eax, 01h ; exit()
  59. xor ebx, ebx ; errno
  60. int 80h
Success #stdin #stdout 0.2s 152KB
stdin
20
stdout
Standard output is empty