and to swap two registers: and ye ole:
push r1
mov r1,r2�� ; r1 = r2
pop r2
more cycles than eor's
�
----- Original Message -----
From: Andreas Stemmer Date: Thursday, June 9, 2005 11:28 am Subject: Re: [AVR-Chat] Re: Challenge > > How do you swap the contents of 2 registers without using any other> > registers or
> > stack?
>
> How about this one?
>
> A = A + B
> B = A - B
> A = A - B
>
> but I don't know how to do the second step in assembler...
>
> Another solution:
>
> eor r1, r2
> eor r1, r2
> eor r1, r2
>
> should work... but I can't prove it
>
> Andreas
> --
> Andreas Stemmer
>
>
>
>
> Yahoo! Groups Links
>
> <*> To visit your group on the web, go to:
> http://groups.yahoo.com/group/AVR-Chat/
>
> <*> To unsubscribe from this group, send an email to:
> AVR-Chat-unsubscribe@yahoogroups.com
>
> <*> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>!
>