Subject: [stella] Random number generators From: jimn8@xxxxxxxxxx (Jim Nitchals) Date: Mon, 21 Oct 1996 08:05:28 -0700 (PDT) |
Communist Mutants did it like this: RANDOM LDA RND ASL ASL EOR SHIPX ADC RND ADC FRAMEL STA RND RTS It uses an ongoing seed (RND), and combines it with the ship's horizontal position and the current video frame number to produce a new seed. It's simple but relies a bit on the randomness of the ship's X position to yield good randomness in itself. Suicide Mission uses a linear feedback shift register (LFSR). Here's the code: RND LDA RNDL LSR LSR SBC RNDL LSR ROR RNDH ROR RNDL LDA RNDL RTS For simplicity of design, this approach is better but it requires 2 bytes of RAM. If the zero-page RAM is in short supply you could modify RND to use Supercharger memory instead.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] How do you generate ra, Glenn Saunders | Thread | [stella] Help! Can't do a simple t, jvmatthe |
[stella] How do you generate random, jvmatthe | Date | Re: [stella] How do you generate ra, Glenn Saunders |
Month |