Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. SECTION .data
  2. messaggio db "Inserire un numero intero",10,0
  3. fmt db "%s",0
  4. fmtd db "%d %d",0
  5. fmtmol db "Moltiplicazione = %d",10,0
  6. fmtdiv db "Divisione intera = %d resto: %d",10,0
  7.  
  8.  
  9. a dd 0
  10. b dd 0
  11. ris dd 0
  12. resto dd 0
  13.  
  14. SECTION .txt
  15. global main
  16. extern printf
  17. extend scanf
  18.  
  19.  
  20. main: push ebp //memorizzano lo stato dello stack
  21. mov ebp,esp
  22.  
  23. push messaggio
  24. push fmt
  25. call scanf
  26.  
  27. push a
  28. push b
  29. push fmtd
  30. call scanf
  31.  
  32. mov eax,[a]
  33. mov ebx,[b]
  34.  
  35. mul ebx
  36. mov [ris],eax
  37.  
  38. push dword[ris]
  39. push fmtmol
  40. call printf
  41.  
  42. mov eax,[a]
  43. mov ebx,[b]
  44. mov edx,0
  45.  
  46. div ebx
  47. mov [ris],eax
  48. mov [resto],edx
  49.  
  50. push dword[resto]
  51. push dword[ris]
  52. push fmtdiv
  53. call printf
  54.  
  55. mov esp,ebp
  56. pop ebp
  57. ret
  58.  
  59. mov esp,ebp
  60. pop ebp
  61. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement