A83: Re: Re: Re: Problem with a program


A83: Re: Re: Re: Problem with a program

> 65,535 even =)
> Actually, you could just use a 16-bit register to control a DJNZ loop (you
> CAN do that can't you?...lol) and do all the tough mathematics in the OP
> registers. Generating 100,000 random numbers on an 8Mhz chip will be slow
> matter :)

The Z80 in the TI-82/83(+)/85/86 runs at 6MHz, not 8.

And DJNZ is 16-bit.
But using a trick (see below), you can make 16-bit loops which are almost as
fast as DJNZ.

Trick: input=nr. of loops in BC

ld a,c    ;preloop-part
ld c,b
ld b,a
dec bc
inc b
inc c
Loop:    ;the loop itself
djnz Loop
dec c
jr nz,Loop

Ofcourse you can shorten this by precalculating BC.


Follow-Ups: References: