CMP EMBEDDED.COM

Login | Register     Welcome Guest   IPS  
HOME DESIGN PRODUCTS COLUMNS E-LEARNING CONFERENCES CODE FORUMS/BLOGS NEWSLETTERS CONTACT FEATURES RSS RSS

Listing 1: Description
nstate ds 1 ;state of noise generator (shift reg)
       
  org p:$100  
init      
  move #$ff,x0 ;initial state of noise generator
  move x0,x:nstate  
get      
  do #200,_eget  
  jsr noise ;generate noise sample
  move x:nstate,a ;get noise
  movep a1,y:$ffff ;output noise sample
_eget      
; assumes scaling mode is off  
;      
noise     ;do noise generation loop
  clr b x:nstate,a ;get a zero in b
  tst a #>$000100,x0 ;check a, get a 1 in lsb position
  tnr x0,b ;if normalized, then xor=1
  add b,a ;set lsb
  asl a ;shift bits
  move a1,x:nstate ;save state
  rts   ;return with state
Embedded.com Career Center
Ready for a change?
SEARCH JOBS

Browse all jobs

SPONSOR
RECENT JOB POSTINGS





 :