Good that me being a pedantic ass made the cut
Code: Select all
61 move.l myRandSeed(a6),d0
62 move.w d0,d4 ; Copy low word LLLL
63 swap d0 ; LLLL HHHH
64 mulu #$c12d,d0 ; HHHH * 49453
65 mulu #$712d,d4 ; LLLL * 28973
66 swap d0 ; HHHH LLLL
67 clr.w d0 ; HHHH 0000 (Divide by 65536)
68 add.l d0,d4 ; I have no idea!!!
59 addq.l #1,d4 ; New seed
70 move.l d4,myRandSeed(a6) ; Save seed
Basically what you see here is a simple 32x16 bit multiplication with one change. Normally you multiply both 16-bit halves with the same factor and add the results after shifting back the upper word. So the the clr.w in line 67 is there to remove any overflow, not to divide by 65536. The code is basically
Code: Select all
myRandSeed = myRandSeed * $712d + 1
if it wasn't for the fact that he upper factor is slightly different. I think the real formula is
Code: Select all
myRandSeed = myRandSeed * $712d + ((myRandSeed & $F0000) * $5000) + 1
Not sure why, maybe a typo, maybe to make it more "random"