Re: A86: Random Number stuff


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

Re: A86: Random Number stuff




Hey... why doesn't someone just go to VTI debugger, and just find in the rom
where the TI-OS's random number generator is?

Brent
----- Original Message -----
From: Andreas Finne <a_finne@hotmail.com>
To: <assembly-86@lists.ticalc.org>
Sent: Monday, January 10, 2000 4:07 AM
Subject: Re: A86: Random Number stuff


>
> Jimmy's random routine is very fast, and is great if you just want a
single
> random number every now and then. But if you for instance want to have
> random coordinates chosen one after the other, it is not as good. I have
> made a program to try out different random routines by taking random
> coordinates and put out a sprite at the chosen location. With this routine
> the results were something like this:
>
> 00 0
>   0 00
>      0 00
>        0 0 0
>
> All sprites were in an area from the upper left to the lower right. You
will
> get a little better results if you put a 'halt' between every call to the
> random routine.
>
> Another random routine using rom calls would be something like this:
> (Should be correct)
>
> xor a   ;ld a,0
> call _setXXop1  ;content of a into OP1
> ld a,10
> call _setXXop2  ;content of a into OP2
> call _randint   ;random integeter between OP1 and OP2->OP1
> call _convop1   ;convert number in OP1 to 'a'
>
> This routine would produce a random number between 0 and 10 into 'a'.
> It is very random, but very slow.
>
>
> Andreas Finne
> a_finne@hotmail.com
> a_finne@iobox.fi
>
>
> >From: JayEll64@aol.com
> >Reply-To: assembly-86@lists.ticalc.org
> >To: assembly-86@lists.ticalc.org
> >Subject: Re: A86: Random Number stuff
> >Date: Sun, 9 Jan 2000 16:44:20 EST
> >
> >
> >In a message dated 1/9/00 2:19:10 PM Mountain Standard Time,
> >asmti86@hotmail.com writes:
> >
> > > I'm sure this has been asked before, but I'l ask anyway =) Is there a
> >way
> >to
> > >  call the rand function from assembly? If so how? All I could find in
> >the
> >ASM
> > >
> > >  Studio 3.1 help file was _random, or is that what I should use? If
> >those
> > >  don't work, is there an algorithim that can do this? I just need
> >something
> > >  basic, like a random number 1-9. I could probably (try) to modify it
> >later
> > >  if needed. Any help would be appreciated.
> >
> >Something like the following is all you should really need:
> >
> >;Randomization routine by Jimmy Mardell (used in ZTetris v3.0)
> >PRandom:               ; Creates a pseudorandom number 0 <= x < A
> >  ld b,a
> >  ld a,r
> >  add a,a
> >  ld hl,0
> >  ld d,0
> >  ld e,a
> >RMul:
> >  add hl,de
> >  djnz RMul
> >  ld a,h
> >  ret
> >
> >This could obviously be optimized if you have a constant range (ie, 0 <=
x
> ><
> >9, and then increase the result to get a range of 1 to 9).
> >
> >JayEll
> >
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
>
>
>



References: