Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. ;Bai 2: Tinh tong tu 1 den n.
  2.  
  3. %include "io.inc"
  4. extern _printf
  5. extern _getch
  6. section .data
  7. tb1 db "Tinh tong tu 1 den n.",10,0
  8. tb2 db "Nhap n: ",0
  9. fmt db "%d",0
  10. fmt1 db "S = %d",0
  11.  
  12. section .bss
  13. a resd 1
  14. b resd 1
  15. c resd 1
  16.  
  17. section .text
  18. global CMAIN
  19. CMAIN:
  20. ;xuat tb1
  21. push tb1
  22. call _printf
  23. add esp,4
  24.  
  25. ;nhap n
  26. push a
  27. push fmt
  28. call _scanf
  29. add esp,8
  30.  
  31. ;goi ham
  32. je TinhTong
  33.  
  34. ;Lay ket qua
  35. mov ebx,[b]
  36.  
  37. ;xuat ket qua
  38. push dword [b]
  39. push fmt1
  40. call _printf
  41. add esp,8
  42.  
  43. ;Ket thuc
  44. call _getch
  45. xor eax,eax
  46. ret
  47.  
  48. TinhTong:
  49. xor
  50. mov eax,[a]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement