A86: Re: r register?


[Prev][Next][Index][Thread]

A86: Re: r register?





It's the memory refresh register; it's incremented once every instruction
(twice in $dd & $fd instructions), so the contents are pretty much random.
I'm not sure how it works but if this register is not refreshed it, slows
down the cpu _alot_.


>
>i was looking around in the source to solitaire when i came across Jimmy
>Mardell's pseudo random routine.  i understand basically all of it except
for
>the second line, which is "ld a,r".  what is the r register?  i've never
heard
>of it.  does it always contain some sort of random value or something?
>
>
>;Randomization routine by Jimmy Mardell (used in ZTetris v3.0)
>PRandom:        ; Creates a pseudorandom number 0 <= x < A
>   ld b,a
>   ld a,r ;<-----what the heck is this??????
>   add a,a
>   ld hl,0
>   ld d,0
>   ld e,a
>RMul:
>   add hl,de
>   djnz RMul
>   ld a,h
>   ret


Follow-Ups: