s887212@minyos.xx.rmit.oz.au (Stephen Riehm [Romulis]) (12/02/90)
I tried to get some random numbers out of my 64 this morning from assembler, but I couldn't manage to a get a very RANDOM set. Ie: it was the same every time. According to some books I have it IS POSSIBLE to use the oscillator for the third voice... however all of my attempts have ended in ZIP :-( If you have done this before and dont mind a segment of your code being very blatantly plagiarised... I would be very grateful for a copy :-) thanx in advance ============================================================================ Romulis [Stephen Riehm] Royal Melbourne Institute of Technology, (124 Latrobe St., Melbourne.) s887212@minyos.xx.rmit.oz.au Australia. @>---`--,--( Still Stuck on the wrong side of the deep pink sea )--.--'---<@ ======================< Insert Usual Disclaimer >===========================
cs4344af@evax.arl.utexas.edu (Fuzzy Fox) (12/03/90)
In article <6389@minyos.xx.rmit.oz.au> s887212@minyos.xx.rmit.oz.au (Stephen Riehm [Romulis]) writes: >According to some books I have it IS POSSIBLE to use the >oscillator for the third voice... While I don't have any specific code to show you, you should be able to generate random numbers with the following setup... Set the frequency on Voice 3 of the SID to a very high value (like $FFFF). Then turn on Voice 3 using the Noise waveform. If you don't want to hear the voice, either turn on the "silence voice 3" bit, or set the volume to zero. However, the oscillator will still oscillate randomly, and you should be able to pick up its waveform samplings by reading the oscillator output at $D41B. Here's some untested code written from the above: INIT: LDA #$FF STA $D40E STA $D40F LDA #$80 STA $D412 LDA #$8F ; Volume = 15, but no voice 3 output STA $D418 RTS RAND: LDA $D41B RTS ; Random number returned in A.
treesh@vangogh.helios.nd.edu (12/05/90)
If your in 64 mode, and your only need to pull a random number once every few seconds of program execution, type a simple LDA from the zero-page address that holds the jiffy value of the jiffy counter. The 3rd voice of the sid chip should also work! ctfm
s887212@minyos.xx.rmit.oz.au (Stephen Riehm [Romulis]) (12/05/90)
cs4344af@evax.arl.utexas.edu (Fuzzy Fox) writes: >In article <6389@minyos.xx.rmit.oz.au> s887212@minyos.xx.rmit.oz.au (Stephen Riehm [Romulis]) writes: >>According to some books I have it IS POSSIBLE to use the >>oscillator for the third voice... >Here's some untested code written from the above: >INIT: LDA #$FF ; set frequency to $FFFF > STA $D40E > STA $D40F > LDA #$80 ; select noise waveform > STA $D412 > LDA #$8F ; Volume = 15, but no voice 3 output > STA $D418 > RTS >RAND: LDA $D41B > RTS ; Random number returned in A. After testing this I found that it works fine.. however there are some things to note: ] If you want two numbers simultaneously you will need to put a small delay before getting the second number. ie: ldx $d41b ; ldy $d41b often results in X. == Y. solution: ldx $d41b wait cpx $d41b beq $wait ldy $d41b rts ldx $d41b ; ldy #$00; loop dey; bne $loop; ldy $d41b ; rts also works nicely... thanx to those who responded!