sovereignx/asm/rng.s

66 lines
1.1 KiB
ArmAsm
Raw Normal View History

2016-11-01 17:08:48 +00:00
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start GenerateRandomNumber
@ u16 GenerateRandomNumber()
GenerateRandomNumber: @ 806F5CC
2016-11-01 18:35:16 +00:00
ldr r2, =gUnknown_03005D80
2016-11-01 17:08:48 +00:00
ldr r1, [r2]
ldr r0, =0x41c64e6d
muls r0, r1
ldr r1, =0x00006073
adds r0, r1
str r0, [r2]
2016-11-01 18:35:16 +00:00
ldr r2, =gUnknown_020249C0
2016-11-01 17:08:48 +00:00
ldr r1, [r2]
adds r1, 0x1
str r1, [r2]
lsrs r0, 16
bx lr
.pool
thumb_func_end GenerateRandomNumber
thumb_func_start SeedRng
@ void SeedRng(u16 seed)
SeedRng: @ 806F5F8
lsls r0, 16
lsrs r0, 16
2016-11-01 18:35:16 +00:00
ldr r1, =gUnknown_03005D80
2016-11-01 17:08:48 +00:00
str r0, [r1]
2016-11-01 18:35:16 +00:00
ldr r1, =gUnknown_020249BC
2016-11-01 17:08:48 +00:00
movs r0, 0
strb r0, [r1]
bx lr
.pool
thumb_func_end SeedRng
thumb_func_start SeedRng2
SeedRng2: @ 806F610
lsls r0, 16
lsrs r0, 16
2016-11-01 18:35:16 +00:00
ldr r1, =gUnknown_03005D84
2016-11-01 17:08:48 +00:00
str r0, [r1]
bx lr
.pool
thumb_func_end SeedRng2
thumb_func_start GenerateRandomNumber2
GenerateRandomNumber2: @ 806F620
2016-11-01 18:35:16 +00:00
ldr r2, =gUnknown_03005D84
2016-11-01 17:08:48 +00:00
ldr r1, [r2]
ldr r0, =0x41c64e6d
muls r0, r1
ldr r1, =0x00006073
adds r0, r1
str r0, [r2]
lsrs r0, 16
bx lr
.pool
thumb_func_end GenerateRandomNumber2
.align 2, 0 @ Don't pad with nop.