Created
February 5, 2017 17:57
-
-
Save bhickey/0de228c02cc60b5965582d2d946d8c38 to your computer and use it in GitHub Desktop.
6502 xorshift, 8-bit full period
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; r ^= (r << 1) | |
| ; r ^= (r >> 1) | |
| ; r ^= (r << 2) | |
| xorshift: | |
| lda <RAND_SEED | |
| asl a | |
| eor <RAND_SEED | |
| tax | |
| asr a | |
| eor x | |
| tax | |
| asr a | |
| asr a | |
| eor x | |
| rts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
16 bit version:
(It may be incorrect...)
http://www.retroprogramming.com/2017/07/xorshift-pseudorandom-numbers-in-z80.html