Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rand:
- ;;Input: A is the range.
- ;;Output: Returns in A a random number from 0 to (input)A-1.
- ;; B=0
- ;; DE is a pseudo-random 16-bit integer.
- ;;Destroys:
- ;; HL
- ;;Speed:
- push af
- call prng24
- ex de,hl
- pop af
- or a \ sbc hl,hl
- ld b,h
- add a,a \ jr nc,$+5 \ push de \ pop hl
- add hl,hl \ rla \ jr nc,$+4 \ add hl,de \ adc a,b
- add hl,hl \ rla \ jr nc,$+4 \ add hl,de \ adc a,b
- add hl,hl \ rla \ jr nc,$+4 \ add hl,de \ adc a,b
- add hl,hl \ rla \ jr nc,$+4 \ add hl,de \ adc a,b
- add hl,hl \ rla \ jr nc,$+4 \ add hl,de \ adc a,b
- add hl,hl \ rla \ jr nc,$+4 \ add hl,de \ adc a,b
- add hl,hl \ rla \ ret nc \ add hl,de \ adc a,b
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement