Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1.  
  2. msg db "Selectionner une operation",00h
  3. msg2 db "1 - Addition",00h
  4. msg3 db "2 - Soustraction",00h
  5. msg4 db "Entre un nombre : ",00h
  6. msg5 db "Ce nombre n'est pas dans le menu",00h
  7. format db "%d",0
  8. nl db 0AH,00h
  9. nbaddi db 1
  10.  
  11. segment .bss
  12.  
  13. nbmenu resd 1
  14. nb1 resd 1
  15. nb2 resd 1
  16. result resd 1
  17.  
  18. segment .text
  19.  
  20. global main
  21.  
  22. main:
  23.  
  24. xor eax,eax
  25.  
  26. push msg
  27. call printf
  28. add esp,4
  29.  
  30. push nl
  31. call printf
  32. add esp,4
  33.  
  34. push msg2
  35. call printf
  36. add esp,4
  37.  
  38. push nl
  39. call printf
  40. add esp,4
  41.  
  42. push msg3
  43. call printf
  44. add esp,4
  45.  
  46. push nl
  47. call printf
  48. add esp,4
  49.  
  50. push nbmenu
  51. push format
  52. call scanf
  53. add esp,8
  54.  
  55. push nbmenu
  56. call printf
  57. add esp,4
  58.  
  59. mov eax,[nbmenu]
  60. cmp eax, '1'
  61. je addition
  62. jmp inconnu
  63.  
  64. addition:
  65. push ebp
  66. mov ebp,esp
  67.  
  68. push msg4
  69. call printf
  70. add esp,4
  71.  
  72. push nl
  73. call printf
  74. add esp,4
  75.  
  76. push nb1
  77. push format
  78. call scanf
  79. add esp,8
  80.  
  81. push msg4
  82. call printf
  83. add esp,4
  84.  
  85. push nl
  86. call printf
  87. add esp,4
  88.  
  89. push nb2
  90. push format
  91. call scanf
  92. add esp,8
  93.  
  94. mov eax, nb1
  95. add eax, nb2
  96.  
  97. push eax
  98. call printf
  99. add esp,4
  100.  
  101. mov esp,ebp
  102. pop ebp
  103.  
  104. inconnu:
  105. push ebp
  106. mov ebp,esp
  107. push msg5
  108. call printf
  109. add esp,4
  110. mov esp,ebp
  111. pop ebp
  112.  
  113. push 0
  114. call exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement