through sub_8151574

This commit is contained in:
PikalaxALT 2017-10-28 15:58:07 -04:00
parent 5ea2f463d7
commit f57776c74c
3 changed files with 44 additions and 74 deletions

View File

@ -5,80 +5,6 @@
.text
thumb_func_start sub_8151534
sub_8151534: @ 8151534
push {lr}
lsls r0, 16
asrs r0, 16
lsls r1, 16
asrs r1, 16
muls r0, r1
adds r1, r0, 0
cmp r0, 0
bge _08151548
adds r1, 0xFF
_08151548:
lsls r0, r1, 8
asrs r0, 16
pop {r1}
bx r1
thumb_func_end sub_8151534
thumb_func_start sub_8151550
sub_8151550: @ 8151550
push {lr}
adds r3, r1, 0
lsls r0, 24
lsrs r0, 24
lsls r3, 16
asrs r3, 16
lsls r2, 16
asrs r2, 16
muls r3, r2
movs r1, 0x1
lsls r1, r0
adds r0, r3, 0
bl __divsi3
lsls r0, 16
asrs r0, 16
pop {r1}
bx r1
thumb_func_end sub_8151550
thumb_func_start sub_8151574
sub_8151574: @ 8151574
push {r4-r7,lr}
adds r2, r1, 0
adds r4, r0, 0
asrs r5, r0, 31
asrs r3, r2, 31
adds r1, r5, 0
adds r0, r4, 0
bl __muldi3
adds r5, r1, 0
adds r4, r0, 0
adds r7, r5, 0
adds r6, r4, 0
cmp r5, 0
bge _0815159A
movs r6, 0xFF
movs r7, 0
adds r6, r4
adcs r7, r5
_0815159A:
lsls r3, r7, 24
lsrs r2, r6, 8
adds r0, r3, 0
orrs r0, r2
asrs r1, r7, 8
adds r5, r1, 0
adds r4, r0, 0
adds r0, r4, 0
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8151574
thumb_func_start sub_81515B0
sub_81515B0: @ 81515B0
push {lr}

View File

@ -191,6 +191,7 @@ SECTIONS {
asm/battle_controller_linkpartner.o(.text);
src/battle_message.o(.text);
asm/cable_car.o(.text);
src/math_util.o(.text);
asm/math_util.o(.text);
asm/roulette_util.o(.text);
asm/cable_car_util.o(.text);

43
src/math_util.c Normal file
View File

@ -0,0 +1,43 @@
// Includes
#include "global.h"
// Static type declarations
// Static RAM declarations
// Static ROM declarations
// .rodata
// .text
s16 sub_8151534(s16 x, s16 y)
{
s32 result;
result = x;
result *= y;
result /= 256;
return result;
}
s16 sub_8151550(u8 s, s16 x, s16 y)
{
s32 result;
result = x;
result *= y;
result /= (1 << s);
return result;
}
s32 sub_8151574(s32 x, s32 y)
{
s64 result;
result = x;
result *= y;
result /= 256;
return result;
}