sub_800E88C

This commit is contained in:
PikalaxALT 2017-12-06 23:55:40 -05:00
parent dc0d544119
commit 4f342198c2
3 changed files with 47 additions and 110 deletions

View File

@ -5,115 +5,6 @@
.text
thumb_func_start sub_800E88C
sub_800E88C: @ 800E88C
push {r4-r7,lr}
adds r2, r0, 0
adds r5, r1, 0
movs r4, 0x1
adds r1, r2, 0
movs r6, 0
movs r0, 0x1
negs r0, r0
cmp r5, r0
bne _0800E8CC
movs r3, 0
movs r5, 0x1
ldr r1, =gUnknown_03005000+0xCDE
_0800E8A6:
adds r0, r2, 0
ands r0, r5
cmp r0, 0
beq _0800E8B8
adds r0, r3, r1
strb r4, [r0]
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
_0800E8B8:
asrs r2, 1
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x3
bls _0800E8A6
b _0800E942
.pool
_0800E8CC:
movs r3, 0
mvns r0, r1
mov r12, r0
movs r7, 0x1
ldr r4, =gUnknown_03005000+0xCDE
_0800E8D6:
adds r2, r1, 0
ands r2, r7
cmp r2, 0
bne _0800E8E2
adds r0, r3, r4
strb r2, [r0]
_0800E8E2:
asrs r1, 1
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x3
bls _0800E8D6
movs r4, 0x4
ldr r0, =gUnknown_03005000+0xCDE
ldrb r7, [r0]
_0800E8F4:
movs r3, 0
subs r1, r4, 0x1
cmp r7, r4
beq _0800E910
ldr r2, =gUnknown_03005000+0xCDE
_0800E8FE:
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x3
bhi _0800E910
adds r0, r3, r2
ldrb r0, [r0]
cmp r0, r4
bne _0800E8FE
_0800E910:
cmp r3, 0x4
bne _0800E916
adds r6, r4, 0
_0800E916:
lsls r0, r1, 24
lsrs r4, r0, 24
cmp r4, 0
bne _0800E8F4
mov r0, r12
ands r5, r0
movs r3, 0
movs r2, 0x1
ldr r1, =gUnknown_03005000+0xCDE
_0800E928:
adds r0, r5, 0
ands r0, r2
cmp r0, 0
beq _0800E936
adds r0, r3, r1
strb r6, [r0]
adds r6, 0x1
_0800E936:
asrs r5, 1
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x3
bls _0800E928
_0800E942:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_800E88C
thumb_func_start sub_800E94C
sub_800E94C: @ 800E94C
push {r4-r7,lr}

View File

@ -143,7 +143,9 @@ struct UnkRfuStruct_2 {
/* 0xc3c */ u8 filler_c3c[3];
/* 0xc3f */ u8 filler_c3f[0x9c];
/* 0xcdb */ vu8 unk_cdb;
/* 0xcdc */ u8 filler_cdc[0x18];
/* 0xcdc */ u8 filler_cdc[2];
/* 0xcde */ u8 unk_cde[4];
/* 0xce2 */ u8 filler_ce2[18];
}; // size = 0xcf4
// Exported RAM declarations

View File

@ -2523,3 +2523,47 @@ u8 sub_800E87C(u8 idx)
{
return gUnknown_082ED6A5[idx];
}
void sub_800E88C(int r2, int r5)
{
u8 i;
u8 r4 = 1;
int r1 = r2;
int r6 = 0;
if (r5 == -1)
{
for (i = 0; i < 4; r2 >>= 1, i++)
{
if (r2 & 1)
{
gUnknown_03005000.unk_cde[i] = r4;
r4++;
}
}
}
else
{
for (i = 0; i < 4; r1 >>= 1, i++)
{
if (!(r1 & 1))
{
gUnknown_03005000.unk_cde[i] = 0;
}
}
for (r4 = 4; r4 != 0; r4--)
{
for (i = 0; i < 4 && gUnknown_03005000.unk_cde[i] != r4; i++);
if (i == 4)
{
r6 = r4;
}
}
for (r5 &= ~r2, i = 0; i < 4; r5 >>= 1, i++)
{
if (r5 & 1)
{
gUnknown_03005000.unk_cde[i] = r6++;
}
}
}
}