Posted By
IstvanV on 2011-02-28 09:01:11
| Re: Random for Real
Another version of the above routine, with a 23-bit LFSR. The quality is improved, although still not quite perfect. However, it is slower (40 cycles without the JSR and RTS, but maybe it can be optimized).
. 2100 A5 D1 LDA $D1 . 2102 AA TAX . 2103 4A LSR . 2104 A5 D0 LDA $D0 . 2106 4D 02 FF EOR $FF02 . 2109 85 D1 STA $D1 . 210B 6A ROR . 210C 85 D0 STA $D0 . 210E 8A TXA . 210F 0A ASL . 2110 A5 D2 LDA $D2 . 2112 2A ROL . 2113 86 D2 STX $D2 . 2115 45 D0 EOR $D0 . 2117 85 D0 STA $D0 . 2119 60 RTS
|