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.

Reply via email to