summaryrefslogtreecommitdiff
path: root/asm/rich4_clib.asm
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2021-05-11 20:18:17 +0800
committerIru Cai <mytbk920423@gmail.com>2021-05-11 20:18:17 +0800
commit4f11e9b0b336af11c291c0feace9f0af3744fe73 (patch)
tree767701c7e279c257898efdca158c062f9589df84 /asm/rich4_clib.asm
parenta5622c7b9b4734ab1d24f47f41d742874c68b424 (diff)
downloadrich4-4f11e9b0b336af11c291c0feace9f0af3744fe73.tar.xz
move out rand(), srand()
Diffstat (limited to 'asm/rich4_clib.asm')
-rw-r--r--asm/rich4_clib.asm34
1 files changed, 34 insertions, 0 deletions
diff --git a/asm/rich4_clib.asm b/asm/rich4_clib.asm
index cb550e5..9ed1133 100644
--- a/asm/rich4_clib.asm
+++ b/asm/rich4_clib.asm
@@ -8,6 +8,10 @@ extern ref_00488f60
extern ref_00488f64
extern ref_004991d4
+global clib_rand
+global clib_srand
+extern ref_00488f4c
+
section .text
fcn_00457366:
@@ -97,4 +101,34 @@ add esp, 8
pop ebx
ret
+fcn_00456f23:
+call dword [ref_00488f4c] ; ucall: call dword [0x488f4c]
+add eax, 0xc
+ret
+
+clib_rand:
+call fcn_00456f23 ; call 0x456f23
+test eax, eax
+jne short loc_00456f37 ; jne 0x456f37
+ret
+
+loc_00456f37:
+imul edx, dword [eax], 0x41c64e6d
+add edx, 0x3039
+mov dword [eax], edx
+mov eax, edx
+shr eax, 0x10
+and eax, 0x7fff
+ret
+
+clib_srand:
+call fcn_00456f23 ; call 0x456f23
+test eax, eax
+je short loc_00456f5f ; je 0x456f5f
+mov edx, dword [esp + 4]
+mov dword [eax], edx
+
+loc_00456f5f:
+ret
+
section .data