I was thinking the same thing.
The whole "algorithm" is :
Given any number of bytes
OutputByte 0, bits 0-6 = InputBytes 0-6
OutputByte 0, bit 7 = 1 IF there are more bytes to follow, 0 if no more bytes (so always zero in this case).
OuputByte 1,bits 0-6 = InputByte (shifted - bit 0 is the 7th bit of inputByte 0)
OutputByte 1 ,bit 7 = 1 IF there are more bytes to follow (so always 1)
OutputByte 2,bits 0-6 = data (shifted twice - bit 0 is bit 6 of InputByte1,bit 1 is bit 7 of inputByte1
Output?Byte2,bit7 = 1 IF there are more bytes to follow (so always 1).
Data is read MSB first, so
If input = $7F, output = $7F
If input = $80, ouput = $8100 (seventh bit of byte 0 shifted to bit 0 of byte 2, MSb of byte 1 set because there is one more byte to go (byte 0 is all "0"))
Likewise $67CD is converted to $81CF4D
There has got to be some semi-elegant way.
Thanks for getting me started.
Bookmarks