Re: A86: Re: I feel stupid.


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

Re: A86: Re: I feel stupid.




that's a sucky random number generator - it many times outputs sequences
of numbers that never end.  the other one is slow.  try this

GetRandom:
    ld hl,(RandSeed)
    ld a,h
    rla
    xor l
    ld h,a
    ld a,l
    rra
    xor h
    ld l,a
    ld (RandSeed),hl
    ret
RandSeed:
    .dw $C187

Trey Jazz wrote:

> >How do I generate a random number?
>
> for a random num with no boundary use:
>
> ld a,r
>
> for a random num with a boundary use:
>
>  ld a,$xx
>  push af
>
> Random:
>  call _RANDOM
>  pop af
>  call _setxxop2
>  call _fpmult
>  call _convop1
>  ld a,e
>  ret
>
> dont feel stupid...i didnt get it at first either




References: