Using a PIC18F and writing in assembly, I have a group of outputs sprinkled among several ports to turn on LEDs and the like. The idea is I have a group of registers, where I keep track of what device is being enabled. Only one output on at a time, per each register. For example: LeftSide is a register, bits [4:0] where only one bit is active at any given time. RightSide is similar. But, the 5 bits that are to be driven are perhaps in PortA, PortB and PortD... basically to make the board layout easier because afterall...each bit in each port is controlled via LAT opcode... bsf LATA,0 or mask a shadow register and just movff shadow,LATA...either case it works, and is running slow. So the question is, I was going to use movff LeftSide,scratch and then do a RRNCF and just look at the MSB of the scratch, keeping track of how many times I rotated. So that would tell me what bit of the LeftSide is active and then I can turn on the appropriate bit in the LAT register. Well short of doing a compare on all values of the count for several registers, I was looking for a method that I could almost do a 'cat' of the data. In other words, the format of the output bits are all similar SIDExOUTy where I would like x and y to be numeric variables and so I could call one routine to generate the output for each of the four sides. Remember this is in assembly. Any thoughts? I may be slow on seeing responses and answering as I will be traveling for the next several days. --------------------------------- Do you Yahoo!? Get on board. You're invited to try the new Yahoo! Mail. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist