B
Bill Bowden
Guest
On Feb 5, 8:21 pm, Nobody <nob...@nowhere.com> wrote:
needs to be set, otherwise it's always going to be the same.
With PIC assembly, looks like only 3 lines are needed. But the
sequence length is 2^n-2 for some reason. It loops around every 254
counts. Not sure what's missing.
The first line (RLF) shifts the register left one place with the
incomming bit "0" if the carry flag is clear, or "1" if the
flag is set.
The second line tests the carry bit and jumps over the XOR if the
bit is clear "0".
The 3rd line does the XOR and leaves the result in the random
register. The working register (w) contains the constant word B8, so a
couple extra lines are needed to load the B8 into w. But that's only
done once.
Starting at hex 01, the sequence goes.... 01,02,04,08,10,20,40,80,
B8,C9,2B,57,AE,E4,71,E3,7E,FD,42, etc.
Loop:
RLF RANDOM,f ; Shift Left
BTFSC STATUS,0 ; Test carry flag
XORWF RANDOM,f ; XOR w and random
GOTO Loop
-Bill
Yes, that clears things up a bit, but the incoming bit occasionallyIn the parallel version, the state is shifted one place, with the incoming
bit zero; if the outgoing bit is set, the state is then XOR-ed with the
tap word.
needs to be set, otherwise it's always going to be the same.
With PIC assembly, looks like only 3 lines are needed. But the
sequence length is 2^n-2 for some reason. It loops around every 254
counts. Not sure what's missing.
The first line (RLF) shifts the register left one place with the
incomming bit "0" if the carry flag is clear, or "1" if the
flag is set.
The second line tests the carry bit and jumps over the XOR if the
bit is clear "0".
The 3rd line does the XOR and leaves the result in the random
register. The working register (w) contains the constant word B8, so a
couple extra lines are needed to load the B8 into w. But that's only
done once.
Starting at hex 01, the sequence goes.... 01,02,04,08,10,20,40,80,
B8,C9,2B,57,AE,E4,71,E3,7E,FD,42, etc.
Loop:
RLF RANDOM,f ; Shift Left
BTFSC STATUS,0 ; Test carry flag
XORWF RANDOM,f ; XOR w and random
GOTO Loop
-Bill