This routine twists the three 16-bit seeds in QQ15 once.
If we start with seeds s0, s1 and s2 and we want to work out their new values
after we perform a twist (let's call the new values s0´, s1´ and s2´), then:
s0´ = s1
s1´ = s2
s2´ = s0 + s1 + s2
So given an existing set of seeds in s0, s1 and s2, we can get the new values
s0´, s1´ and s2´ simply by doing the above sums. And if we want to do the
above in-place without creating three new s´ variables, then we can do the
following:
tmp = s0 + s1
s0 = s1
s1 = s2
s2 = tmp + s1
So this is what we do in this routine, where each seed is a 16-bit number.
.TT54LDAQQ15; X = tmp_lo = s0_lo + s1_loCLCADCQQ15+2TAXLDAQQ15+1; Y = tmp_hi = s1_hi + s1_hi + CADCQQ15+3TAYLDAQQ15+2; s0_lo = s1_loSTAQQ15LDAQQ15+3; s0_hi = s1_hiSTAQQ15+1LDAQQ15+5; s1_hi = s2_hiSTAQQ15+3LDAQQ15+4; s1_lo = s2_loSTAQQ15+2CLC; s2_lo = X + s1_loTXAADCQQ15+2STAQQ15+4TYA; s2_hi = Y + s1_hi + CADCQQ15+3STAQQ15+5RTS; The twist is complete so return from the subroutine