Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. extern printf
  2. extern fflush
  3. extern scanf
  4.  
  5. section .data
  6. fmt db "%d %d %d %d", 0
  7. fmtPrint1 db "A", 10, 0
  8. fmtPrint2 db "B", 10, 0
  9. fmtPrint3 db "C", 10, 0
  10. fmtPrint4 db "D", 10, 0
  11. fmtPrint5 db "E", 10, 0
  12.  
  13. section .bss
  14. a resd 1
  15. b resd 1
  16. c resd 1
  17. d resd 1
  18.  
  19. section .text
  20. global main
  21.  
  22. main:
  23.  
  24. ;input
  25. push a
  26. push b
  27. push c
  28. push d
  29. push fmt
  30. call scanf
  31. add esp, 20
  32.  
  33. ;penjumlahan
  34. mov eax, [a]
  35. add eax, [b]
  36. add eax, [c]
  37. add eax, [d]
  38. mov edx, 0
  39. mov ecx, 4
  40. div ecx
  41.  
  42. cmp eax, 80
  43. jae satu
  44.  
  45. cmp eax, 60
  46. jae dua
  47.  
  48. cmp eax, 50
  49. jae tiga
  50.  
  51. cmp eax, 40
  52. jae empat
  53.  
  54. cmp eax, 0
  55. jae lima
  56.  
  57. satu:
  58. push eax
  59. push fmtPrint1
  60. call printf
  61. add esp, 8
  62. push 0
  63. call fflush
  64. jmp exit
  65.  
  66. dua:
  67. push eax
  68. push fmtPrint2
  69. call printf
  70. add esp, 8
  71. push 0
  72. call fflush
  73. jmp exit
  74.  
  75. tiga:
  76. push eax
  77. push fmtPrint3
  78. call printf
  79. add esp, 8
  80. push 0
  81. call fflush
  82. jmp exit
  83.  
  84. empat:
  85. push eax
  86. push fmtPrint4
  87. call printf
  88. add esp, 8
  89. push 0
  90. call fflush
  91. jmp exit
  92.  
  93. lima:
  94. push eax
  95. push fmtPrint5
  96. call printf
  97. add esp, 8
  98. push 0
  99. call fflush
  100. jmp exit
  101.  
  102. exit:
  103. mov eax, 1
  104. mov ebx, 0
  105. int 0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement