Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. section .data
  2.  
  3. .global a
  4. .global b
  5. .global c
  6. .global d
  7. .global res
  8.  
  9. .section .text
  10. .global operation
  11.  
  12. operation:
  13.  
  14. # prologue
  15. pushl %ebp # save previous stack frame pointer
  16. movl %esp, %ebp # the stack frame pointer for sum function
  17.  
  18. #operation
  19. movl $0, %ebx
  20.  
  21. movb a, %al
  22. movw b, %bx
  23. movl c, %ecx
  24. movl d, %edx
  25.  
  26. addw %ax, %bx
  27. subl %ecx, %ebx
  28. movl %ebx,%eax
  29. addl %edx, %eax
  30.  
  31. movl $0, %edx
  32. movl %eax, res # copy the result to res
  33.  
  34.  
  35. # epilogue
  36. movl %ebp, %esp # restore the previous stack pointer ("clear" the stack)
  37. popl %ebp # restore the previous stack frame pointer
  38.  
  39. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement