Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. extern printf
  2. extern get_max
  3.  
  4. section .data
  5. arr: dd 19, 7, 129, 87, 54, 218, 67, 12, 19, 99
  6. len: equ $-arr
  7. pos: dd 0
  8. max: dd 0
  9.  
  10.  
  11. print_format: db "max: %u pos: %u", 13, 10, 0
  12.  
  13. section .text
  14.  
  15. global main
  16.  
  17. main:
  18.  
  19. push ebp
  20. mov ebp, esp
  21.  
  22. ; Compute length in eax.
  23. ; Divide by 4 (we are using integer data type of 4 bytes) by
  24. ; using shr 2 (shift right with 2 bits).
  25. mov eax, len
  26. shr eax, 2
  27.  
  28. push pos
  29. push eax
  30. push arr
  31. call get_max
  32. add esp, 12
  33. mov dword[max],eax
  34.  
  35. ; Print max.
  36. push dword[pos]
  37. push dword[max]
  38. push print_format
  39. call printf
  40. add esp, 12
  41.  
  42. leave
  43. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement