Is this what you want ? movlw amount_to_shift movwf y shiftit rlf x, f decfsz y, f goto shiftit nextcode Bye. -----Original Message----- From: Scott Dattalo [mailto:scott@DATTALO.COM] Sent: Wednesday, 26 September 2001 16:01 To: PICLIST@MITVMA.MIT.EDU Subject: Challenge: Shifting by a variable amount In C: unsigned char x; unsigned char y; ... x <<= y; How would you do this in PIC assembly? This has been discussed here before (but I couldn't find it in the archives) and IIRC a 12 cycle solution was found (by Dmitry?). I've got a 12-cycle solution, but thought it would be interesting to propose this as a challenge. (The winner may simply find the answer in the archives :). Scott -- 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.