-
Notifications
You must be signed in to change notification settings - Fork 1
/
rand.asm
executable file
·46 lines (37 loc) · 921 Bytes
/
rand.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
include rand.inc
; ##########################################################################
getrand proc minimum:word, maximum:word
invoke rand
xor edx, edx
movzx ecx, maximum
sub cx, minimum
div ecx
mov ax, dx
add ax, minimum
ret
getrand endp
; ##########################################################################
rand proc
mov eax, rand_z
mov ecx, eax
shr ecx, 16
and eax, 0000FFFFh
mov edx, 36969
mul edx
add eax, ecx
mov rand_z, eax
mov eax, rand_w
mov ecx, eax
shr ecx, 16
and eax, 0000FFFFh
mov edx, 18000
mul edx
add eax, ecx
mov rand_w, eax
mov eax, rand_z
shr eax, 16
add eax, rand_w
ret
rand endp
; ##########################################################################