From 20ed9ad0ac92cddcbfe66ccc9c2ae3cb1000ed71 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Sep 2017 21:19:29 -0400 Subject: [PATCH] Decompile asm/tileset.s into src/palette.c --- asm/tileset.s | 1785 --------------------------------------------- data/graphics.s | 14 +- data/palette.s | 18 - data/start_menu.s | 2 +- data/tileset.s | 3 + ld_script.txt | 3 +- src/palette.c | 880 +++++++++++++++++++++- src/scrcmd.c | 15 + sym_bss.txt | 28 +- sym_ewram.txt | 3 - 10 files changed, 891 insertions(+), 1860 deletions(-) delete mode 100644 data/palette.s create mode 100644 src/scrcmd.c diff --git a/asm/tileset.s b/asm/tileset.s index 0605c7621..2428f2984 100644 --- a/asm/tileset.s +++ b/asm/tileset.s @@ -5,1789 +5,4 @@ .text - thumb_func_start sub_80A0954 -@ void sub_80A0954() -sub_80A0954: @ 80A0954 - push {lr} - sub sp, 0x4 - ldr r1, =gUnknown_03000F34 - movs r0, 0 - strb r0, [r1] - movs r0, 0 - str r0, [sp] - ldr r1, =gUnknown_02037624 - ldr r2, =0x0500003c - mov r0, sp - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A0954 - - thumb_func_start sub_80A0980 -sub_80A0980: @ 80A0980 - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - lsls r2, 16 - lsrs r6, r2, 16 - ldr r3, =gUnknown_03000F34 - ldrb r0, [r3] - cmp r0, 0x13 - bhi _080A09C0 - ldr r2, =gUnknown_02037624 - adds r1, r0, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - str r4, [r0] - ldrb r1, [r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r2, 0x4 - adds r0, r1 - str r5, [r0] - ldrb r1, [r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r6, [r0, 0x8] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] -_080A09C0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A0980 - - thumb_func_start sub_80A09D0 -sub_80A09D0: @ 80A09D0 - push {r4-r6,lr} - movs r3, 0 - ldr r4, =gUnknown_03000F34 - adds r6, r4, 0 - ldrb r0, [r4] - cmp r3, r0 - bge _080A0A02 - ldr r2, =0x040000d4 - ldr r1, =gUnknown_02037624 - movs r5, 0x80 - lsls r5, 24 -_080A09E6: - ldr r0, [r1] - str r0, [r2] - ldr r0, [r1, 0x4] - str r0, [r2, 0x4] - ldrh r0, [r1, 0x8] - lsrs r0, 1 - orrs r0, r5 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - adds r1, 0xC - adds r3, 0x1 - ldrb r0, [r4] - cmp r3, r0 - blt _080A09E6 -_080A0A02: - movs r0, 0 - strb r0, [r6] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A09D0 - - thumb_func_start cur_mapheader_run_tileset_funcs_after_some_cpuset -cur_mapheader_run_tileset_funcs_after_some_cpuset: @ 80A0A18 - push {lr} - bl sub_80A0954 - bl cur_mapheader_run_tileset1_func - bl cur_mapheader_run_tileset2_func - pop {r0} - bx r0 - thumb_func_end cur_mapheader_run_tileset_funcs_after_some_cpuset - - thumb_func_start sub_80A0A2C -sub_80A0A2C: @ 80A0A2C - push {lr} - bl cur_mapheader_run_tileset2_func - pop {r0} - bx r0 - thumb_func_end sub_80A0A2C - - thumb_func_start sub_80A0A38 -sub_80A0A38: @ 80A0A38 - push {r4,lr} - bl sub_80A0954 - ldr r2, =gUnknown_03000F36 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - ldr r1, =gUnknown_03000F38 - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r1] - cmp r0, r1 - bcc _080A0A56 - movs r0, 0 - strh r0, [r2] -_080A0A56: - ldr r4, =gUnknown_03000F3A - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - ldr r1, =gUnknown_03000F3C - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r1] - cmp r0, r1 - bcc _080A0A6E - movs r0, 0 - strh r0, [r4] -_080A0A6E: - ldr r0, =gUnknown_03000F40 - ldr r1, [r0] - cmp r1, 0 - beq _080A0A7C - ldrh r0, [r2] - bl _call_via_r1 -_080A0A7C: - ldr r0, =gUnknown_03000F44 - ldr r1, [r0] - cmp r1, 0 - beq _080A0A8A - ldrh r0, [r4] - bl _call_via_r1 -_080A0A8A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A0A38 - - thumb_func_start cur_mapheader_run_tileset1_func -cur_mapheader_run_tileset1_func: @ 80A0AA8 - push {lr} - ldr r0, =gUnknown_03000F36 - movs r1, 0 - strh r1, [r0] - ldr r0, =gUnknown_03000F38 - strh r1, [r0] - ldr r1, =gUnknown_03000F40 - movs r0, 0 - str r0, [r1] - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0, 0x10] - cmp r0, 0 - beq _080A0ACE - ldr r0, [r0, 0x14] - cmp r0, 0 - beq _080A0ACE - bl _call_via_r0 -_080A0ACE: - pop {r0} - bx r0 - .pool - thumb_func_end cur_mapheader_run_tileset1_func - - thumb_func_start cur_mapheader_run_tileset2_func -cur_mapheader_run_tileset2_func: @ 80A0AE4 - push {lr} - ldr r0, =gUnknown_03000F3A - movs r1, 0 - strh r1, [r0] - ldr r0, =gUnknown_03000F3C - strh r1, [r0] - ldr r1, =gUnknown_03000F44 - movs r0, 0 - str r0, [r1] - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0, 0x14] - cmp r0, 0 - beq _080A0B0A - ldr r0, [r0, 0x14] - cmp r0, 0 - beq _080A0B0A - bl _call_via_r0 -_080A0B0A: - pop {r0} - bx r0 - .pool - thumb_func_end cur_mapheader_run_tileset2_func - - thumb_func_start TilesetCb_General -TilesetCb_General: @ 80A0B20 - ldr r1, =gUnknown_03000F36 - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F38 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F40 - ldr r0, =sub_80A0B70 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_General - - thumb_func_start TilesetCb_InsideBuilding -TilesetCb_InsideBuilding: @ 80A0B48 - ldr r1, =gUnknown_03000F36 - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F38 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F40 - ldr r0, =sub_80A0BB4 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_InsideBuilding - - thumb_func_start sub_80A0B70 -sub_80A0B70: @ 80A0B70 - push {r4,r5,lr} - lsls r5, r0, 16 - movs r0, 0xF0 - lsls r0, 12 - ands r0, r5 - lsrs r4, r0, 16 - cmp r4, 0 - bne _080A0B86 - lsrs r0, r5, 20 - bl sub_80A0BCC -_080A0B86: - cmp r4, 0x1 - bne _080A0B90 - lsrs r0, r5, 20 - bl sub_80A0BF4 -_080A0B90: - cmp r4, 0x2 - bne _080A0B9A - lsrs r0, r5, 20 - bl sub_80A0C1C -_080A0B9A: - cmp r4, 0x3 - bne _080A0BA4 - lsrs r0, r5, 20 - bl sub_80A0C44 -_080A0BA4: - cmp r4, 0x4 - bne _080A0BAE - lsrs r0, r5, 20 - bl sub_80A12AC -_080A0BAE: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A0B70 - - thumb_func_start sub_80A0BB4 -sub_80A0BB4: @ 80A0BB4 - push {lr} - lsls r1, r0, 16 - movs r0, 0xE0 - lsls r0, 11 - ands r0, r1 - cmp r0, 0 - bne _080A0BC8 - lsrs r0, r1, 19 - bl sub_80A1688 -_080A0BC8: - pop {r0} - bx r0 - thumb_func_end sub_80A0BB4 - - thumb_func_start sub_80A0BCC -sub_80A0BCC: @ 80A0BCC - push {lr} - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - ldr r0, =gUnknown_08510764 - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06003f80 - movs r2, 0x80 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A0BCC - - thumb_func_start sub_80A0BF4 -sub_80A0BF4: @ 80A0BF4 - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x7 - ands r0, r1 - ldr r1, =gUnknown_08512574 - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x06003600 - movs r2, 0xF0 - lsls r2, 2 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A0BF4 - - thumb_func_start sub_80A0C1C -sub_80A0C1C: @ 80A0C1C - push {lr} - lsls r0, 16 - movs r1, 0xE0 - lsls r1, 11 - ands r1, r0 - ldr r0, =gUnknown_08512E54 - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06003a00 - movs r2, 0xA0 - lsls r2, 1 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A0C1C - - thumb_func_start sub_80A0C44 -sub_80A0C44: @ 80A0C44 - push {lr} - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - ldr r0, =gUnknown_08513174 - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06003e00 - movs r2, 0xC0 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A0C44 - - thumb_func_start TilesetCb_Petalburg -TilesetCb_Petalburg: @ 80A0C6C - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Petalburg - - thumb_func_start TilesetCb_Rustboro -TilesetCb_Rustboro: @ 80A0C94 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A103C - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Rustboro - - thumb_func_start TilesetCb_Dewford -TilesetCb_Dewford: @ 80A0CC0 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A10B8 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Dewford - - thumb_func_start TilesetCb_Slateport -TilesetCb_Slateport: @ 80A0CEC - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A10D0 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Slateport - - thumb_func_start TilesetCb_Mauville -TilesetCb_Mauville: @ 80A0D18 - ldr r1, =gUnknown_03000F3A - ldr r0, =gUnknown_03000F36 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A10E8 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Mauville - - thumb_func_start TilesetCb_Lavaridge -TilesetCb_Lavaridge: @ 80A0D48 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A115C - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Lavaridge - - thumb_func_start TilesetCb_Fallarbor -TilesetCb_Fallarbor: @ 80A0D74 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Fallarbor - - thumb_func_start TilesetCb_Fortree -TilesetCb_Fortree: @ 80A0D9C - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Fortree - - thumb_func_start TilesetCb_Lilycove -TilesetCb_Lilycove: @ 80A0DC4 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Lilycove - - thumb_func_start TilesetCb_Mossdeep -TilesetCb_Mossdeep: @ 80A0DEC - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Mossdeep - - thumb_func_start TilesetCb_EverGrande -TilesetCb_EverGrande: @ 80A0E14 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A1188 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_EverGrande - - thumb_func_start TilesetCb_Pacifidlog -TilesetCb_Pacifidlog: @ 80A0E40 - ldr r1, =gUnknown_03000F3A - ldr r0, =gUnknown_03000F36 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A11FC - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Pacifidlog - - thumb_func_start TilesetCb_Sootopolis -TilesetCb_Sootopolis: @ 80A0E70 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A122C - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Sootopolis - - thumb_func_start TilesetCb_BattleFrontierOutsideWest -TilesetCb_BattleFrontierOutsideWest: @ 80A0E9C - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A127C - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_BattleFrontierOutsideWest - - thumb_func_start TilesetCb_BattleFrontierOutsideEast -TilesetCb_BattleFrontierOutsideEast: @ 80A0EC8 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A1294 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_BattleFrontierOutsideEast - - thumb_func_start TilesetCb_Underwater -TilesetCb_Underwater: @ 80A0EF4 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - movs r0, 0x80 - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A1244 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Underwater - - thumb_func_start TilesetCb_SootopolisGym -TilesetCb_SootopolisGym: @ 80A0F18 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - movs r0, 0xF0 - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A15D8 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_SootopolisGym - - thumb_func_start TilesetCb_Cave -TilesetCb_Cave: @ 80A0F3C - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A1260 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_Cave - - thumb_func_start TilesetCb_EliteFour -TilesetCb_EliteFour: @ 80A0F68 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - movs r0, 0x80 - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A15F0 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_EliteFour - - thumb_func_start TilesetCb_MauvilleGym -TilesetCb_MauvilleGym: @ 80A0F8C - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A15C0 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_MauvilleGym - - thumb_func_start TilesetCb_BikeShop -TilesetCb_BikeShop: @ 80A0FB8 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A161C - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_BikeShop - - thumb_func_start TilesetCb_BattlePyramid -TilesetCb_BattlePyramid: @ 80A0FE4 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A1634 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_BattlePyramid - - thumb_func_start TilesetCb_BattleDome -TilesetCb_BattleDome: @ 80A1010 - ldr r1, =gUnknown_03000F3A - movs r0, 0 - strh r0, [r1] - ldr r1, =gUnknown_03000F3C - ldr r0, =gUnknown_03000F38 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_03000F44 - ldr r0, =sub_80A1658 - str r0, [r1] - bx lr - .pool - thumb_func_end TilesetCb_BattleDome - - thumb_func_start sub_80A103C -sub_80A103C: @ 80A103C - push {r4-r6,lr} - lsls r5, r0, 16 - movs r0, 0xE0 - lsls r0, 11 - ands r0, r5 - lsrs r6, r0, 16 - cmp r6, 0 - bne _080A105C - lsrs r4, r5, 19 - adds r0, r4, 0 - movs r1, 0 - bl sub_80A1434 - adds r0, r4, 0 - bl sub_80A1470 -_080A105C: - cmp r6, 0x1 - bne _080A1068 - lsrs r0, r5, 19 - movs r1, 0x1 - bl sub_80A1434 -_080A1068: - cmp r6, 0x2 - bne _080A1074 - lsrs r0, r5, 19 - movs r1, 0x2 - bl sub_80A1434 -_080A1074: - cmp r6, 0x3 - bne _080A1080 - lsrs r0, r5, 19 - movs r1, 0x3 - bl sub_80A1434 -_080A1080: - cmp r6, 0x4 - bne _080A108C - lsrs r0, r5, 19 - movs r1, 0x4 - bl sub_80A1434 -_080A108C: - cmp r6, 0x5 - bne _080A1098 - lsrs r0, r5, 19 - movs r1, 0x5 - bl sub_80A1434 -_080A1098: - cmp r6, 0x6 - bne _080A10A4 - lsrs r0, r5, 19 - movs r1, 0x6 - bl sub_80A1434 -_080A10A4: - cmp r6, 0x7 - bne _080A10B0 - lsrs r0, r5, 19 - movs r1, 0x7 - bl sub_80A1434 -_080A10B0: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80A103C - - thumb_func_start sub_80A10B8 -sub_80A10B8: @ 80A10B8 - push {lr} - lsls r1, r0, 16 - movs r0, 0xE0 - lsls r0, 11 - ands r0, r1 - cmp r0, 0 - bne _080A10CC - lsrs r0, r1, 19 - bl sub_80A1520 -_080A10CC: - pop {r0} - bx r0 - thumb_func_end sub_80A10B8 - - thumb_func_start sub_80A10D0 -sub_80A10D0: @ 80A10D0 - push {lr} - lsls r1, r0, 16 - movs r0, 0xF0 - lsls r0, 12 - ands r0, r1 - cmp r0, 0 - bne _080A10E4 - lsrs r0, r1, 20 - bl sub_80A1598 -_080A10E4: - pop {r0} - bx r0 - thumb_func_end sub_80A10D0 - - thumb_func_start sub_80A10E8 -sub_80A10E8: @ 80A10E8 - push {r4,r5,lr} - lsls r4, r0, 16 - movs r0, 0xE0 - lsls r0, 11 - ands r0, r4 - lsrs r5, r0, 16 - cmp r5, 0 - bne _080A1100 - lsrs r0, r4, 19 - movs r1, 0 - bl sub_80A1394 -_080A1100: - cmp r5, 0x1 - bne _080A110C - lsrs r0, r4, 19 - movs r1, 0x1 - bl sub_80A1394 -_080A110C: - cmp r5, 0x2 - bne _080A1118 - lsrs r0, r4, 19 - movs r1, 0x2 - bl sub_80A1394 -_080A1118: - cmp r5, 0x3 - bne _080A1124 - lsrs r0, r4, 19 - movs r1, 0x3 - bl sub_80A1394 -_080A1124: - cmp r5, 0x4 - bne _080A1130 - lsrs r0, r4, 19 - movs r1, 0x4 - bl sub_80A1394 -_080A1130: - cmp r5, 0x5 - bne _080A113C - lsrs r0, r4, 19 - movs r1, 0x5 - bl sub_80A1394 -_080A113C: - cmp r5, 0x6 - bne _080A1148 - lsrs r0, r4, 19 - movs r1, 0x6 - bl sub_80A1394 -_080A1148: - cmp r5, 0x7 - bne _080A1154 - lsrs r0, r4, 19 - movs r1, 0x7 - bl sub_80A1394 -_080A1154: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A10E8 - - thumb_func_start sub_80A115C -sub_80A115C: @ 80A115C - push {r4,r5,lr} - lsls r4, r0, 16 - movs r0, 0xF0 - lsls r0, 12 - ands r0, r4 - lsrs r5, r0, 16 - cmp r5, 0 - bne _080A1176 - lsrs r0, r4, 20 - lsls r0, 24 - lsrs r0, 24 - bl sub_80A12D4 -_080A1176: - cmp r5, 0x1 - bne _080A1180 - lsrs r0, r4, 20 - bl sub_80A1498 -_080A1180: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A115C - - thumb_func_start sub_80A1188 -sub_80A1188: @ 80A1188 - push {r4,r5,lr} - lsls r4, r0, 16 - movs r0, 0xE0 - lsls r0, 11 - ands r0, r4 - lsrs r5, r0, 16 - cmp r5, 0 - bne _080A11A0 - lsrs r0, r4, 19 - movs r1, 0 - bl sub_80A14C0 -_080A11A0: - cmp r5, 0x1 - bne _080A11AC - lsrs r0, r4, 19 - movs r1, 0x1 - bl sub_80A14C0 -_080A11AC: - cmp r5, 0x2 - bne _080A11B8 - lsrs r0, r4, 19 - movs r1, 0x2 - bl sub_80A14C0 -_080A11B8: - cmp r5, 0x3 - bne _080A11C4 - lsrs r0, r4, 19 - movs r1, 0x3 - bl sub_80A14C0 -_080A11C4: - cmp r5, 0x4 - bne _080A11D0 - lsrs r0, r4, 19 - movs r1, 0x4 - bl sub_80A14C0 -_080A11D0: - cmp r5, 0x5 - bne _080A11DC - lsrs r0, r4, 19 - movs r1, 0x5 - bl sub_80A14C0 -_080A11DC: - cmp r5, 0x6 - bne _080A11E8 - lsrs r0, r4, 19 - movs r1, 0x6 - bl sub_80A14C0 -_080A11E8: - cmp r5, 0x7 - bne _080A11F4 - lsrs r0, r4, 19 - movs r1, 0x7 - bl sub_80A14C0 -_080A11F4: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A1188 - - thumb_func_start sub_80A11FC -sub_80A11FC: @ 80A11FC - push {r4,r5,lr} - lsls r4, r0, 16 - movs r0, 0xF0 - lsls r0, 12 - ands r0, r4 - lsrs r5, r0, 16 - cmp r5, 0 - bne _080A1216 - lsrs r0, r4, 20 - lsls r0, 24 - lsrs r0, 24 - bl sub_80A131C -_080A1216: - cmp r5, 0x1 - bne _080A1224 - lsrs r0, r4, 20 - lsls r0, 24 - lsrs r0, 24 - bl sub_80A136C -_080A1224: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A11FC - - thumb_func_start sub_80A122C -sub_80A122C: @ 80A122C - push {lr} - lsls r1, r0, 16 - movs r0, 0xF0 - lsls r0, 12 - ands r0, r1 - cmp r0, 0 - bne _080A1240 - lsrs r0, r1, 20 - bl sub_80A1798 -_080A1240: - pop {r0} - bx r0 - thumb_func_end sub_80A122C - - thumb_func_start sub_80A1244 -sub_80A1244: @ 80A1244 - push {lr} - lsls r1, r0, 16 - movs r0, 0xF0 - lsls r0, 12 - ands r0, r1 - cmp r0, 0 - bne _080A125C - lsrs r0, r1, 20 - lsls r0, 24 - lsrs r0, 24 - bl sub_80A1344 -_080A125C: - pop {r0} - bx r0 - thumb_func_end sub_80A1244 - - thumb_func_start sub_80A1260 -sub_80A1260: @ 80A1260 - push {lr} - lsls r1, r0, 16 - movs r0, 0xF0 - lsls r0, 12 - ands r0, r1 - lsrs r0, 16 - cmp r0, 0x1 - bne _080A1276 - lsrs r0, r1, 20 - bl sub_80A14F8 -_080A1276: - pop {r0} - bx r0 - thumb_func_end sub_80A1260 - - thumb_func_start sub_80A127C -sub_80A127C: @ 80A127C - push {lr} - lsls r1, r0, 16 - movs r0, 0xE0 - lsls r0, 11 - ands r0, r1 - cmp r0, 0 - bne _080A1290 - lsrs r0, r1, 19 - bl sub_80A1548 -_080A1290: - pop {r0} - bx r0 - thumb_func_end sub_80A127C - - thumb_func_start sub_80A1294 -sub_80A1294: @ 80A1294 - push {lr} - lsls r1, r0, 16 - movs r0, 0xE0 - lsls r0, 11 - ands r0, r1 - cmp r0, 0 - bne _080A12A8 - lsrs r0, r1, 19 - bl sub_80A1570 -_080A12A8: - pop {r0} - bx r0 - thumb_func_end sub_80A1294 - - thumb_func_start sub_80A12AC -sub_80A12AC: @ 80A12AC - push {lr} - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - ldr r0, =gUnknown_08513684 - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06003c00 - movs r2, 0xA0 - lsls r2, 1 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A12AC - - thumb_func_start sub_80A12D4 -sub_80A12D4: @ 80A12D4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x3 - ands r0, r4 - ldr r5, =gUnknown_08513894 - lsls r0, 2 - adds r0, r5 - ldr r0, [r0] - ldr r1, =0x06006400 - movs r2, 0x80 - bl sub_80A0980 - adds r1, r4, 0x2 - adds r0, r1, 0 - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 24 - lsrs r0, 22 - adds r0, r5 - ldr r0, [r0] - ldr r1, =0x06006480 - movs r2, 0x80 - bl sub_80A0980 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A12D4 - - thumb_func_start sub_80A131C -sub_80A131C: @ 80A131C - push {lr} - lsls r0, 24 - movs r1, 0xC0 - lsls r1, 18 - ands r1, r0 - ldr r0, =gUnknown_085143E4 - lsrs r1, 22 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06007a00 - movs r2, 0xF0 - lsls r2, 2 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A131C - - thumb_func_start sub_80A1344 -sub_80A1344: @ 80A1344 - push {lr} - lsls r0, 24 - movs r1, 0xC0 - lsls r1, 18 - ands r1, r0 - ldr r0, =gUnknown_085145F4 - lsrs r1, 22 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06007e00 - movs r2, 0x80 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1344 - - thumb_func_start sub_80A136C -sub_80A136C: @ 80A136C - push {lr} - lsls r0, 24 - movs r1, 0xE0 - lsls r1, 19 - ands r1, r0 - ldr r0, =gUnknown_08514E04 - lsrs r1, 22 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06007e00 - movs r2, 0x80 - lsls r2, 1 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A136C - - thumb_func_start sub_80A1394 -sub_80A1394: @ 80A1394 - push {r4-r6,lr} - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 24 - lsrs r6, r1, 24 - subs r0, r5, r6 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0xB - bhi _080A13F0 - adds r0, r5, 0 - movs r1, 0xC - bl __umodsi3 - adds r4, r0, 0 - lsls r4, 16 - ldr r0, =gUnknown_08515384 - lsrs r4, 14 - adds r0, r4, r0 - ldr r0, [r0] - ldr r1, =gUnknown_08515344 - lsls r5, r6, 2 - adds r1, r5, r1 - ldr r1, [r1] - movs r2, 0x80 - bl sub_80A0980 - ldr r0, =gUnknown_085153B4 - adds r4, r0 - ldr r0, [r4] - ldr r1, =gUnknown_08515364 - adds r5, r1 - ldr r1, [r5] - movs r2, 0x80 - bl sub_80A0980 - b _080A141C - .pool -_080A13F0: - movs r0, 0x3 - ands r5, r0 - ldr r0, =gUnknown_085153E4 - lsls r5, 2 - adds r0, r5, r0 - ldr r0, [r0] - ldr r1, =gUnknown_08515344 - lsls r4, r6, 2 - adds r1, r4, r1 - ldr r1, [r1] - movs r2, 0x80 - bl sub_80A0980 - ldr r0, =gUnknown_085153F4 - adds r5, r0 - ldr r0, [r5] - ldr r1, =gUnknown_08515364 - adds r4, r1 - ldr r1, [r4] - movs r2, 0x80 - bl sub_80A0980 -_080A141C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1394 - - thumb_func_start sub_80A1434 -sub_80A1434: @ 80A1434 - push {lr} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 24 - lsrs r3, r1, 24 - subs r0, r3 - lsls r0, 16 - movs r1, 0xE0 - lsls r1, 11 - ands r1, r0 - ldr r0, =gUnknown_08515824 - lsrs r1, 14 - adds r1, r0 - ldr r2, [r1] - cmp r2, 0 - beq _080A1464 - ldr r0, =gUnknown_08515804 - lsls r1, r3, 2 - adds r1, r0 - ldr r1, [r1] - adds r0, r2, 0 - movs r2, 0x80 - bl sub_80A0980 -_080A1464: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1434 - - thumb_func_start sub_80A1470 -sub_80A1470: @ 80A1470 - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - ldr r1, =gUnknown_08515964 - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x06007800 - movs r2, 0x80 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1470 - - thumb_func_start sub_80A1498 -sub_80A1498: @ 80A1498 - push {lr} - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - ldr r0, =gUnknown_08515D8C - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06005400 - movs r2, 0x80 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1498 - - thumb_func_start sub_80A14C0 -sub_80A14C0: @ 80A14C0 - push {lr} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 24 - lsrs r1, 24 - subs r0, r1 - lsls r0, 16 - movs r2, 0xE0 - lsls r2, 11 - ands r2, r0 - ldr r0, =gUnknown_085161DC - lsrs r2, 14 - adds r2, r0 - ldr r0, [r2] - ldr r2, =gUnknown_085161BC - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - movs r2, 0x80 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A14C0 - - thumb_func_start sub_80A14F8 -sub_80A14F8: @ 80A14F8 - push {lr} - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - ldr r0, =gUnknown_08515D8C - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06007400 - movs r2, 0x80 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A14F8 - - thumb_func_start sub_80A1520 -sub_80A1520: @ 80A1520 - push {lr} - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - ldr r0, =gUnknown_085164FC - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06005540 - movs r2, 0xC0 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1520 - - thumb_func_start sub_80A1548 -sub_80A1548: @ 80A1548 - push {lr} - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - ldr r0, =gUnknown_0851680C - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06005b40 - movs r2, 0xC0 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1548 - - thumb_func_start sub_80A1570 -sub_80A1570: @ 80A1570 - push {lr} - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - ldr r0, =gUnknown_08516B1C - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06005b40 - movs r2, 0xC0 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1570 - - thumb_func_start sub_80A1598 -sub_80A1598: @ 80A1598 - push {lr} - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - ldr r0, =gUnknown_08516D2C - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06005c00 - movs r2, 0x80 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1598 - - thumb_func_start sub_80A15C0 -sub_80A15C0: @ 80A15C0 - push {lr} - lsls r2, r0, 16 - lsrs r0, r2, 16 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080A15D4 - lsrs r0, r2, 17 - bl sub_80A1748 -_080A15D4: - pop {r0} - bx r0 - thumb_func_end sub_80A15C0 - - thumb_func_start sub_80A15D8 -sub_80A15D8: @ 80A15D8 - push {lr} - lsls r1, r0, 16 - movs r0, 0xE0 - lsls r0, 11 - ands r0, r1 - cmp r0, 0 - bne _080A15EC - lsrs r0, r1, 19 - bl sub_80A16B0 -_080A15EC: - pop {r0} - bx r0 - thumb_func_end sub_80A15D8 - - thumb_func_start sub_80A15F0 -sub_80A15F0: @ 80A15F0 - push {r4,r5,lr} - lsls r4, r0, 16 - lsrs r0, r4, 16 - adds r5, r0, 0 - movs r0, 0x3F - ands r0, r5 - cmp r0, 0x1 - bne _080A1606 - lsrs r0, r4, 22 - bl sub_80A1720 -_080A1606: - movs r0, 0x7 - ands r0, r5 - cmp r0, 0x1 - bne _080A1614 - lsrs r0, r4, 19 - bl sub_80A16F8 -_080A1614: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A15F0 - - thumb_func_start sub_80A161C -sub_80A161C: @ 80A161C - push {lr} - lsls r1, r0, 16 - movs r0, 0xC0 - lsls r0, 10 - ands r0, r1 - cmp r0, 0 - bne _080A1630 - lsrs r0, r1, 18 - bl sub_80A1770 -_080A1630: - pop {r0} - bx r0 - thumb_func_end sub_80A161C - - thumb_func_start sub_80A1634 -sub_80A1634: @ 80A1634 - push {r4,lr} - lsls r4, r0, 16 - movs r0, 0xE0 - lsls r0, 11 - ands r0, r4 - cmp r0, 0 - bne _080A1650 - lsrs r4, 19 - adds r0, r4, 0 - bl sub_80A17C0 - adds r0, r4, 0 - bl sub_80A17EC -_080A1650: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A1634 - - thumb_func_start sub_80A1658 -sub_80A1658: @ 80A1658 - push {lr} - lsls r1, r0, 16 - movs r0, 0xC0 - lsls r0, 10 - ands r0, r1 - cmp r0, 0 - bne _080A166C - lsrs r0, r1, 18 - bl sub_80A1818 -_080A166C: - pop {r0} - bx r0 - thumb_func_end sub_80A1658 - - thumb_func_start sub_80A1670 -sub_80A1670: @ 80A1670 - push {lr} - lsls r1, r0, 16 - movs r0, 0xC0 - lsls r0, 10 - ands r0, r1 - cmp r0, 0 - bne _080A1684 - lsrs r0, r1, 18 - bl sub_80A1884 -_080A1684: - pop {r0} - bx r0 - thumb_func_end sub_80A1670 - - thumb_func_start sub_80A1688 -sub_80A1688: @ 80A1688 - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - ldr r1, =gUnknown_08516E3C - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x06003e00 - movs r2, 0x80 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1688 - - thumb_func_start sub_80A16B0 -sub_80A16B0: @ 80A16B0 - push {r4,lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - adds r4, r0, 0 - lsls r4, 16 - ldr r0, =gUnknown_08517A44 - lsrs r4, 14 - adds r0, r4, r0 - ldr r0, [r0] - ldr r1, =0x06007e00 - movs r2, 0xC0 - lsls r2, 1 - bl sub_80A0980 - ldr r0, =gUnknown_08517A50 - adds r4, r0 - ldr r0, [r4] - ldr r1, =0x06007a00 - movs r2, 0xA0 - lsls r2, 2 - bl sub_80A0980 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A16B0 - - thumb_func_start sub_80A16F8 -sub_80A16F8: @ 80A16F8 - push {lr} - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - ldr r0, =gUnknown_08517BFC - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06007f00 - movs r2, 0x20 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A16F8 - - thumb_func_start sub_80A1720 -sub_80A1720: @ 80A1720 - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - ldr r1, =gUnknown_08517C0C - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x06007c00 - movs r2, 0x80 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1720 - - thumb_func_start sub_80A1748 -sub_80A1748: @ 80A1748 - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - ldr r1, =gUnknown_08518034 - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x06005200 - movs r2, 0x80 - lsls r2, 2 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1748 - - thumb_func_start sub_80A1770 -sub_80A1770: @ 80A1770 - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - ldr r1, =gUnknown_0851829C - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x06007e00 - movs r2, 0x90 - lsls r2, 1 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1770 - - thumb_func_start sub_80A1798 -sub_80A1798: @ 80A1798 - push {lr} - lsls r0, 16 - movs r1, 0xE0 - lsls r1, 11 - ands r1, r0 - ldr r0, =gUnknown_085202C4 - lsrs r1, 14 - adds r1, r0 - ldr r0, [r1] - ldr r1, =0x06005e00 - movs r2, 0xC0 - lsls r2, 4 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A1798 - - thumb_func_start sub_80A17C0 -sub_80A17C0: @ 80A17C0 - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 16 - ldr r1, =gUnknown_08524864 - lsrs r0, 14 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x060052e0 - movs r2, 0x80 - lsls r2, 1 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A17C0 - - thumb_func_start sub_80A17EC -sub_80A17EC: @ 80A17EC - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 16 - ldr r1, =gUnknown_08524870 - lsrs r0, 14 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x060050e0 - movs r2, 0x80 - lsls r2, 1 - bl sub_80A0980 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A17EC - .align 2, 0 @ Don't pad with nop. diff --git a/data/graphics.s b/data/graphics.s index 0fa256449..a64dc1332 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -354,7 +354,19 @@ gUnknown_08D85600:: @ 8D85600 .incbin "baserom.gba", 0xd85600, 0x20 gUnknown_08D85620:: @ 8D85620 - .incbin "baserom.gba", 0xd85620, 0xa8 + .incbin "baserom.gba", 0xd85620, 0x20 + +gUnknown_08D85640:: @ 8D85640 + .incbin "baserom.gba", 0xd85640, 0x20 + +gUnknown_08D85660:: @ 8D85660 + .incbin "baserom.gba", 0xd85660, 0x20 + +gUnknown_08D85680:: @ 8D85680 + .incbin "baserom.gba", 0xd85680, 0x20 + +gUnknown_08D856A0:: @ 8D856A0 + .incbin "baserom.gba", 0xd856a0, 0x28 gUnknown_08D856C8:: @ 8D856C8 .incbin "baserom.gba", 0xd856c8, 0xe0 diff --git a/data/palette.s b/data/palette.s deleted file mode 100644 index 2dbfed8d2..000000000 --- a/data/palette.s +++ /dev/null @@ -1,18 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - -gUnknown_0852487C:: @ 852487C - .incbin "baserom.gba", 0x52487c, 0x10 - -gDummyPaletteStructTemplate:: @ 852488C - .2byte 0xFFFF - .space 9 - .byte 0x20 - .space 4 - - .align 2 -gUnknown_0852489C:: @ 852489C - .incbin "baserom.gba", 0x52489c, 0x20 diff --git a/data/start_menu.s b/data/start_menu.s index eaba0b8e1..07e428d0d 100644 --- a/data/start_menu.s +++ b/data/start_menu.s @@ -26,4 +26,4 @@ gUnknown_085105AC:: @ 85105AC .incbin "baserom.gba", 0x5105ac, 0x10 gUnknown_085105BC:: @ 85105BC - .incbin "baserom.gba", 0x5105bc, 0x1a8 + .incbin "baserom.gba", 0x5105bc, 0x8 diff --git a/data/tileset.s b/data/tileset.s index 1221d8967..a69e53acf 100644 --- a/data/tileset.s +++ b/data/tileset.s @@ -4,6 +4,9 @@ .section .rodata .align 2, 0 +Unknown_085105C4:: + .incbin "baserom.gba", 0x5105C4, 0x1A0 + gUnknown_08510764:: @ 8510764 .incbin "baserom.gba", 0x510764, 0xb60 diff --git a/ld_script.txt b/ld_script.txt index c2f8af595..78d27eb7f 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -110,7 +110,6 @@ SECTIONS { asm/reset_rtc_screen.o(.text); src/start_menu.o(.text); asm/start_menu.o(.text); - asm/tileset.o(.text); src/palette.o(.text); src/sound.o(.text); asm/battle_anim.o(.text); @@ -357,7 +356,7 @@ SECTIONS { data/reset_rtc_screen.o(.rodata); data/start_menu.o(.rodata); data/tileset.o(.rodata); - data/palette.o(.rodata); + src/palette.o(.rodata); data/fanfares.o(.rodata); data/battle_anims.o(.rodata); data/title_screen.o(.rodata); diff --git a/src/palette.c b/src/palette.c index aa9a84e4c..4c09206ba 100644 --- a/src/palette.c +++ b/src/palette.c @@ -28,7 +28,7 @@ struct PaletteStructTemplate struct PaletteStruct { - struct PaletteStructTemplate *base; + const struct PaletteStructTemplate *base; u32 ps_field_4_0:1; u16 ps_field_4_1:1; u32 baseDestOffset:9; @@ -48,6 +48,11 @@ extern void _call_via_r1(u32 a1, void *a2); extern void BlendPalette(u16, u16, u8, u16); +static EWRAM_DATA struct { + const u16 *src; + u16 *dest; + u16 size; +} sTilesetDMA3TransferBuffer[20] = {0}; EWRAM_DATA u16 gPlttBufferUnfaded[0x200] = {0}; EWRAM_DATA u16 gPlttBufferFaded[0x200] = {0}; EWRAM_DATA struct PaletteStruct sPaletteStructs[0x10] = {0}; @@ -56,13 +61,72 @@ EWRAM_DATA u32 gFiller_2037FE0 = 0; EWRAM_DATA u32 sPlttBufferTransferPending = 0; EWRAM_DATA u8 gPaletteDecompressionBuffer[0x400] = {0}; -extern struct PaletteStructTemplate gDummyPaletteStructTemplate; -extern void *gUnknown_0852487C; -extern u8 gUnknown_0852489C[]; +extern const u16 *const gUnknown_08510764[]; +extern const u16 *const gUnknown_085112C4[]; +extern const u16 *const gUnknown_08511BCC[]; +extern const u16 *const gUnknown_08512574[]; +extern const u16 *const gUnknown_08512E54[]; +extern const u16 *const gUnknown_08513174[]; +extern const u16 *const gUnknown_08513684[]; +extern const u16 *const gUnknown_08513894[]; +extern const u16 *const gUnknown_085143E4[]; +extern const u16 *const gUnknown_085145F4[]; +extern const u16 *const gUnknown_08514E04[]; +extern u16 *const gUnknown_08515344[]; +extern u16 *const gUnknown_08515364[]; +extern const u16 *const gUnknown_08515384[]; +extern const u16 *const gUnknown_085153B4[]; +extern const u16 *const gUnknown_085153E4[]; +extern const u16 *const gUnknown_085153F4[]; +extern u16 *const gUnknown_08515804[]; +extern const u16 *const gUnknown_08515824[]; +extern const u16 *const gUnknown_08515964[]; +extern const u16 *const gUnknown_08515D8C[]; +extern u16 *const gUnknown_085161BC[]; +extern const u16 *const gUnknown_085161DC[]; +extern const u16 *const gUnknown_085164FC[]; +extern const u16 *const gUnknown_0851680C[]; +extern const u16 *const gUnknown_08516B1C[]; +extern const u16 *const gUnknown_08516D2C[]; +extern const u16 *const gUnknown_08516E3C[]; +extern const u16 *const gUnknown_08517A44[]; +extern const u16 *const gUnknown_08517A50[]; +extern const u16 *const gUnknown_08517BFC[]; +extern const u16 *const gUnknown_08517C0C[]; +extern const u16 *const gUnknown_08518034[]; +extern const u16 *const gUnknown_0851829C[]; +extern const u16 *const gUnknown_085202C4[]; +extern const u16 *const gUnknown_08524864[]; +extern const u16 *const gUnknown_08524870[]; -extern u16 gUnknown_03000F3C; -extern void *gUnknown_03000F44; +extern const u16 gUnknown_08D85640[]; +extern const u16 gUnknown_08D85660[]; +extern const u16 gUnknown_08D85680[]; +extern const u16 gUnknown_08D856A0[]; +static const u16 *const gUnknown_0852487C[] = { + gUnknown_08D85640, + gUnknown_08D85660, + gUnknown_08D85680, + gUnknown_08D856A0, +}; + +static const struct PaletteStructTemplate gDummyPaletteStructTemplate = { + .uid = 0xFFFF, + .pst_field_B_5 = 1 +}; +static const u8 gUnknown_0852489C[] = { + 0, 0, 0, 0, 0, + 5, 5, 5, 5, 5, + 11, 11, 11, 11, 11, + 16, 16, 16, 16, 16, + 21, 21, 21, 21, 21, + 27, 27, 27, 27, 27, + 31, 31 +}; + +void cur_mapheader_run_tileset1_func(void); +void cur_mapheader_run_tileset2_func(void); static void unused_sub_80A1CDC(struct PaletteStruct *, u32 *); static void unused_sub_80A1E40(struct PaletteStruct *, u32 *); static void unused_sub_80A1F00(struct PaletteStruct *); @@ -74,30 +138,798 @@ static u8 UpdateHardwarePaletteFade(void); static void UpdateBlendRegisters(void); static bool8 IsSoftwarePaletteFadeFinishing(void); +// tileset + +IWRAM_DATA u8 sTilesetDMA3TransferBufferSize; +IWRAM_DATA u16 sPrimaryTilesetCBCounter; +IWRAM_DATA u16 sPrimaryTilesetCBBufferSize; +IWRAM_DATA u16 sSecondaryTilesetCBCounter; +IWRAM_DATA u16 sSecondaryTilesetCBBufferSize; +IWRAM_DATA void (*sPrimaryTilesetCB)(u16); +IWRAM_DATA void (*sSecondaryTilesetCB)(u16); + +void sub_80A0954(void) +{ + sTilesetDMA3TransferBufferSize = 0; + CpuFill32(0, sTilesetDMA3TransferBuffer, sizeof sTilesetDMA3TransferBuffer); +} + +void sub_80A0980(const u16 *a0, u16 *a1, u16 a2) +{ + if (sTilesetDMA3TransferBufferSize < 20) + { + sTilesetDMA3TransferBuffer[sTilesetDMA3TransferBufferSize].src = a0; + sTilesetDMA3TransferBuffer[sTilesetDMA3TransferBufferSize].dest = a1; + sTilesetDMA3TransferBuffer[sTilesetDMA3TransferBufferSize].size = a2; + sTilesetDMA3TransferBufferSize ++; + } +} + +void sub_80A09D0(void) +{ + int i; + + for (i = 0; i < sTilesetDMA3TransferBufferSize; i ++) + { + DmaCopy16(3, sTilesetDMA3TransferBuffer[i].src, sTilesetDMA3TransferBuffer[i].dest, sTilesetDMA3TransferBuffer[i].size); + } + sTilesetDMA3TransferBufferSize = 0; +} + +void cur_mapheader_run_tileset_funcs_after_some_cpuset(void) +{ + sub_80A0954(); + cur_mapheader_run_tileset1_func(); + cur_mapheader_run_tileset2_func(); +} + +void sub_80A0A2C(void) +{ + cur_mapheader_run_tileset2_func(); +} + +void sub_80A0A38(void) +{ + sub_80A0954(); + if (++sPrimaryTilesetCBCounter >= sPrimaryTilesetCBBufferSize) + sPrimaryTilesetCBCounter = 0; + if (++sSecondaryTilesetCBCounter >= sSecondaryTilesetCBBufferSize) + sSecondaryTilesetCBCounter = 0; + if (sPrimaryTilesetCB) + sPrimaryTilesetCB(sPrimaryTilesetCBCounter); + if (sSecondaryTilesetCB) + sSecondaryTilesetCB(sSecondaryTilesetCBCounter); +} + +void cur_mapheader_run_tileset1_func(void) +{ + sPrimaryTilesetCBCounter = 0; + sPrimaryTilesetCBBufferSize = 0; + sPrimaryTilesetCB = NULL; + if (gMapHeader.mapData->primaryTileset && gMapHeader.mapData->primaryTileset->callback) + gMapHeader.mapData->primaryTileset->callback(); +} + +void cur_mapheader_run_tileset2_func(void) +{ + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = 0; + sSecondaryTilesetCB = NULL; + if (gMapHeader.mapData->secondaryTileset && gMapHeader.mapData->secondaryTileset->callback) + gMapHeader.mapData->secondaryTileset->callback(); +} + +void TilesetCb_General(void) +{ + void sub_80A0B70(u16); + + sPrimaryTilesetCBCounter = 0; + sPrimaryTilesetCBBufferSize = 0x100; + sPrimaryTilesetCB = sub_80A0B70; +} + +void TilesetCb_InsideBuilding(void) +{ + void sub_80A0BB4(u16); + + sPrimaryTilesetCBCounter = 0; + sPrimaryTilesetCBBufferSize = 0x100; + sPrimaryTilesetCB = sub_80A0BB4; +} + +void sub_80A0B70(u16 timer) +{ + void sub_80A0BCC(u16); + void sub_80A0BF4(u16); + void sub_80A0C1C(u16); + void sub_80A0C44(u16); + void sub_80A12AC(u16); + + if ((timer & 0x0F) == 0) + sub_80A0BCC(timer >> 4); + if ((timer & 0x0F) == 1) + sub_80A0BF4(timer >> 4); + if ((timer & 0x0F) == 2) + sub_80A0C1C(timer >> 4); + if ((timer & 0x0F) == 3) + sub_80A0C44(timer >> 4); + if ((timer & 0x0F) == 4) + sub_80A12AC(timer >> 4); +} + +void sub_80A0BB4(u16 timer) +{ + void sub_80A1688(u16); + if ((timer & 0x7) == 0) + sub_80A1688(timer >> 3); +} + +void sub_80A0BCC(u16 timer) +{ + u16 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_08510764[idx], (u16 *)(VRAM + 0x3F80), 0x80); +} + +void sub_80A0BF4(u16 timer) +{ + u8 idx; + + idx = timer % 8; + sub_80A0980(gUnknown_08512574[idx], (u16 *)(VRAM + 0x3600), 0x3C0); +} + +void sub_80A0C1C(u16 timer) +{ + u16 idx; + + idx = timer % 8; + sub_80A0980(gUnknown_08512E54[idx], (u16 *)(VRAM + 0x3a00), 0x140); +} + +void sub_80A0C44(u16 timer) +{ + u16 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_08513174[idx], (u16 *)(VRAM + 0x3e00), 0xc0); +} + +void TilesetCb_Petalburg(void) +{ + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = NULL; +} + +void TilesetCb_Rustboro(void) +{ + void sub_80A103C(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A103C; +} + +void TilesetCb_Dewford(void) +{ + void sub_80A10B8(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A10B8; +} + +void TilesetCb_Slateport(void) +{ + void sub_80A10D0(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A10D0; +} + +void TilesetCb_Mauville(void) +{ + void sub_80A10E8(u16); + + sSecondaryTilesetCBCounter = sPrimaryTilesetCBCounter; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A10E8; +} + +void TilesetCb_Lavaridge(void) +{ + void sub_80A115C(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A115C; +} + +void TilesetCb_Fallarbor(void) +{ + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = NULL; +} + +void TilesetCb_Fortree(void) +{ + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = NULL; +} + +void TilesetCb_Lilycove(void) +{ + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = NULL; +} + +void TilesetCb_Mossdeep(void) +{ + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = NULL; +} + +void TilesetCb_EverGrande(void) +{ + void sub_80A1188(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A1188; +} + +void TilesetCb_Pacifidlog(void) +{ + void sub_80A11FC(u16); + + sSecondaryTilesetCBCounter = sPrimaryTilesetCBCounter; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A11FC; +} + +void TilesetCb_Sootopolis(void) +{ + void sub_80A122C(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A122C; +} + +void TilesetCb_BattleFrontierOutsideWest(void) +{ + void sub_80A127C(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A127C; +} + +void TilesetCb_BattleFrontierOutsideEast(void) +{ + void sub_80A1294(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A1294; +} + +void TilesetCb_Underwater(void) +{ + void sub_80A1244(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = 128; + sSecondaryTilesetCB = sub_80A1244; +} + +void TilesetCb_SootopolisGym(void) +{ + void sub_80A15D8(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = 240; + sSecondaryTilesetCB = sub_80A15D8; +} + +void TilesetCb_Cave(void) +{ + void sub_80A1260(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A1260; +} + +void TilesetCb_EliteFour(void) +{ + void sub_80A15F0(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = 128; + sSecondaryTilesetCB = sub_80A15F0; +} + +void TilesetCb_MauvilleGym(void) +{ + void sub_80A15C0(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A15C0; +} + +void TilesetCb_BikeShop(void) +{ + void sub_80A161C(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A161C; +} + +void TilesetCb_BattlePyramid(void) +{ + void sub_80A1634(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A1634; +} + +void TilesetCb_BattleDome(void) +{ + void sub_80A1658(u16); + + sSecondaryTilesetCBCounter = 0; + sSecondaryTilesetCBBufferSize = sPrimaryTilesetCBBufferSize; + sSecondaryTilesetCB = sub_80A1658; +} + +void sub_80A103C(u16 timer) +{ + void sub_80A1434(u16, u8); + void sub_80A1470(u16); + + if ((timer & 0x07) == 0) + { + sub_80A1434(timer >> 3, 0); + sub_80A1470(timer >> 3); + } + if ((timer & 0x07) == 1) + sub_80A1434(timer >> 3, 1); + if ((timer & 0x07) == 2) + sub_80A1434(timer >> 3, 2); + if ((timer & 0x07) == 3) + sub_80A1434(timer >> 3, 3); + if ((timer & 0x07) == 4) + sub_80A1434(timer >> 3, 4); + if ((timer & 0x07) == 5) + sub_80A1434(timer >> 3, 5); + if ((timer & 0x07) == 6) + sub_80A1434(timer >> 3, 6); + if ((timer & 0x07) == 7) + sub_80A1434(timer >> 3, 7); +} + +void sub_80A10B8(u16 timer) +{ + void sub_80A1520(u16); + + if ((timer & 7) == 0) + sub_80A1520(timer >> 3); +} + +void sub_80A10D0(u16 timer) +{ + void sub_80A1598(u16); + + if ((timer & 15) == 0) + sub_80A1598(timer >> 4); +} + +void sub_80A10E8(u16 timer) +{ + void sub_80A1394(u16, u8); + + if ((timer & 0x07) == 0) + sub_80A1394(timer >> 3, 0); + if ((timer & 0x07) == 1) + sub_80A1394(timer >> 3, 1); + if ((timer & 0x07) == 2) + sub_80A1394(timer >> 3, 2); + if ((timer & 0x07) == 3) + sub_80A1394(timer >> 3, 3); + if ((timer & 0x07) == 4) + sub_80A1394(timer >> 3, 4); + if ((timer & 0x07) == 5) + sub_80A1394(timer >> 3, 5); + if ((timer & 0x07) == 6) + sub_80A1394(timer >> 3, 6); + if ((timer & 0x07) == 7) + sub_80A1394(timer >> 3, 7); +} + +void sub_80A115C(u16 timer) +{ + void sub_80A12D4(u8); + void sub_80A1498(u16); + + if ((timer & 0x0F) == 0) + sub_80A12D4(timer >> 4); + if ((timer & 0x0F) == 1) + sub_80A1498(timer >> 4); +} + +void sub_80A1188(u16 timer) +{ + void sub_80A14C0(u16, u8); + + if ((timer & 0x07) == 0) + sub_80A14C0(timer >> 3, 0); + if ((timer & 0x07) == 1) + sub_80A14C0(timer >> 3, 1); + if ((timer & 0x07) == 2) + sub_80A14C0(timer >> 3, 2); + if ((timer & 0x07) == 3) + sub_80A14C0(timer >> 3, 3); + if ((timer & 0x07) == 4) + sub_80A14C0(timer >> 3, 4); + if ((timer & 0x07) == 5) + sub_80A14C0(timer >> 3, 5); + if ((timer & 0x07) == 6) + sub_80A14C0(timer >> 3, 6); + if ((timer & 0x07) == 7) + sub_80A14C0(timer >> 3, 7); +} + +void sub_80A11FC(u16 timer) +{ + void sub_80A131C(u8); + void sub_80A136C(u8); + + if ((timer & 0x0F) == 0) + sub_80A131C(timer >> 4); + if ((timer & 0x0F) == 1) + sub_80A136C(timer >> 4); +} + +void sub_80A122C(u16 timer) +{ + void sub_80A1798(u16); + + if ((timer & 0x0F) == 0) + sub_80A1798(timer >> 4); +} + +void sub_80A1244(u16 timer) +{ + void sub_80A1344(u8); + + if ((timer & 0x0F) == 0) + sub_80A1344(timer >> 4); +} + +void sub_80A1260(u16 timer) +{ + void sub_80A14F8(u16); + + if ((timer & 0x0F) == 1) + sub_80A14F8(timer >> 4); +} + +void sub_80A127C(u16 timer) +{ + void sub_80A1548(u16); + + if ((timer & 0x07) == 0) + sub_80A1548(timer >> 3); +} + +void sub_80A1294(u16 timer) +{ + void sub_80A1570(u16); + + if ((timer & 0x07) == 0) + sub_80A1570(timer >> 3); +} + +void sub_80A12AC(u16 timer) +{ + u16 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_08513684[idx], (u16 *)(VRAM + 0x3c00), 0x140); +} + +void sub_80A12D4(u8 timer) +{ + u8 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_08513894[idx], (u16 *)(VRAM + 0x6400), 0x80); + + idx = (timer + 2) % 4; + sub_80A0980(gUnknown_08513894[idx], (u16 *)(VRAM + 0x6480), 0x80); +} + +void sub_80A131C(u8 timer) +{ + u8 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_085143E4[idx], (u16 *)(VRAM + 0x7a00), 0x3C0); +} + +void sub_80A1344(u8 timer) +{ + u8 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_085145F4[idx], (u16 *)(VRAM + 0x7e00), 0x80); +} + +void sub_80A136C(u8 timer) +{ + u8 idx; + + idx = timer % 8; + sub_80A0980(gUnknown_08514E04[idx], (u16 *)(VRAM + 0x7e00), 0x100); +} + +void sub_80A1394(u16 timer_div, u8 timer_mod) +{ + timer_div -= timer_mod; + if (timer_div < 12) // almost certainly a typo + { + timer_div %= 12; + sub_80A0980(gUnknown_08515384[timer_div], gUnknown_08515344[timer_mod], 0x80); + sub_80A0980(gUnknown_085153B4[timer_div], gUnknown_08515364[timer_mod], 0x80); + } + else + { + timer_div &= 3; + sub_80A0980(gUnknown_085153E4[timer_div], gUnknown_08515344[timer_mod], 0x80); + sub_80A0980(gUnknown_085153F4[timer_div], gUnknown_08515364[timer_mod], 0x80); + } +} + +void sub_80A1434(u16 timer_div, u8 timer_mod) +{ + timer_div -= timer_mod; + timer_div &= 0x7; + if (gUnknown_08515824[timer_div]) + sub_80A0980(gUnknown_08515824[timer_div], gUnknown_08515804[timer_mod], 0x80); +} + +void sub_80A1470(u16 timer) +{ + u16 idx; + + idx = timer % 2; + sub_80A0980(gUnknown_08515964[idx], (u16 *)(VRAM + 0x7800), 0x80); +} + +void sub_80A1498(u16 timer) +{ + u16 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_08515D8C[idx], (u16 *)(VRAM + 0x5400), 0x80); +} + +void sub_80A14C0(u16 timer_div, u8 timer_mod) +{ + timer_div -= timer_mod; + timer_div &= 7; + + sub_80A0980(gUnknown_085161DC[timer_div], gUnknown_085161BC[timer_mod], 0x80); +} + +void sub_80A14F8(u16 timer) +{ + u16 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_08515D8C[idx], (u16 *)(VRAM + 0x7400), 0x80); +} + +void sub_80A1520(u16 timer) +{ + u16 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_085164FC[idx], (u16 *)(VRAM + 0x5540), 0xC0); +} + +void sub_80A1548(u16 timer) +{ + u16 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_0851680C[idx], (u16 *)(VRAM + 0x5b40), 0xC0); +} + +void sub_80A1570(u16 timer) +{ + u16 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_08516B1C[idx], (u16 *)(VRAM + 0x5b40), 0xC0); +} + +void sub_80A1598(u16 timer) +{ + u16 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_08516D2C[idx], (u16 *)(VRAM + 0x5c00), 0x80); +} + +void sub_80A15C0(u16 timer) +{ + void sub_80A1748(u16); + + if ((timer & 1) == 0) + sub_80A1748(timer >> 1); +} + +void sub_80A15D8(u16 timer) +{ + void sub_80A16B0(u16); + + if ((timer & 7) == 0) + sub_80A16B0(timer >> 3); +} + +void sub_80A15F0(u16 timer) +{ + void sub_80A1720(u16); + void sub_80A16F8(u16); + + if ((timer & 0x3f) == 1) + sub_80A1720(timer >> 6); + if ((timer & 0x07) == 1) + sub_80A16F8(timer >> 3); +} +void sub_80A161C(u16 timer) +{ + void sub_80A1770(u16); + + if ((timer & 3) == 0) + sub_80A1770(timer >> 2); +} + +void sub_80A1634(u16 timer) +{ + void sub_80A17C0(u16); + void sub_80A17EC(u16); + + if ((timer & 7) == 0) + { + sub_80A17C0(timer >> 3); + sub_80A17EC(timer >> 3); + } +} + +void sub_80A1658(u16 timer) +{ + void sub_80A1818(u16); + + if ((timer & 3) == 0) + sub_80A1818(timer >> 2); +} + +void sub_80A1670(u16 timer) +{ + void sub_80A1884(u16); + + if ((timer & 3) == 0) + sub_80A1884(timer >> 2); +} + +void sub_80A1688(u16 timer) +{ + u16 idx; + + idx = timer % 2; + sub_80A0980(gUnknown_08516E3C[idx], (u16 *)(VRAM + 0x3e00), 0x80); +} + +void sub_80A16B0(u16 timer) +{ + u16 idx; + + idx = timer % 3; + sub_80A0980(gUnknown_08517A44[idx], (u16 *)(VRAM + 0x7e00), 0x180); + sub_80A0980(gUnknown_08517A50[idx], (u16 *)(VRAM + 0x7a00), 0x280); +} + +void sub_80A16F8(u16 timer) +{ + u16 idx; + + idx = timer % 4; + sub_80A0980(gUnknown_08517BFC[idx], (u16 *)(VRAM + 0x7f00), 0x20); +} + +void sub_80A1720(u16 timer) +{ + u16 idx; + + idx = timer % 2; + sub_80A0980(gUnknown_08517C0C[idx], (u16 *)(VRAM + 0x7c00), 0x80); +} + +void sub_80A1748(u16 timer) +{ + u16 idx; + + idx = timer % 2; + sub_80A0980(gUnknown_08518034[idx], (u16 *)(VRAM + 0x5200), 0x200); +} + +void sub_80A1770(u16 timer) +{ + u16 idx; + + idx = timer % 2; + sub_80A0980(gUnknown_0851829C[idx], (u16 *)(VRAM + 0x7e00), 0x120); +} + +void sub_80A1798(u16 timer) +{ + u16 idx; + + idx = timer % 8; + sub_80A0980(gUnknown_085202C4[idx], (u16 *)(VRAM + 0x5e00), 0xc00); +} + +void sub_80A17C0(u16 timer) +{ + u16 idx; + + idx = timer % 3; + sub_80A0980(gUnknown_08524864[idx], (u16 *)(VRAM + 0x52e0), 0x100); +} + +void sub_80A17EC(u16 timer) +{ + u16 idx; + + idx = timer % 3; + sub_80A0980(gUnknown_08524870[idx], (u16 *)(VRAM + 0x50e0), 0x100); +} + +// palette + void sub_80A1818(u16 a1) { - void **v1 = &gUnknown_0852487C; - CpuSet(v1[a1 & 0x3], gPlttBufferUnfaded + 0x80, 0x10); - BlendPalette(0x80, 0x10, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); - if ((u8)FindTaskIdByFunc(sub_8149DFC) != 0xFF ) - { - gUnknown_03000F44 = sub_80A1670; - gUnknown_03000F3C = 0x20; - } - return; + CpuCopy16(gUnknown_0852487C[a1 & 0x3], gPlttBufferUnfaded + 0x80, 32); + BlendPalette(0x80, 0x10, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); + if ((u8)FindTaskIdByFunc(sub_8149DFC) != 0xFF ) + { + sSecondaryTilesetCB = sub_80A1670; + sSecondaryTilesetCBBufferSize = 0x20; + } } void sub_80A1884(u16 a1) { - void **v1 = &gUnknown_0852487C; - CpuSet(v1[a1 & 0x3], gPlttBufferUnfaded + 0x80, 0x10); - if ((u8)FindTaskIdByFunc(sub_8149DFC) == 0xFF ) - { - BlendPalette(0x80, 0x10, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); - if (!--gUnknown_03000F3C) - gUnknown_03000F44 = 0; - } - return; + CpuCopy16(gUnknown_0852487C[a1 & 0x3], gPlttBufferUnfaded + 0x80, 32); + if ((u8)FindTaskIdByFunc(sub_8149DFC) == 0xFF ) + { + BlendPalette(0x80, 0x10, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); + if (!--sSecondaryTilesetCBBufferSize) + sSecondaryTilesetCB = NULL; + } } void LoadCompressedPalette(const void *src, u16 offset, u16 size) diff --git a/src/scrcmd.c b/src/scrcmd.c new file mode 100644 index 000000000..b56a53caf --- /dev/null +++ b/src/scrcmd.c @@ -0,0 +1,15 @@ + +// Includes +#include "global.h" + +// Static type declarations + +// Static RAM declarations + +IWRAM_DATA u8 gUnknown_03000F30; + +// Static ROM declarations + +// .rodata + +// .text diff --git a/sym_bss.txt b/sym_bss.txt index c81ce12be..16f14da51 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -16,32 +16,8 @@ gUnknown_03000000: @ 3000000 .include "src/rom4.o" .include "src/field_camera.o" .include "src/script.o" - -.align 2 -gUnknown_03000F30: @ 3000F30 - .space 0x4 - -gUnknown_03000F34: @ 3000F34 - .space 0x2 - -gUnknown_03000F36: @ 3000F36 - .space 0x2 - -gUnknown_03000F38: @ 3000F38 - .space 0x2 - -gUnknown_03000F3A: @ 3000F3A - .space 0x2 - -gUnknown_03000F3C: @ 3000F3C - .space 0x4 - -gUnknown_03000F40: @ 3000F40 - .space 0x4 - -gUnknown_03000F44: @ 3000F44 - .space 0x4 - + .include "src/scrcmd.o" + .include "src/palette.o" .include "src/sound.o" gUnknown_03000F50: @ 3000F50 diff --git a/sym_ewram.txt b/sym_ewram.txt index e49b94160..8549f1679 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -747,9 +747,6 @@ gUnknown_02037621: @ 2037621 gUnknown_02037622: @ 2037622 .space 0x2 -gUnknown_02037624: @ 2037624 - .space 0xF0 - .include "src/palette.o" .include "src/sound.o"