Fast RNG algorithm
Posted: October 11th, 2022, 00:54
Just found a nice pseudo random number generator algorithm suitable for S1C88. It uses only 16 bit numbers and is very fast when implemented in assembly:
Here is implementation for several processors including z80 which is very similar to S1C88: https://github.com/impomatic/xorshift798
Code: Select all
uint16_t xs = 1; // initialised with a non-zero seed
xs ^= xs << 7
xs ^= xs >> 9
xs ^= xs << 8