Created
December 1, 2012 13:14
-
-
Save tuttlem/4182207 to your computer and use it in GitHub Desktop.
snow - random
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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