Skip to content

Instantly share code, notes, and snippets.

@tuttlem
Created December 1, 2012 13:14
Show Gist options
  • Save tuttlem/4182207 to your computer and use it in GitHub Desktop.
Save tuttlem/4182207 to your computer and use it in GitHub Desktop.
snow - random
get_random:
; start out with ax and bx = 0
xor ax, ax
xor bx, bx
; get the first random number and
; store it off in bl
mov dx, 40h
in al, dx
mov bl, al
; get the second random number and
; store it off in al, but we only
; want 6 bits of this number
mov dx, 40h
in al, dx
and al, 63
; add the two numbers to produce a
; random digit in range
add ax, bx
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment