This file contains 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
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. |