diff options
Diffstat (limited to 'asm/other_random.s')
-rw-r--r-- | asm/other_random.s | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/asm/other_random.s b/asm/other_random.s new file mode 100644 index 0000000..751fc20 --- /dev/null +++ b/asm/other_random.s @@ -0,0 +1,48 @@ + .include "constants/gba_constants.inc" + .include "asm/macros.inc" + + .syntax unified + + .text + + thumb_func_start OtherRandom +OtherRandom: + ldr r1, _08004514 + ldrh r2, [r1] + movs r0, 0x6D + muls r0, r2 + ldr r2, _08004518 + adds r0, r2 + strh r0, [r1] + ldrh r0, [r1] + bx lr + .align 2, 0 +_08004514: .4byte gUnknown_203B070 +_08004518: .4byte 0x000003fd + thumb_func_end OtherRandom + + thumb_func_start OtherRandomCapped +OtherRandomCapped: + push {r4,lr} + adds r4, r0, 0 + bl OtherRandom + muls r0, r4 + asrs r0, 16 + pop {r4} + pop {r1} + bx r1 + thumb_func_end OtherRandomCapped + + thumb_func_start OtherRandomRange +OtherRandomRange: + push {r4,lr} + adds r4, r0, 0 + subs r0, r1, r4 + bl OtherRandomCapped + adds r0, r4 + pop {r4} + pop {r1} + bx r1 + thumb_func_end OtherRandomRange + + .align 2, 0 @ Don't pad with nop. |