How can I obtain the uptime of a Sinclair ZX Spectrum machine (ZX48, ZX128, or Pentagon clone) via their BASIC interpreter? Specifically, the same value used by
RANDOMIZE 0 to seed its PRNG. I would assume that this uptime would be the number of cycles the MCU has gone through since boot and so would increment at 3.5 MHz (or some fraction thereof). If it is not possible to obtain through the BASIC interpreter, how would I go about getting it by writing code directly to memory, e.g. with
The reason I am wondering is because I would like to generate a sequence of random numbers less predictable than that generated by
RND. To do that, I need an environmental source of entropy. Inter-keystroke timing is the perfect place to get that entropy (as the ZX has no HWRNG), but only if a high-resolution timer can be sampled at each keystroke. If this is an X/Y question, please let me know.