OK, sometimes we have luck, others not. But if the code is not very known, this is the chance for others to learn it. Best regards, Isaac Em 20/1/2012 17:10, Bob Ammerman escreveu: > Sorry, been there and done that. > > -- Bob Ammerman > > ----- Original Message -----=20 > From: "Isaac Marino Bavaresco" > To: "Microcontroller discussion list - Public." > Sent: Friday, January 20, 2012 11:48 AM > Subject: [PIC] New(?) way for rotating a variable number of positions=20 > inassembly > > >> I was needing an (very) efficient way to rotate a byte a variable number >> of positions when the following popped on my mind: >> >> >> btfsc TABLAT, 2, ACCESS >> swapf PRODL, F, ACCESS >> btfsc TABLAT, 1, ACCESS >> rrncf PRODL, F, ACCESS >> btfsc TABLAT, 1, ACCESS >> rrncf PRODL, F, ACCESS >> btfsc TABLAT, 0, ACCESS >> rrncf PRODL, F, ACCESS >> >> >> The number of positions to rotate is in TABLAT and the value to be >> rotated is in PRODL. >> The routine can rotate from zero to 7 positions, takes only 8 >> instructions and as a bonus it is isochronous. >> >> Did somebody already know it or can I boast that I invented it? >> >> >> Isaac >> >> --=20 >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist=20 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .