Re: Concatanate Bits Instruction?
Hi All, Thanks much to everyone who responded for all the hints and tips. Someday I hope to be of use to someone on this thread! Andreas, I think you caught a mistake in my specs. It is small bit strings being added, concatenated, modified whatever you wish to call it. But the BIT strings are 4, 7, 10 BITS (Not bytes!) long. I took Mr. Rosenberg's shift register pair idea and coded it up. Essentially we are using R14 as a buffer and loading the buffer by putting the bits to insert in the left most bits of R15, then shift double logical left to load into the buffer (R14). Watching for R14 to fill up, saving to the end of the string, etc. Did not take a lot of code and am testing it now. It is amazing how much data you can store this way - when you use the least amount of bits to represent the data. Have a good day all, Duffy -Original Message- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of robin Sent: Tuesday, August 06, 2013 12:55 AM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: Concatanate Bits Instruction? Seems unduly and unnecessarily complicated to me. I'm a believer in the KISS principle. From: Andreas F. Geissbuehler afg0...@videotron.ca Sent: Tuesday, 6 August 2013 12:30 AM Duffy, Assuing you meant concatenate as in appending 57 bits to the end of a bitstring of say 395 bits which when done will have grown to 395+57=452 bits, and The len of the bit strings to add are 4, 7, 10 BYTES long you could do it WITHOUT register bit shifting loops using old fashion OS/360 instructions :) Here, the pseudo code to explain how: A DC XL16'00'work area A B DC XL16'00'work area B STR DC B'011011101011000111' source needs alignement 0..7 bits TBL DC 64AL1((*-TBL)*2) to do 1-bit shift-left' * ALIGN BITS TO BE ADDED/APPENDED: *2 regs are needed: *Rpaddr.pointer to right-most byte of target *Rnnumber of significant bits in that byte LTR R0,Rn JNPnoshift required MVO B,STRassume 4-bit shift N R0,=F'3' apply AND-mask JZ X needed 4-bit shift only UNPK A,STR makes space for bit shift MVZ A,=16X'00' clears hi-nibble T TR A,TBLrepeat this SHIFT-LEFT 0..2 times BCT R0,T MVO B,A aligns A for PACK MVO A,B aligns B for OC OC B,Adoubles up the shifted nibbles PACK A,B chop bitstring on new nibble boundary MVCB,Aassume we are done CHI Rn,4test bit count JNH *+10 fewer than 4 bits MVO B,A shift another 4 bits X OC 0(n,Rp).B append new bits to target bitstring LA Rp, ... update addr.ptr for next append AR Rn, ... prev.no. of signifant bit + newly appended N Rn,=F'7' = significant bits at Rp You need offset and length adjustments, e.g, MVO A+1(L'A-1),B to get extra work bits and keeps the packed decimal sign bits out of bitstring. An MVO by itself does a shift of 4-bits... Let's play Computer ! To make it easier for our eye we assign a symbolic name to each bit in STR above: | abcd | efgh | ijkl | mnop | qr__ | 18 bits in 5 nibbles After the initial UNKP and MVZ the bits are spaced out like this: abcdefghijklmnopqr__ The TR doubles the value of each nibble, eg. stays wheras 0011 - 0110 and - [0001]1110, thus: ___abcd.___efgh.___ijkl.___mnop.___qr.__ after 1st shift left __abcd..__efgh..__ijkl..__mnop..__qr..__ after 2dn TR A,TBL _abcd..._efgh..._ijkl..._mnop..._qr...__ after 3rd TR A,TBL MVO B.A gets us new zone bit space _abcd..._efgh..._ijkl..._mnop..._qr...__ MVO A,B aligns 2nd operand for OC or _abcd..._efgh..._ijkl..._mnop..._qr...__ OC A,B re-inserts bits shifted out of lo-nibble into hi-nibble. Note: To mark vacated bits I used underscores and dots in above illustrations to show the effets of UNPK and bit shift. _abcdabcdefghefghijklijklmnopmnopqr__qr__ PACK B(8),A(15) removes duplicates and chops it up into a useable string _abcdefghijklmnopqr__ result: | 0abc | defg | hjik | lmno | pqr0 | The final OC does the append. I got carried away... I hope you like it :) although it is an alternative to register shift loops, it isn't obvious (to me!) that it is better in any way... Andreas Geissbuehler
Re: Concatanate Bits Instruction?
At 06:37 -0700 on 08/07/2013, Duffy Nightingale wrote about Re: Concatanate Bits Instruction?: Hi All, Thanks much to everyone who responded for all the hints and tips. Someday I hope to be of use to someone on this thread! Andreas, I think you caught a mistake in my specs. It is small bit strings being added, concatenated, modified whatever you wish to call it. But the BIT strings are 4, 7, 10 BITS (Not bytes!) long. I took Mr. Rosenberg's shift register pair idea and coded it up. Essentially we are using R14 as a buffer and loading the buffer by putting the bits to insert in the left most bits of R15, then shift double logical left to load into the buffer (R14). Watching for R14 to fill up, saving to the end of the string, etc. Did not take a lot of code and am testing it now. It is amazing how much data you can store this way - when you use the least amount of bits to represent the data. I refined my original suggestion in private messages to Duffy so I will summarize the additions to my original suggestion here. 1) Keep inserting new bits into the high end of R15 and then shift left double logical R15 into R14. 2) When the next set of bits are going to be longer than the amount of padding in the high end of R14 (the high bits are not part of the string since the register was all 0 padding which shrinks as the bits are shifted from R15 into R14) shift R14 left logical to align the string to the high end of the register and save the register to memory. Increment the sting length by the correct number of bits and bump the save location so it points at the partial byte (unless the saved string length is an 8 bit multiple). 3) XR R14,R14 to zero the register, load the partial byte into the high end of R15, and shift double logical to load it into the low bits of R14. 4) Resume the R15 bit loading and Shift Left Double Logical operation. While I can post the code here (as others have done) I think the above along with my original suggestion explains all the processing needed. Unless asked, I will not bother to post illustrations showing the status of the registers at different points in the process. Have a good day all, Duffy -Original Message- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of robin Sent: Tuesday, August 06, 2013 12:55 AM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: Concatanate Bits Instruction? Seems unduly and unnecessarily complicated to me. I'm a believer in the KISS principle. From: Andreas F. Geissbuehler afg0...@videotron.ca Sent: Tuesday, 6 August 2013 12:30 AM Duffy, Assuing you meant concatenate as in appending 57 bits to the end of a bitstring of say 395 bits which when done will have grown to 395+57=452 bits, and The len of the bit strings to add are 4, 7, 10 BYTES long you could do it WITHOUT register bit shifting loops using old fashion OS/360 instructions Here, the pseudo code to explain how: A DC XL16'00'work area A B DC XL16'00'work area B STR DC B'011011101011000111' source needs alignement 0..7 bits TBL DC 64AL1((*-TBL)*2) to do 1-bit shift-left' * ALIGN BITS TO BE ADDED/APPENDED: *2 regs are needed: *Rpaddr.pointer to right-most byte of target *Rnnumber of significant bits in that byte LTR R0,Rn JNPnoshift required MVO B,STRassume 4-bit shift N R0,=F'3' apply AND-mask JZ X needed 4-bit shift only UNPK A,STR makes space for bit shift MVZ A,=16X'00' clears hi-nibble T TR A,TBLrepeat this SHIFT-LEFT 0..2 times BCT R0,T MVO B,A aligns A for PACK MVO A,B aligns B for OC OC B,Adoubles up the shifted nibbles PACK A,B chop bitstring on new nibble boundary MVCB,Aassume we are done CHI Rn,4test bit count JNH *+10 fewer than 4 bits MVO B,A shift another 4 bits X OC 0(n,Rp).B append new bits to target bitstring LA Rp, ... update addr.ptr for next append AR Rn, ... prev.no. of signifant bit + newly appended N Rn,=F'7' = significant bits at Rp You need offset and length adjustments, e.g, MVO A+1(L'A-1),B to get extra work bits and keeps the packed decimal sign bits out of bitstring. An MVO by itself does a shift of 4-bits... Let's play Computer ! To make it easier for our eye we assign a symbolic name to each bit in STR above: | abcd | efgh | ijkl | mnop | qr__ | 18 bits in 5 nibbles After the initial UNKP and MVZ the bits are spaced out like this: abcdefghijklmnopqr__ The TR doubles the value of each nibble, eg. stays wheras 0011 - 0110 and - [0001]1110, thus: ___abcd.___efgh.___ijkl.___mnop.___qr.__ after 1st shift left __abcd..__efgh..__ijkl..__mnop..__qr..__ after 2dn TR A,TBL _abcd..._efgh..._ijkl..._mnop..._qr...__ after 3rd TR A,TBL MVO B.A gets us new zone bit space _abcd..._efgh..._ijkl..._mnop..._qr...__ MVO A,B aligns 2nd operand for OC or _abcd..._efgh
Re: Concatanate Bits Instruction?
Seems unduly and unnecessarily complicated to me. I'm a believer in the KISS principle. From: Andreas F. Geissbuehler afg0...@videotron.ca Sent: Tuesday, 6 August 2013 12:30 AM Duffy, Assuing you meant concatenate as in appending 57 bits to the end of a bitstring of say 395 bits which when done will have grown to 395+57=452 bits, and The len of the bit strings to add are 4, 7, 10 BYTES long you could do it WITHOUT register bit shifting loops using old fashion OS/360 instructions :) Here, the pseudo code to explain how: A DC XL16'00'work area A B DC XL16'00'work area B STR DC B'011011101011000111' source needs alignement 0..7 bits TBL DC 64AL1((*-TBL)*2) to do 1-bit shift-left' * ALIGN BITS TO BE ADDED/APPENDED: *2 regs are needed: *Rpaddr.pointer to right-most byte of target *Rnnumber of significant bits in that byte LTR R0,Rn JNPnoshift required MVO B,STRassume 4-bit shift N R0,=F'3' apply AND-mask JZ X needed 4-bit shift only UNPK A,STR makes space for bit shift MVZ A,=16X'00' clears hi-nibble T TR A,TBLrepeat this SHIFT-LEFT 0..2 times BCT R0,T MVO B,A aligns A for PACK MVO A,B aligns B for OC OC B,Adoubles up the shifted nibbles PACK A,B chop bitstring on new nibble boundary MVCB,Aassume we are done CHI Rn,4test bit count JNH *+10 fewer than 4 bits MVO B,A shift another 4 bits X OC 0(n,Rp).B append new bits to target bitstring LA Rp, ... update addr.ptr for next append AR Rn, ... prev.no. of signifant bit + newly appended N Rn,=F'7' = significant bits at Rp You need offset and length adjustments, e.g, MVO A+1(L'A-1),B to get extra work bits and keeps the packed decimal sign bits out of bitstring. An MVO by itself does a shift of 4-bits... Let's play Computer ! To make it easier for our eye we assign a symbolic name to each bit in STR above: | abcd | efgh | ijkl | mnop | qr__ | 18 bits in 5 nibbles After the initial UNKP and MVZ the bits are spaced out like this: abcdefghijklmnopqr__ The TR doubles the value of each nibble, eg. stays wheras 0011 - 0110 and - [0001]1110, thus: ___abcd.___efgh.___ijkl.___mnop.___qr.__ after 1st shift left __abcd..__efgh..__ijkl..__mnop..__qr..__ after 2dn TR A,TBL _abcd..._efgh..._ijkl..._mnop..._qr...__ after 3rd TR A,TBL MVO B.A gets us new zone bit space _abcd..._efgh..._ijkl..._mnop..._qr...__ MVO A,B aligns 2nd operand for OC or _abcd..._efgh..._ijkl..._mnop..._qr...__ OC A,B re-inserts bits shifted out of lo-nibble into hi-nibble. Note: To mark vacated bits I used underscores and dots in above illustrations to show the effets of UNPK and bit shift. _abcdabcdefghefghijklijklmnopmnopqr__qr__ PACK B(8),A(15) removes duplicates and chops it up into a useable string _abcdefghijklmnopqr__ result: | 0abc | defg | hjik | lmno | pqr0 | The final OC does the append. I got carried away... I hope you like it :) although it is an alternative to register shift loops, it isn't obvious (to me!) that it is better in any way... Andreas Geissbuehler
Re: Concatanate Bits Instruction?
I agree with the KISS method. If it's concatenate then you can do it without the complication. Easily modified to run on OS/360. No need for the complicated moves and the extra register for shifting. Instead just O directly from storage to merge bits and save it back to storage. Here's what I would start with but it is by no means complete, tested or the most efficient. It just gives you a starting point. DIVISOR DC A(0) Divisor to shift bits LA R4,bufferCurrent offset into buffer SR R5,R5 (0) Next available bit off of R4 NEXT DS 0H L R15,bitcount Number of bits to append LTR R5,R5 Can we use MVC (bit offset is 0)? BNZ NOTMVC No, * Starting on byte boundary - we can just move the bits without shifting SRR14,R140 - needed for divide D R14,=A(8) Calculate offset fields M MVC 0(0,R4),bitlist Copy list of bits EX R15,M Move the data ARR4,R15 Next offset into buffer LR R5,R14 New bit offset * Clear bits that were falsely copied LA R1,=XL1'00,80,C0,E0,F0,F8,FC,FE,FF'(R5) Bits to keep NC 0(1,R4),0(R1) Remove unwanted bits (could overlay next field) J NEXTAppend next bit string NOTMVC DS 0H * setup for shifting bits in this field AR R15,R5 Number of bits plus bit offset LA R1,=AL1(1,2,4,8,16,32,64,128)(R5) Point to divisor value for shifting bits MVC DIVISOR+3(1),0(R1) Copy divisor value LA R14,bitlistStart of bits to copy LOOP DS 0H * shift bits and save to result ICM R1,15,0(R14) Get next 4 bytes (may get S0C4 at end of data if crosses page boundary) SR R0,R0 0 DR0,DIVISORShift the bits OR1,0(R4)Merge the data STCM R1,15,0(R4)Replace the data (could overlay next field) * Advance pointers for next 3 bytes to copy AHI R4,4 Next available buffer addr AHI R14,4Next set of bytes AHI R15,-4*8Adjust length by 4 bytes BP LOOP More bits to be moved from this field * Finished this string - adjust the result pointer / bit offset SR R14,R14 0 for divide LPR R15,R15Make bit overflow offset positive DR14,=A(8) Calculate next bit offset SR R4,R15 Fix the result pointer LR R5,R14 New bit offset * Clear bits that were falsely copied LA R1,=XL1'00,80,C0,E0,F0,F8,FC,FE,FF'(R5) Bits to keep NC 0(1,R4),0(R1) Remove unwanted bits (could overlay next field) XC1(3,R4),1(R4) Clear unwanted bits (could overlay next field) J NEXTMove next bit string Jon Perryman - Original Message - From: robin robi...@dodo.com.au Seems unduly and unnecessarily complicated to me. I'm a believer in the KISS principle. From: Andreas F. Geissbuehler afg0...@videotron.ca Sent: Tuesday, 6 August 2013 12:30 AM Duffy, Assuing you meant concatenate as in appending 57 bits to the end of a bitstring of say 395 bits which when done will have grown to 395+57=452 bits, and The len of the bit strings to add are 4, 7, 10 BYTES long you could do it WITHOUT register bit shifting loops using old fashion OS/360 instructions :) Here, the pseudo code to explain how: Andreas Geissbuehler
Re: Concatanate Bits Instruction?
From: Robert A. Rosenberg a...@rarpsl.com Sent: Monday, 5 August 2013 1:49 PM 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. From his description, the work area is already defined, has been initialized to zeros, and is ready to have bits inserted. The task that he described is, of course catenation. But really, it's six of one and half a dozen of the other. 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. That's an interesting idea. Another way could be thus (which might be appropriate should the catenation be prepared as a subroutine, called periodically). Clear an even-numbered register. Use IC to fetch, into that register, the last byte that had been partly filled. Given that there are k useful bits in this final byte, right-adjust it by 8-k places. In the adjacent odd-numbered register, left adjust the bits to be catenated. Double left shift by 8-k places. Use STC to store the even register. If the appended bits don't extend beyond that byte, the job is done, otherwise double left shift by 8 bits, and STC the even register to the next storage byte. And so on if there are more bits to be catenated If the string in storage exactly fills the last byte, the job of catenating is somewhat simplified -- requiring no fetching before storing.
Re: Concatanate Bits Instruction?
Duffy Nightingale wrote: 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 :( Duffy, Assuing you meant concatenate as in appending 57 bits to the end of a bitstring of say 395 bits which when done will have grown to 395+57=452 bits, and The len of the bit strings to add are 4, 7, 10 BYTES long you could do it WITHOUT register bit shifting loops using old fashion OS/360 instructions :) Here, the pseudo code to explain how: A DC XL16'00'work area A B DC XL16'00'work area B STR DC B'011011101011000111' source needs alignement 0..7 bits TBL DC 64AL1((*-TBL)*2) to do 1-bit shift-left' * ALIGN BITS TO BE ADDED/APPENDED: *2 regs are needed: *Rpaddr.pointer to right-most byte of target *Rnnumber of significant bits in that byte LTR R0,Rn JNPnoshift required MVO B,STRassume 4-bit shift N R0,=F'3' apply AND-mask JZ X needed 4-bit shift only UNPK A,STR makes space for bit shift MVZ A,=16X'00' clears hi-nibble T TR A,TBLrepeat this SHIFT-LEFT 0..2 times BCT R0,T MVO B,A aligns A for PACK MVO A,B aligns B for OC OC B,Adoubles up the shifted nibbles PACK A,B chop bitstring on new nibble boundary MVCB,Aassume we are done CHI Rn,4test bit count JNH *+10 fewer than 4 bits MVO B,A shift another 4 bits X OC 0(n,Rp).B append new bits to target bitstring LA Rp, ... update addr.ptr for next append AR Rn, ... prev.no. of signifant bit + newly appended N Rn,=F'7' = significant bits at Rp You need offset and length adjustments, e.g, MVO A+1(L'A-1),B to get extra work bits and keeps the packed decimal sign bits out of bitstring. An MVO by itself does a shift of 4-bits... Let's play Computer ! To make it easier for our eye we assign a symbolic name to each bit in STR above: | abcd | efgh | ijkl | mnop | qr__ | 18 bits in 5 nibbles After the initial UNKP and MVZ the bits are spaced out like this: abcdefghijklmnopqr__ The TR doubles the value of each nibble, eg. stays wheras 0011 - 0110 and - [0001]1110, thus: ___abcd.___efgh.___ijkl.___mnop.___qr.__ after 1st shift left __abcd..__efgh..__ijkl..__mnop..__qr..__ after 2dn TR A,TBL _abcd..._efgh..._ijkl..._mnop..._qr...__ after 3rd TR A,TBL MVO B.A gets us new zone bit space _abcd..._efgh..._ijkl..._mnop..._qr...__ MVO A,B aligns 2nd operand for OC or _abcd..._efgh..._ijkl..._mnop..._qr...__ OC A,B re-inserts bits shifted out of lo-nibble into hi-nibble. Note: To mark vacated bits I used underscores and dots in above illustrations to show the effets of UNPK and bit shift. _abcdabcdefghefghijklijklmnopmnopqr__qr__ PACK B(8),A(15) removes duplicates and chops it up into a useable string _abcdefghijklmnopqr__ result: | 0abc | defg | hjik | lmno | pqr0 | The final OC does the append. I got carried away... I hope you like it :) although it is an alternative to register shift loops, it isn't obvious (to me!) that it is better in any way... Andreas Geissbuehler
Re: Concatanate Bits Instruction?
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.
Re: Concatanate Bits Instruction?
On 4 August 2013 13:05, robin robi...@dodo.com.au wrote: Then double shift left by k bits. Then do an OI using EX to put in those k bits. Then double left shift again, this time by 8 bits and OI using EX. Continue thus if there are more bits I've done something similar with an 8-bit mask using EX and was wondering whether it would be wiser to use the mask as an index for OC into a 256-byte table. Unfortunately such ideas come (and go) while walking the dog, so I didn't really have an opportunity to measure. Rob
Re: Concatanate Bits Instruction?
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 LHR15,fieldlen Length of field to merge bits LAR14,DEST+L'DESTPast end of destination field SR R14,R15Position in destination field BCTR R15,0 Length relative to 0 EXR15,OCExecute 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 a...@rarpsl.com 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.