diff options
| author | John Wilbert M. Villamor <lameguy64@gmail.com> | 2019-04-06 10:11:07 +0800 |
|---|---|---|
| committer | John Wilbert M. Villamor <lameguy64@gmail.com> | 2019-04-06 10:11:07 +0800 |
| commit | f3e040230772f978540a71aea43dfde200992922 (patch) | |
| tree | bd8ca31b72dd01e24980b073854e263589530f56 /libpsn00b/libc/rand.s | |
| download | psn00bsdk-f3e040230772f978540a71aea43dfde200992922.tar.gz | |
First commit
Diffstat (limited to 'libpsn00b/libc/rand.s')
| -rw-r--r-- | libpsn00b/libc/rand.s | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libpsn00b/libc/rand.s b/libpsn00b/libc/rand.s new file mode 100644 index 0000000..a502e87 --- /dev/null +++ b/libpsn00b/libc/rand.s @@ -0,0 +1,38 @@ +.set noreorder +.set noat + +.section .text + + +.global rand +.type rand, @function +rand: + + la $at, _randseed + lw $v0, 0($at) + li $v1, 0x41c64e6d + + multu $v0, $v1 + mflo $v0 + nop + addiu $v0, 12345 + sw $v0, 0($at) + + jr $ra + andi $v0, 0x7fff + + +.global srand +.type srand, @function +srand: + la $at, _randseed + jr $ra + sw $a0, 0($at) + + +.section .data + +.type _randseed, @object +_randseed: + .word 1 +
\ No newline at end of file |
