Re: A86: Answer my Own Random Question =)
[Prev][Next][Index][Thread]
Re: A86: Answer my Own Random Question =)
Ahmed El-Helw wrote:
>
> Hey Guys ...
>
> I was expirementing and figured it out ... For all you who want to know ...
>
> -----------
> _setxxop2 equ 4617h
> _convop1 equ 5577h
> _fpmult equ 548Ch
>
> -----------
> call _RANDOM
> ld a,5 ;Digit that you want, so Random 1-5 here
> call _setxxop2
> call _fpmult
> call _convop1
> ld a,e
>
> Thanks =)
>
> At 04:30 AM 10/13/97 +0000, you (or was it I =) wrote:
> >Hello Guys,
> > I missed the message about Random ... Is there a way to do a random #
> >between 1-85 ? The below is a routine for the Ti-83, if anyone cares to
> >convert it, or someone tell me please an easier way ?? Thanks !
> >
> >;------------------------------------------------------------------
> >
> >;Where TEMP = 85 ....
> >
> >random:
> > call _zerooop1 ;0->op1
> > call _random ;rand # 0-1 -> op1
> > call _op2set0 ;0->op2
> > ld a,(temp) ;temp->a
> > call _setxxop2 ;'a'->op2
> > call _fpmult ;op1*op2->op1
> > call _trunc ;ipart(op1)->op1
> > call _plus1 ;op1+1->op1
> > call _convop1 ;op1->de
> > ld a,e ;e->a (e is the second 8 bits of de)
> > ret ;random done, return
>
i tried this routine and when it exits the program it shuts it off and
turns the contrast down to 0 and u gotta press on then take out a batt
and put back in to turn it on, kinda similar to the off routine
Follow-Ups:
References: