I think I have this cracked now thanks to generous help on this and other forums.
In the end I did not need the large lookup table as it was always using the same table entry.
So my code ended up being tiny and did not require LONGS etc. .
Code:W0 VAR WORD W1 VAR WORD W2 VAR WORD SEED1 VAR BYTE SEED2 VAR BYTE SEED3 VAR BYTE 'KEY1 = 46336; 'KEY3 = 32973; 'SHIFT1 = 1; (-1) 'SHIFT2 = 3; ' Calculates and stores the results of two cryptographic operations ' on the first two seed bytes in W1 and W2 ' ' The operation being carried out consists of adding two 16-bit values ' and performing a bitwise rotation on the result. ' ' The two results are calculated from adding the 2 seed bytes to both ' KEY1 and KEY2, with a rotation of SHIFT1 and SHIFT2 respectively. SEED1 = $C7 SEED2 = $B0 SEED3 = $6B 'Answer should be $82 $CB $6B W1.BYTE0 = SEED2 W1.BYTE1 = SEED1 W0 = W1 + 46336 'Key1 ' Does a cyclic bitwise rotation of B0-bits on W0 W0 = (W0 >> 1 | W0 << ($10 - 1)) 'Note this is a negative shift W2 = W0 W0 = W1 ' Does a cyclic bitwise rotation of B0-bits on W0 W0 = (W0 << 3 | W0 >> ($10 - 3)) 'Note this is a positive shift W1 = W0 ' Multiplies the contents of W1 and W2 and adds KEY3, stores in W0 ' Impicitly calculates 16-bit overflow only W0 = W1 * W2 W0 = W0 + 32973 'KEY3 SEED1 = W0.BYTE1 SEED2 = W0.BYTE0




Bookmarks