The best way I know to swap W and a file takes 3 instructions, but no termporary locations: xorwf file,F xorwf file,W xorwf file,F (work it out, it does swap em!) I don't think you'll find much improvement possible on your MOVF/MOVWF buffer shift routine (if speed is the issue). Bob Ammerman RAm Systems ----- Original Message ----- From: "Edson Brusque" To: Sent: Wednesday, February 13, 2002 4:51 PM Subject: [PIC]: SWAPWF ??? > Hello, > > I think I'm doing an stupid question, but there's a way to swap the > contents of W and a file on a single instruction? > > I want to shift the values inside a buffer and I know I can do: > > MOVF buf1,W > MOVWF buf0 // buf0 = buf1 > MOVF buf2,W > MOVWF buf1 // buf1 = buf2 > MOVF buf3,W > MOVWF buf2 // buf2 = buf3 > MOVF buf4,W > MOVWF buf3 // buf3 = buf4 > CLRF buf4 // buf4 = 0 > > But I was thinking if it's possible to make such a thing like: > > MOVLW 0; > swapwf buf4; // w=buf4 buf4=0 > swapwf buf3; // w=buf3 buf3=buf4 > swapwf buf2; // w=buf2 buf2=buf3 > swapwf buf1; // w=buf1 buf1=buf2 > swapwf buf0; // w=buf0 buf0=buf1 > > I know that the PIC have no instruction like SWAPWF, but... > > Best regards, > > Brusque > > ----------------------------------- > Edson Brusque > Research and Development > C.I.Tronics Lighting Designers Ltda > Blumenau - SC - Brazil > www.citronics.com.br > Say NO to HTML mail > ----------------------------------- > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.