Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am unquaiz on github.
  • I am unquaiz (https://keybase.io/unquaiz) on keybase.
  • I have a public key ASALMYbJeQKCAOCCtr1JPDWJ4TTz6UqMyM4Xtf1XmWRI9go

To claim this, I am signing this object:

@UnQuaiz
UnQuaiz / ZX Spectrum Random number generators
Last active August 18, 2019 16:50 — forked from JohnConnolly0/ZX Spectrum Random Numbers
ZX Spectrum Random number generators
LD A,R ; Load the A register with the refresh register
LD L,A ; Copy register A into register L
AND %00111111 ; This masking prevents the address we are forming from accessing RAM
LD H,A ; Copy register A into register H
LD A,(HL) ; Load the pseudo-random value into A
; HOW THIS WORKS
; The refresh register in the Z80 is highly unpredictable since it is incremented every cycle.
; Because it may be at any value when this routine is called, it is very good for random numbers.