A85: Assembly shift programming problem
[Prev][Next][Index][Thread]
A85: Assembly shift programming problem
All right. I have a routine which returns data in register A.
The data is fairly random, but it is signifigant. However, only
certain bits of this data are random. Here is the way the data looks:
Note: * = random
12345678 12345678
**0****1 **0****1
However, the problem with the routine is that it does not necessarily put
the bits in that order. It is reading a bit stream from memory, but that
memory may not be organized right. This means the data may look like this:
12345678 12345678 --> 56781234 56781234
***1**0* ***1**0* --> **0****1 **0****1
It is the same, just shifted. I want something that will just tell me how
many shifts to the right I would need to do to the data to put it back into
the correct order (first example). Keep in mind that the data in 1,2,4,5,6,7
can be anything so there may be two instances of a 0 seperated by 4 spaces from
a 1. Since the data is inherantly random, you can't really tell for sure from
just one byte. Because of this, at the start of the bit stream, I can get as
many bytes as I need to get the sequencing correct. Each bit is completely
independant of all other bits.
My thinking so far is that I could keep a byte as a test for viable starting
points. (This example uses the second above as a model)
Bit # 12345678
Original A 10111001
Test Byte A 00000110 (All 0 with a 1 after four spaces)
Original B 01010101
Test Byte B 10101010 (All 0 with a 1 after four spaces)
Then AND the two test bytes together to find the location of the zero.
Anyway, that may help. Thanks for any assistance you can give.
-Paul Hounshell
PaulH@mdli.com