swap on assembly

Posted by lego69 on Stack Overflow See other posts from Stack Overflow or by lego69
Published on 2010-05-23T13:35:02Z Indexed on 2010/05/23 13:40 UTC
Read the original article Hit count: 325

Filed under:

I wrote swap on assembly, but I'm not sure that my code is right, this is the code

swap:  mov r1, -(sp)   

   mov (sp) r1
   mov 2(sp) (sp)
   mov r1 2(sp)

   mov (sp)+, r1
   rts pc

swap receives pointer from stack

© Stack Overflow or respective owner

Related posts about assembly