At 21:46 -0700 on 08/03/2013, Duffy Nightingale wrote about Concatanate Bits Instruction?:
Hi All, Working on a project that requires me to build a long bit string in storage - initialized to binary 0¹s. Have a need to keep concatenating bits to this string as the process continues. The len of the bit strings to add are 4, 7, 10 and possibly others. I came up with the idea of lining up on the 4 byte boundary of where I want to add. Then get the bits I want to add in the r.h. side of a register with the bits on l.h. side set to 0¹s. Then OR to the left most 4 byte boundary. I know this will work but wondering if anyone out there could come up with a more straight forward elegant way to do this? Unfortunately I cannot use the latest and greatest instructions Thanks much, Duffy Nightingale
What you are describing is not concatenation - It is altering bits in the string. As you concatenate you need to increase the string length and add the new bits to the end. You start out with the first bits and add the next bits to the end of it increasing the length by the number of bits you added. Start out with a 4 byte long string of 0s in a even numbered register and add the next string to the odd numbered register in that pair (with the new bits in the high end). Now shift left double logical for the length of the added string. Keep doing this until the next shift would have moved the string more than 32 bits. Save the even register to memory and bump the save point 3 bytes and the string length by 24 bits. Now zero the register and load the 4th saved byte into the low end of the even register. Load the next string extension into the high end of the odd register and shift left double logical (as usual). Keep doing this. When you are done you will have the last bits of the string in the low section of the even register. Shift left single logical enough bits to position the high end on a byte boundary and save it to memory. Move the correct number of high bytes to the string area and bump the string length. If you are having problems understanding this explanation, I can post a flow showing it working.
