Geekboy

Untitled

Oct 25th, 2011
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. LFSR: ; outputs random value in a
  3. ;Input:  HL = ptr to seed
  4. ;Output: A = Random 8bit Number
  5. ;Destroys AF , HL
  6. ;Has a period of 255
  7. ;Each number will only show up once
  8. ; ld hl,lfsrseed
  9.  ld a,(hl)
  10.  or a
  11.  rra
  12.  jp nc,_
  13.  xor %10111000 ;Taps on bits 7,5,4,3
  14. _:
  15.  ld (hl),a
  16.  ret
Advertisement
Add Comment
Please, Sign In to add comment