Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!bruce!monu1!monu6!minyos!s887212 From: s887212@minyos.xx.rmit.oz.au (Stephen Riehm [Romulis]) Newsgroups: comp.sys.cbm Subject: Re: random numbers in ML Message-ID: <6467@minyos.xx.rmit.oz.au> Date: 5 Dec 90 01:35:50 GMT References: <6389@minyos.xx.rmit.oz.au> <1990Dec3.072647.28822@evax.arl.utexas.edu> Distribution: comp Organization: RMIT Computer Centre, Melbourne Australia. Lines: 36 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!