| Subject: Re: [stella] Random Numbers From: Thomas Jentzsch <tjentzsch@xxxxxx> Date: Tue, 27 Jan 2004 22:11:36 +0100 | 
David Davies wrote:
> Just started on a game for the 2600 based on the 1977 arcade game,
> Depthcharge (well, okay, it's a straight port with added game variations).
> It's my first attempt at taming the 2600, so please be gentle :-)
Welcome!
> I've been doing some thinking as to what needs doing on the game. I
> definately need a random number generator. Is there a way of doing that on
> the 2600?
This is as simple as it gets:
RAND_EOR_8 = $8E; or 95,96,A6,AF,B1,B2,B4,B8,C3,C6,D4,E1,E7,F3,FA
NextRandom SUBROUTINE
    lda     random
    lsr
    bcc     .skipEor
    eor     #RAND_EOR_8
.skipEor:
    sta     random
    rts
Just make sure that you initialize random with a value != 0 at
startup.
    
Have fun!
Thomas                            
_______________________________________________________
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |
----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [stella] Random Numbers, Joe Grand | Thread | Re: [stella] Random Numbers, Eric Ball | 
| Re: [stella] Random Numbers, Joe Grand | Date | Re: [stella] Which games use CV-Ban, Eckhard Stolberg | 
| Month |