05/07/86: RE: 6809 tips Re: Msg 7603 by Delphi, | Category: Delphi - Source for 6809 Assemblers | Comments are closed

RE: 6809 tips Re: Msg 7603

7623 7MAY86-2100 Source for 6809 Assemblers
RE: 6809 tips (Re: Msg 7603)
From: 6809ER To: BEERBELLY

Here is a subroutine that uses no rom calles (great for 64k programs or OS-9).
The random number from 0 to 255 is returned in the A register, no other
registers are changed.
And here it is…..

RANDOM PSHS B
LDD RND
LSRA
EORA RND
COMA
LSLA
LSLA
LSLA
LDA RND
ROLB
ROLA
ANDA #127
STD RND
TFR B,A
ADDA SEED
EORA RND
STA SEED
PULS PC,B
RND FDB 0
SEED FCB 0

Well, there you have it. I will be uploading it into the Asm Lag Database with
full documentation in the next few days.
Use any number (besides $FFFF) to reseed the sequence (it’s length is about
32,000 numbers long).
Steve Bjork, 6809er

Comments are closed.