If Duffy could give an example of the data and expected results, it would
clarify what he wants. Are the bit strings being added, merged or concatenated?
Are the fields left or right justified. I assume merging right justified bit
strings but like I said this is just a guess. As someone mentioned before, you
could use the EX instruction coded as follows::
DEST DC XL30 destination field
LH R15,fieldlen Length of field to merge bits
LA R14,DEST+L'DEST Past end of destination field
SR R14,R15 Position in destination field
BCTR R15,0 Length relative to 0
EX R15,OC Execute the OC instruction
OC OC 0(0,R14),field Merge the bits into the destination field
If you were concatenating, then use the MVC instruction and just add each
length to R14 after the move to point to the next field and forget about the SR.
Jon Perryman
>________________________________
> From: Robert A. Rosenberg <[email protected]>
>
>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.