diff --git a/asm/link_rfu.s b/asm/link_rfu.s index d1cba6e7a..f8d6eddcd 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,250 +7,6 @@ @ file boundary? - thumb_func_start sub_800D888 -sub_800D888: @ 800D888 - push {r4-r7,lr} - adds r6, r0, 0 - adds r5, r1, 0 - ldr r1, =0x00000232 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0x27 - bhi _0800D920 - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r7, r0, 0 - movs r0, 0 - strh r0, [r1] - movs r2, 0 - ldrb r0, [r5] - cmp r0, 0 - bne _0800D8B8 -_0800D8AA: - adds r2, 0x1 - cmp r2, 0xD - bgt _0800D8B8 - adds r0, r5, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D8AA -_0800D8B8: - cmp r2, 0xE - beq _0800D910 - movs r2, 0 - movs r0, 0x8C - lsls r0, 2 - adds r3, r6, r0 -_0800D8C4: - ldrb r1, [r3] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r2, r0 - adds r0, r6, r0 - adds r1, r5, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xD - ble _0800D8C4 - movs r1, 0x8C - lsls r1, 2 - adds r4, r6, r1 - ldrb r0, [r4] - adds r0, 0x1 - ldrb r1, [r4] - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0x28 - bl __umodsi3 - ldrb r1, [r4] - strb r0, [r4] - ldr r0, =0x00000232 - adds r1, r6, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0 - adds r0, r5, 0 - adds r0, 0xD -_0800D908: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r5 - bge _0800D908 -_0800D910: - ldr r0, =0x04000208 - strh r7, [r0] - b _0800D92A - .pool -_0800D920: - ldr r1, =0x00000233 - adds r0, r6, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800D92A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D888 - - thumb_func_start sub_800D934 -sub_800D934: @ 800D934 - push {r4-r7,lr} - adds r3, r0, 0 - adds r4, r1, 0 - ldr r1, =0x04000208 - ldrh r0, [r1] - mov r12, r0 - movs r0, 0 - strh r0, [r1] - movs r1, 0x8C - lsls r1, 4 - adds r0, r3, r1 - ldr r7, =0x000008c1 - adds r5, r3, r7 - ldrb r1, [r0] - ldrb r0, [r5] - cmp r1, r0 - beq _0800D960 - ldr r1, =0x000008c3 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D984 -_0800D960: - movs r1, 0 - adds r0, r4, 0 - adds r0, 0x45 -_0800D966: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r4 - bge _0800D966 - ldr r0, =0x04000208 - mov r7, r12 - strh r7, [r0] - movs r0, 0 - b _0800D9CA - .pool -_0800D984: - movs r2, 0 - movs r6, 0x46 -_0800D988: - adds r1, r4, r2 - ldrb r0, [r5] - adds r7, r0, 0 - muls r7, r6 - adds r0, r7, 0 - adds r0, r2, r0 - adds r0, r3, r0 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x45 - ble _0800D988 - ldr r0, =0x000008c1 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1F - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r7, =0x000008c2 - adds r1, r3, r7 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x04000208 - mov r1, r12 - strh r1, [r0] - movs r0, 0x1 -_0800D9CA: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D934 - - thumb_func_start sub_800D9DC -sub_800D9DC: @ 800D9DC - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r1, 0x8C - lsls r1, 2 - adds r0, r5, r1 - adds r1, 0x1 - adds r4, r5, r1 - ldrb r1, [r0] - ldrb r0, [r4] - cmp r1, r0 - beq _0800DA00 - ldr r1, =0x00000233 - adds r0, r5, r1 - ldrb r0, [r0] - adds r2, r0, 0 - cmp r2, 0 - beq _0800DA08 -_0800DA00: - movs r0, 0 - b _0800DA54 - .pool -_0800DA08: - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r7, r0, 0 - strh r2, [r1] - movs r3, 0 -_0800DA12: - adds r2, r6, r3 - ldrb r1, [r4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r3, r0 - adds r0, r5, r0 - ldrb r0, [r0] - strb r0, [r2] - adds r3, 0x1 - cmp r3, 0xD - ble _0800DA12 - ldr r0, =0x00000231 - adds r4, r5, r0 - ldrb r0, [r4] - adds r0, 0x1 - ldrb r1, [r4] - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0x28 - bl __umodsi3 - ldrb r1, [r4] - strb r0, [r4] - ldr r0, =0x00000232 - adds r1, r5, r0 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x04000208 - strh r7, [r0] - movs r0, 0x1 -_0800DA54: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D9DC - thumb_func_start sub_800DA68 sub_800DA68: @ 800DA68 push {r4,lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index 7145c602d..e3ed18604 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -1509,3 +1509,90 @@ void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2) q1->unk_8c3 = 1; } } + +void sub_800D888(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2) +{ + int i; + u16 imeBak; + + if (q1->unk_232 < 40) + { + imeBak = REG_IME; + REG_IME = 0; + for (i = 0; i < 14; i++) + { + if (q2[i] != 0) + { + break; + } + } + if (i != 14) + { + for (i = 0; i < 14; i++) + { + q1->unk_00[q1->unk_230][i] = q2[i]; + } + q1->unk_230++; + q1->unk_230 %= 40; + q1->unk_232++; + for (i = 0; i < 14; i++) + { + q2[i] = 0; + } + } + REG_IME = imeBak; + } + else + { + q1->unk_233 = 1; + } +} + +bool8 sub_800D934(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2) +{ + u16 imeBak; + int i; + + imeBak = REG_IME; + REG_IME = 0; + if (q1->unk_8c0 == q1->unk_8c1 || q1->unk_8c3 != 0) + { + for (i = 0; i < 70; i++) + { + q2[i] = 0; + } + REG_IME = imeBak; + return FALSE; + } + for (i = 0; i < 70; i++) + { + q2[i] = q1->unk_00[q1->unk_8c1][i]; + } + q1->unk_8c1++; + q1->unk_8c1 %= 32; + q1->unk_8c2--; + REG_IME = imeBak; + return TRUE; +} + +bool8 sub_800D9DC(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2) +{ + int i; + u16 imeBak; + + if (q1->unk_230 == q1->unk_231 || q1->unk_233 != 0) + { + return FALSE; + } + imeBak = REG_IME; + REG_IME = 0; + for (i = 0; i < 14; i++) + { + q2[i] = q1->unk_00[q1->unk_231][i]; + } + q1->unk_231++; + q1->unk_231 %= 40; + q1->unk_232--; + REG_IME = imeBak; + return TRUE; +}