diff --git a/asm/unk_81BAD84.s b/asm/unk_81BAD84.s deleted file mode 100644 index 2a95feed49..0000000000 --- a/asm/unk_81BAD84.s +++ /dev/null @@ -1,57 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_81BAD84 -sub_81BAD84: @ 81BAD84 - push {r4-r6,lr} - movs r6, 0x80 - lsls r6, 19 - movs r2, 0 - strh r2, [r6] - ldr r1, =0x04000010 - strh r2, [r1] - adds r1, 0x2 - strh r2, [r1] - adds r1, 0x3E - strh r2, [r1] - ldr r5, =gUnknown_08617128 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 2 - adds r0, r4, r5 - ldr r0, [r0] - movs r1, 0xC0 - lsls r1, 19 - bl LZ77UnCompVram - adds r0, r5, 0x4 - adds r0, r4, r0 - ldr r0, [r0] - ldr r1, =0x0600f800 - bl LZ77UnCompVram - adds r5, 0x8 - adds r4, r5 - ldr r0, [r4] - movs r1, 0xA0 - lsls r1, 19 - movs r4, 0x80 - lsls r4, 1 - adds r2, r4, 0 - bl CpuSet - ldr r1, =0x04000008 - movs r2, 0xF8 - lsls r2, 5 - adds r0, r2, 0 - strh r0, [r1] - strh r4, [r6] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BAD84 - - - .align 2, 0 @ Don't pad with nop. diff --git a/ld_script.txt b/ld_script.txt index e9c810adcf..76125e9e26 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -251,7 +251,7 @@ SECTIONS { asm/battle_tent.o(.text); src/unk_text_util_2.o(.text); src/multiboot.o(.text); - asm/unk_81BAD84.o(.text); + src/unk_81BAD84.o(.text); src/battle_controller_player_partner.o(.text); asm/fldeff_groundshake.o(.text); asm/fossil_specials.o(.text); diff --git a/src/unk_81BAD84.c b/src/unk_81BAD84.c new file mode 100644 index 0000000000..43cb9a4b0c --- /dev/null +++ b/src/unk_81BAD84.c @@ -0,0 +1,20 @@ +#include "global.h" + +extern const struct { + const u8 *unk_0; + const u8 *unk_4; + const u8 *unk_8; +} gUnknown_08617128[]; + +void sub_81BAD84(u32 idx) +{ + REG_DISPCNT = 0x0000; + REG_BG0HOFS = 0x0000; + REG_BG0VOFS = 0x0000; + REG_BLDCNT = 0x0000; + LZ77UnCompVram(gUnknown_08617128[idx].unk_0, (void *)BG_CHAR_ADDR(0)); + LZ77UnCompVram(gUnknown_08617128[idx].unk_4, (void *)BG_SCREEN_ADDR(31)); + CpuCopy16(gUnknown_08617128[idx].unk_8, (void *)PLTT, 0x200); + REG_BG0CNT = 0x1f00; + REG_DISPCNT = DISPCNT_BG0_ON; +}