Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Re: [AVR-Chat] Re: Challenge

Re: [AVR-Chat] Re: Challenge

2005-06-09 by stevech@san.rr.com

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/
>!
>

Re: [AVR-Chat] Re: Challenge

2005-06-09 by Zack Widup

Yes but can you do it without the push and pop?  The original suggestion 
was to do it without the use of any other registers or places to store it.

I figured it had to do with some Boolean operations but didn't sit long 
enough to figure out which ones.

Zack (W9SZ)
Show quoted textHide quoted text
On Thu, 9 Jun 2005 stevech@san.rr.com wrote:

> 
> and to swap two registers: and ye ole:
> 
> push r1
> 
> mov r1,r2   ; r1 = r2
> 
> pop r2
> 
> more cycles than eor's
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.