just x86 assembly question~~!!

Posted by kevin on Stack Overflow See other posts from Stack Overflow or by kevin
Published on 2010-05-03T12:10:36Z Indexed on 2010/05/03 12:18 UTC
Read the original article Hit count: 166

Filed under:
|
|

this is my assembly program which is just a function to swap *x *y. so first argument from main is address of x which is in 8(%ebp) and second one is address of y is in 12(%ebp). the program does swap x and y. I need 7 lines for doing this. can you make it 6 lines and there is a condition you can use only %eax,%ecx, and %edx 3 registers. I think about it so much.. but.. I can't make it 6 lines...there must be a way.. isn't it? this might be not a big deal.. but if there is a way to get it in 6lines. I want to know.. if you know the way~ help me~ plz~ thank you and have a good and nice day~

movl 8(%ebp), %eax

movl (%eax), %ecx

 movl 12(%ebp), %edx

 movl (%edx), %eax

 movl %ecx, (%edx)

 movl 8(%ebp), %ecx

 movl    %eax, (%ecx)

© Stack Overflow or respective owner

Related posts about x86

Related posts about assembly