From 0c53d4011fc15d7d6f4f5eec81b1d46be0a666bb Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 18 Dec 2024 11:28:07 +0100 Subject: [PATCH 1/3] start iwram init --- Makefile | 8 +++++++- asm/code_8272724.s | 3 --- include/gba/defines.h | 2 ++ ld_script.txt | 20 +++++++++++++++++--- src/code_80001DC.c | 2 +- src/code_80035F0.c | 4 ++++ src/code_8023144.c | 2 +- src/code_8023868.c | 2 +- src/code_809A560.c | 2 +- src/code_809C5C4.c | 2 +- src/ground_effect.c | 3 +++ src/ground_event.c | 3 +++ src/ground_lives.c | 4 ++++ src/ground_map.c | 4 ++-- src/ground_map_2.c | 4 ++-- src/ground_object.c | 3 +++ src/ground_sprite.c | 2 +- sym_iwram.txt | 38 -------------------------------------- sym_iwram_2.txt | 14 ++++++++++++++ sym_iwram_init.txt | 16 ++++++++++++++++ 20 files changed, 83 insertions(+), 55 deletions(-) create mode 100644 src/code_80035F0.c create mode 100644 src/ground_effect.c create mode 100644 src/ground_event.c create mode 100644 src/ground_lives.c create mode 100644 src/ground_object.c create mode 100644 sym_iwram_2.txt create mode 100644 sym_iwram_init.txt diff --git a/Makefile b/Makefile index 96ed5a0f1..aed3690d2 100755 --- a/Makefile +++ b/Makefile @@ -261,11 +261,17 @@ $(BUILD_DIR)/sym_ewram.ld: sym_ewram.txt $(BUILD_DIR)/sym_iwram.ld: sym_iwram.txt $(RAMSCRGEN) iwram_data $< ENGLISH > $@ + +$(BUILD_DIR)/sym_iwram_2.ld: sym_iwram_2.txt + $(RAMSCRGEN) iwram_data_2 $< ENGLISH > $@ $(BUILD_DIR)/sym_ewram_init.ld: sym_ewram_init.txt $(RAMSCRGEN) ewram_init $< ENGLISH > $@ + +$(BUILD_DIR)/sym_iwram_init.ld: sym_iwram_init.txt + $(RAMSCRGEN) iwram_init $< ENGLISH > $@ -$(LD_SCRIPT): ld_script.txt $(BUILD_DIR)/sym_ewram.ld $(BUILD_DIR)/sym_ewram_init.ld $(BUILD_DIR)/sym_iwram.ld +$(LD_SCRIPT): ld_script.txt $(BUILD_DIR)/sym_ewram.ld $(BUILD_DIR)/sym_ewram_init.ld $(BUILD_DIR)/sym_iwram.ld $(BUILD_DIR)/sym_iwram_2.ld $(BUILD_DIR)/sym_iwram_init.ld cd $(BUILD_DIR) && sed -e "s#tools/#../../tools/#g" ../../ld_script.txt >ld_script.ld $(ELF): $(LD_SCRIPT) $(ALL_OBJECTS) $(LIBC) libagbsyscall tools diff --git a/asm/code_8272724.s b/asm/code_8272724.s index b1dd9d491..9df41ac75 100644 --- a/asm/code_8272724.s +++ b/asm/code_8272724.s @@ -3,9 +3,6 @@ .syntax unified - .section .rodata - - .space 0x3C .text diff --git a/include/gba/defines.h b/include/gba/defines.h index 557c4ed00..63eedb947 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -7,9 +7,11 @@ #define FALSE 0 #define IWRAM_DATA __attribute__((section("iwram_data"))) +#define IWRAM_DATA_2 __attribute__((section("iwram_data_2"))) #define EWRAM_DATA __attribute__((section("ewram_data"))) #define EWRAM_LIB __attribute__((section("ewram_lib"))) // Used only for agb flash and m4a #define EWRAM_INIT __attribute__((section("ewram_init"))) +#define IWRAM_INIT __attribute__((section("iwram_init"))) #define UNUSED __attribute__((unused)) #define NAKED __attribute__((naked)) diff --git a/ld_script.txt b/ld_script.txt index c1b64ce3d..9332833b2 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -37,7 +37,6 @@ SECTIONS { { iwram_start = .; INCLUDE "sym_iwram.ld" - . = 0x8000; } > IWRAM /* BEGIN ROM DATA */ @@ -342,10 +341,14 @@ SECTIONS { src/ground_sprite.o(.text); asm/ground_sprite.o(.text); src/code_80A7714.o(.text); + src/ground_lives.o(.text); asm/ground_lives.o(.text); + src/ground_object.o(.text); asm/ground_object.o(.text); + src/ground_effect.o(.text); asm/ground_effect.o(.text); src/ground_link.o(.text); + src/ground_event.o(.text); asm/ground_event.o(.text); src/m4a_1.o(.text); src/m4a.o(.text); @@ -741,15 +744,26 @@ SECTIONS { EWRAM_INIT_ROM_START = LOADADDR(ewram_init); + iwram_init : + ALIGN(4) + { + INCLUDE "sym_iwram_init.ld" + } > IWRAM AT>ROM + + unk_code = LOADADDR(iwram_init); unk_code_section : ALIGN(4) { - unk_code = .; - asm/code_8272724.o(.rodata); src/code_8272724.o(.text); asm/code_8272724.o(.text); unk_code_end = .; } > ROM =0 + + iwram_data_2 (NOLOAD) : + ALIGN(4) + { + INCLUDE "sym_iwram_2.ld" + } > IWRAM unk_code_section_size = (unk_code_end - unk_code); unk_code_ram_end = unk_code_ram + unk_code_section_size; diff --git a/src/code_80001DC.c b/src/code_80001DC.c index 5b4068230..3e89e6888 100644 --- a/src/code_80001DC.c +++ b/src/code_80001DC.c @@ -1,6 +1,6 @@ #include "global.h" -IWRAM_DATA u32 gUnknown_3004000 = {0}; +IWRAM_DATA_2 u32 gUnknown_3004000 = {0}; // unused, returns stack pointer u32 sub_80001DC() { diff --git a/src/code_80035F0.c b/src/code_80035F0.c new file mode 100644 index 000000000..d521f7d86 --- /dev/null +++ b/src/code_80035F0.c @@ -0,0 +1,4 @@ +#include "global.h" + +IWRAM_INIT u16 gUnknown_3001B58 = 0; +IWRAM_INIT u16 gUnknown_3001B5A = 0; diff --git a/src/code_8023144.c b/src/code_8023144.c index 3ffd6fdff..81dfb5e1c 100644 --- a/src/code_8023144.c +++ b/src/code_8023144.c @@ -21,7 +21,7 @@ EWRAM_INIT s32 gUnknown_203B2A4 = 1; EWRAM_INIT u16 gUnknown_203B2A8 = 0; EWRAM_INIT u16 gUnknown_203B2AA = 0; -static IWRAM_DATA unkStruct_3001B5C *gUnknown_3001B5C = {NULL}; +static IWRAM_INIT unkStruct_3001B5C *gUnknown_3001B5C = {NULL}; #include "data/code_8023144.h" diff --git a/src/code_8023868.c b/src/code_8023868.c index fa10220d9..154e1821a 100644 --- a/src/code_8023868.c +++ b/src/code_8023868.c @@ -7,7 +7,7 @@ #include "text_util.h" //static // MAKE STATIC WHEN code_8023868.s IS DONE -IWRAM_DATA struct unkStruct_3001B60 *gUnknown_3001B60 = {0}; +IWRAM_INIT struct unkStruct_3001B60 *gUnknown_3001B60 = {NULL}; #include "data/code_8023868.h" diff --git a/src/code_809A560.c b/src/code_809A560.c index b365cb808..14c17dbe8 100644 --- a/src/code_809A560.c +++ b/src/code_809A560.c @@ -4,7 +4,7 @@ #include "string_format.h" #include "structs/str_3001B64.h" -IWRAM_DATA struct unkStruct_3001B64 *gUnknown_3001B64 = {0}; +IWRAM_INIT struct unkStruct_3001B64 *gUnknown_3001B64 = {NULL}; extern u16 gUnknown_20399DC; extern u16 gUnknown_20399DE; diff --git a/src/code_809C5C4.c b/src/code_809C5C4.c index cf3f9e4ab..f59351647 100644 --- a/src/code_809C5C4.c +++ b/src/code_809C5C4.c @@ -24,7 +24,7 @@ struct unkStruct_3001B68 u8 unk20; }; -IWRAM_DATA struct unkStruct_3001B68 *gUnknown_3001B68 = {0}; +IWRAM_INIT struct unkStruct_3001B68 *gUnknown_3001B68 = {NULL}; struct unkStruct_20399E0 diff --git a/src/ground_effect.c b/src/ground_effect.c new file mode 100644 index 000000000..71b0f71d1 --- /dev/null +++ b/src/ground_effect.c @@ -0,0 +1,3 @@ +#include "global.h" + +IWRAM_INIT void *gGroundEffects = NULL; diff --git a/src/ground_event.c b/src/ground_event.c new file mode 100644 index 000000000..88e328de0 --- /dev/null +++ b/src/ground_event.c @@ -0,0 +1,3 @@ +#include "global.h" + +IWRAM_INIT void *gGroundEvents = NULL; diff --git a/src/ground_lives.c b/src/ground_lives.c new file mode 100644 index 000000000..6f03b8fe7 --- /dev/null +++ b/src/ground_lives.c @@ -0,0 +1,4 @@ +#include "global.h" + +IWRAM_INIT void *gGroundLivesMeta = NULL; +IWRAM_INIT void *gGroundLives = NULL; diff --git a/src/ground_map.c b/src/ground_map.c index 7fe89d226..d12193986 100644 --- a/src/ground_map.c +++ b/src/ground_map.c @@ -7,8 +7,8 @@ #include "ground_script.h" #include "memory.h" -IWRAM_DATA GroundMapAction *gGroundMapAction = {0}; -IWRAM_DATA unkStruct_3001B70 *gGroundMapDungeon_3001B70 = {0}; +IWRAM_INIT GroundMapAction *gGroundMapAction = {NULL}; +IWRAM_INIT unkStruct_3001B70 *gGroundMapDungeon_3001B70 = {NULL}; extern GroundMapAction *gGroundMapAction; diff --git a/src/ground_map_2.c b/src/ground_map_2.c index b528a9328..4e3732615 100644 --- a/src/ground_map_2.c +++ b/src/ground_map_2.c @@ -7,8 +7,8 @@ extern u16 gUnknown_2026E4E; -IWRAM_DATA unkStruct_3001B74 *gUnknown_3001B74 = {0}; -IWRAM_DATA unkStruct_3001B70 *gUnknown_3001B78 = {0}; +IWRAM_INIT unkStruct_3001B74 *gUnknown_3001B74 = {NULL}; +IWRAM_INIT unkStruct_3001B70 *gUnknown_3001B78 = {NULL}; extern const u8 gUnknown_8117784[]; extern const s16 gUnknown_811E5F4[][2]; diff --git a/src/ground_object.c b/src/ground_object.c new file mode 100644 index 000000000..d52fae479 --- /dev/null +++ b/src/ground_object.c @@ -0,0 +1,3 @@ +#include "global.h" + +IWRAM_INIT void *gGroundObjects = NULL; diff --git a/src/ground_sprite.c b/src/ground_sprite.c index 7fe9f301a..0a6eabb6e 100644 --- a/src/ground_sprite.c +++ b/src/ground_sprite.c @@ -9,7 +9,7 @@ #include "memory.h" #include "sprite.h" -IWRAM_DATA unkStruct_3001B7C *gUnknown_3001B7C = {0}; +IWRAM_INIT unkStruct_3001B7C *gUnknown_3001B7C = {NULL}; EWRAM_DATA unkStruct_2039DB0 gUnknown_2039DB0 = {0}; EWRAM_DATA u32 sUnknown_2039DBC = {0}; // Unused, for alignment diff --git a/sym_iwram.txt b/sym_iwram.txt index b07326724..e7d6e10a2 100644 --- a/sym_iwram.txt +++ b/sym_iwram.txt @@ -17,44 +17,6 @@ gUnknown_3001018: /* 3001018 */ .include "src/code_8094D28.o" iwramClearEnd: -unk_code_ram: /* 3001B58 */ -gUnknown_3001B58: /* 3001B58 */ - .space 0x2 -gUnknown_3001B5A: /* 3001B5A */ - .space 0x2 -.include "src/code_8023144.o" -.include "src/code_8023868.o" -.include "src/code_809A560.o" -.include "src/code_809C5C4.o" -.include "src/ground_map.o" -.include "src/ground_map_2.o" -.include "src/ground_sprite.o" - -gGroundLivesMeta: /* 3001B80 */ - .space 0x4 - -gGroundLives: /* 3001B84 */ - .space 0x4 - -gGroundObjects: /* 3001B88 */ - .space 0x4 - -gGroundEffects: /* 3001B8C */ - .space 0x4 - -gGroundEvents: /* 3001B90 */ - .space 0x4 - -gUnkIwramFunc1Buffer: /* 3001B94 */ - .space 0x110 -gUnkIwramFunc2Buffer: /* 3001CA4 */ - .space 0x134 -gUnkIwramFunc3Buffer: /* 3001DD8 */ - .space 0xD4 -gUnkIwramFunc4Buffer: /* 3001EAC */ - .space 0x2154 - -.include "src/code_80001DC.o" diff --git a/sym_iwram_2.txt b/sym_iwram_2.txt new file mode 100644 index 000000000..9fad78cbc --- /dev/null +++ b/sym_iwram_2.txt @@ -0,0 +1,14 @@ + .align 2 + + + +gUnkIwramFunc1Buffer: /* 3001B94 */ + .space 0x110 +gUnkIwramFunc2Buffer: /* 3001CA4 */ + .space 0x134 +gUnkIwramFunc3Buffer: /* 3001DD8 */ + .space 0xD4 +gUnkIwramFunc4Buffer: /* 3001EAC */ + .space 0x2154 + +.include "src/code_80001DC.o" diff --git a/sym_iwram_init.txt b/sym_iwram_init.txt new file mode 100644 index 000000000..51831f76f --- /dev/null +++ b/sym_iwram_init.txt @@ -0,0 +1,16 @@ + .align 2 + +unk_code_ram: /* 3001B58 */ + +.include "src/code_80035F0.o" +.include "src/code_8023144.o" +.include "src/code_8023868.o" +.include "src/code_809A560.o" +.include "src/code_809C5C4.o" +.include "src/ground_map.o" +.include "src/ground_map_2.o" +.include "src/ground_sprite.o" +.include "src/ground_lives.o" +.include "src/ground_object.o" +.include "src/ground_effect.o" +.include "src/ground_event.o" From bdae8567693ca37d72bde22bd47b9ff6bdf4bf43 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 18 Dec 2024 12:09:22 +0100 Subject: [PATCH 2/3] iwram init done --- Makefile | 7 ++----- asm/code_8272724.s | 4 +++- include/gba/defines.h | 1 - ld_script.txt | 26 ++++++++++++-------------- src/code_80001DC.c | 2 +- src/main.c | 16 ++++++++-------- src/text.c | 17 +++++++++-------- sym_iwram.txt | 4 ---- sym_iwram_2.txt | 14 -------------- sym_iwram_init.txt | 2 -- 10 files changed, 35 insertions(+), 58 deletions(-) delete mode 100644 sym_iwram_2.txt diff --git a/Makefile b/Makefile index aed3690d2..cb9e085c3 100755 --- a/Makefile +++ b/Makefile @@ -261,17 +261,14 @@ $(BUILD_DIR)/sym_ewram.ld: sym_ewram.txt $(BUILD_DIR)/sym_iwram.ld: sym_iwram.txt $(RAMSCRGEN) iwram_data $< ENGLISH > $@ - -$(BUILD_DIR)/sym_iwram_2.ld: sym_iwram_2.txt - $(RAMSCRGEN) iwram_data_2 $< ENGLISH > $@ $(BUILD_DIR)/sym_ewram_init.ld: sym_ewram_init.txt $(RAMSCRGEN) ewram_init $< ENGLISH > $@ - + $(BUILD_DIR)/sym_iwram_init.ld: sym_iwram_init.txt $(RAMSCRGEN) iwram_init $< ENGLISH > $@ -$(LD_SCRIPT): ld_script.txt $(BUILD_DIR)/sym_ewram.ld $(BUILD_DIR)/sym_ewram_init.ld $(BUILD_DIR)/sym_iwram.ld $(BUILD_DIR)/sym_iwram_2.ld $(BUILD_DIR)/sym_iwram_init.ld +$(LD_SCRIPT): ld_script.txt $(BUILD_DIR)/sym_ewram.ld $(BUILD_DIR)/sym_ewram_init.ld $(BUILD_DIR)/sym_iwram.ld $(BUILD_DIR)/sym_iwram_init.ld cd $(BUILD_DIR) && sed -e "s#tools/#../../tools/#g" ../../ld_script.txt >ld_script.ld $(ELF): $(LD_SCRIPT) $(ALL_OBJECTS) $(LIBC) libagbsyscall tools diff --git a/asm/code_8272724.s b/asm/code_8272724.s index 9df41ac75..bd4cc80e1 100644 --- a/asm/code_8272724.s +++ b/asm/code_8272724.s @@ -142,6 +142,7 @@ _08272860: pop {r0} bx r0 thumb_func_end sub_8272774 + thumb_func_start sub_8272870 sub_8272870: @@ -311,6 +312,7 @@ _08272994: pop {r0} bx r0 thumb_func_end sub_8272884 + thumb_func_start sub_82729A4 sub_82729A4: @@ -426,7 +428,7 @@ _08272A5A: pop {r0} bx r0 thumb_func_end sub_82729B8 - + thumb_func_start sub_8272A78 sub_8272A78: push {lr} diff --git a/include/gba/defines.h b/include/gba/defines.h index 63eedb947..e00d5c0ee 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -7,7 +7,6 @@ #define FALSE 0 #define IWRAM_DATA __attribute__((section("iwram_data"))) -#define IWRAM_DATA_2 __attribute__((section("iwram_data_2"))) #define EWRAM_DATA __attribute__((section("ewram_data"))) #define EWRAM_LIB __attribute__((section("ewram_lib"))) // Used only for agb flash and m4a #define EWRAM_INIT __attribute__((section("ewram_init"))) diff --git a/ld_script.txt b/ld_script.txt index 9332833b2..78903bc2a 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -37,6 +37,7 @@ SECTIONS { { iwram_start = .; INCLUDE "sym_iwram.ld" + iwram_end = .; } > IWRAM /* BEGIN ROM DATA */ @@ -747,28 +748,25 @@ SECTIONS { iwram_init : ALIGN(4) { + iwram_init_start = .; + INCLUDE "sym_iwram_init.ld" + src/code_8272724.o(.text); + asm/code_8272724.o(.text); + + iwram_init_end = .; } > IWRAM AT>ROM - unk_code = LOADADDR(iwram_init); - unk_code_section : - ALIGN(4) - { - src/code_8272724.o(.text); - asm/code_8272724.o(.text); - unk_code_end = .; - } > ROM =0 + IWRAM_INIT_ROM_START = LOADADDR(iwram_init); - iwram_data_2 (NOLOAD) : + iwram_lib (NOLOAD) : ALIGN(4) { - INCLUDE "sym_iwram_2.ld" + end = .; /* This is needed for the libc.a function _sbrk */ + . = 0x2090; + gUnknown_3004000 = .; /* Used by sub_80001E0 */ } > IWRAM - unk_code_section_size = (unk_code_end - unk_code); - unk_code_ram_end = unk_code_ram + unk_code_section_size; - end = unk_code_ram_end; - unk_data 0x8300000 : ALIGN(4) { diff --git a/src/code_80001DC.c b/src/code_80001DC.c index 3e89e6888..6bcdcc9bc 100644 --- a/src/code_80001DC.c +++ b/src/code_80001DC.c @@ -1,6 +1,6 @@ #include "global.h" -IWRAM_DATA_2 u32 gUnknown_3004000 = {0}; +extern u32 gUnknown_3004000; // unused, returns stack pointer u32 sub_80001DC() { diff --git a/src/main.c b/src/main.c index 09f5fe5ed..f4a0e812f 100644 --- a/src/main.c +++ b/src/main.c @@ -22,12 +22,12 @@ extern u8 ewram_end[]; // Force a second storage in the asm extern u8 ewram_init_start[]; extern u8 ewram_init_end[]; extern u8 iwram_start[]; -extern u8 iwramClearEnd[]; -extern u8 unk_code[]; -extern u8 unk_code_ram[]; -extern u8 unk_code_ram_end[]; +extern u8 iwram_end[]; +extern u8 iwram_init_start[]; +extern u8 iwram_init_end[]; extern const u8 EWRAM_INIT_ROM_START[]; +extern const u8 IWRAM_INIT_ROM_START[]; UNUSED static const char sStringRomUserData[] = "PKD ROM USER DATA 000000"; @@ -56,12 +56,12 @@ void AgbMain(void) CpuSet(&value, ewram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((ewram_end - ewram_start) / 4) & 0x1FFFFF)); } - if (unk_code_ram_end - unk_code_ram > 0) - CpuCopy32(unk_code, unk_code_ram, unk_code_ram_end - unk_code_ram); + if (iwram_init_end - iwram_init_start > 0) + CpuCopy32(IWRAM_INIT_ROM_START, iwram_init_start, iwram_init_end - iwram_init_start); - if (iwramClearEnd - iwram_start > 0) { + if (iwram_end - iwram_start > 0) { memset(value, 0, sizeof(value)); - CpuSet(&value, iwram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((iwramClearEnd - iwram_start) / 4) & 0x1FFFFF)); + CpuSet(&value, iwram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((iwram_end - iwram_start) / 4) & 0x1FFFFF)); } REG_WIN0H = 0; diff --git a/src/text.c b/src/text.c index 31e40a212..7506488a3 100644 --- a/src/text.c +++ b/src/text.c @@ -41,15 +41,16 @@ EWRAM_DATA static u32 sTextShadowMask = 0; // Some text color info is stored; re EWRAM_DATA static u8 sDrawTextShadow = 0; EWRAM_DATA ALIGNED(4) u16 gUnknown_202B038[4][32][32] = {0}; -extern ALIGNED(4) u8 gUnkIwramFunc1Buffer[]; -extern ALIGNED(4) u8 gUnkIwramFunc2Buffer[]; -extern ALIGNED(4) u8 gUnkIwramFunc3Buffer[]; -extern ALIGNED(4) u8 gUnkIwramFunc4Buffer[]; +extern void sub_8272760(s32 a0); +extern void sub_8272870(s32 a0); +extern void sub_82729A4(s32 a0); +extern void sub_8272A78(s32 a0); + // Despite these not being used anywhere in this file, file order and usage point to these variables being declared here -EWRAM_INIT void (*gUnknown_203B080)(s32 a0) = (void *) &gUnkIwramFunc1Buffer[1]; // + 1 because the function is in thumb! -EWRAM_INIT void (*gUnknown_203B084)(s32 a0) = (void *) &gUnkIwramFunc2Buffer[1]; // + 1 because the function is in thumb! -EWRAM_INIT void (*gUnknown_203B088)(s32 a0) = (void *) &gUnkIwramFunc3Buffer[1]; // + 1 because the function is in thumb! -EWRAM_INIT void (*gUnknown_203B08C)(s32 a0) = (void *) &gUnkIwramFunc4Buffer[1]; // + 1 because the function is in thumb! +EWRAM_INIT void (*gUnknown_203B080)(s32 a0) = sub_8272760; +EWRAM_INIT void (*gUnknown_203B084)(s32 a0) = sub_8272870; +EWRAM_INIT void (*gUnknown_203B088)(s32 a0) = sub_82729A4; +EWRAM_INIT void (*gUnknown_203B08C)(s32 a0) = sub_8272A78; // This variable is only used in InitGraphics function, which could or could not belong to text.c EWRAM_INIT u8 gUnknown_203B090 = 0; diff --git a/sym_iwram.txt b/sym_iwram.txt index e7d6e10a2..5c61b39d2 100644 --- a/sym_iwram.txt +++ b/sym_iwram.txt @@ -16,7 +16,3 @@ gUnknown_3001018: /* 3001018 */ .include "src/code_8094D28.o" -iwramClearEnd: - - - diff --git a/sym_iwram_2.txt b/sym_iwram_2.txt deleted file mode 100644 index 9fad78cbc..000000000 --- a/sym_iwram_2.txt +++ /dev/null @@ -1,14 +0,0 @@ - .align 2 - - - -gUnkIwramFunc1Buffer: /* 3001B94 */ - .space 0x110 -gUnkIwramFunc2Buffer: /* 3001CA4 */ - .space 0x134 -gUnkIwramFunc3Buffer: /* 3001DD8 */ - .space 0xD4 -gUnkIwramFunc4Buffer: /* 3001EAC */ - .space 0x2154 - -.include "src/code_80001DC.o" diff --git a/sym_iwram_init.txt b/sym_iwram_init.txt index 51831f76f..e6acf0ab6 100644 --- a/sym_iwram_init.txt +++ b/sym_iwram_init.txt @@ -1,7 +1,5 @@ .align 2 -unk_code_ram: /* 3001B58 */ - .include "src/code_80035F0.o" .include "src/code_8023144.o" .include "src/code_8023868.o" From 29f50511c7c090579268f4ac2e12bbe560249c0f Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 18 Dec 2024 12:56:55 +0100 Subject: [PATCH 3/3] use IWRAM_INIT before function declarations --- ld_script.txt | 2 +- src/code_8272724.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ld_script.txt b/ld_script.txt index 78903bc2a..d7a5f4d8b 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -751,7 +751,7 @@ SECTIONS { iwram_init_start = .; INCLUDE "sym_iwram_init.ld" - src/code_8272724.o(.text); + src/code_8272724.o(iwram_init); asm/code_8272724.o(.text); iwram_init_end = .; diff --git a/src/code_8272724.c b/src/code_8272724.c index 6487650eb..895eb4bcd 100644 --- a/src/code_8272724.c +++ b/src/code_8272724.c @@ -4,13 +4,15 @@ extern void sub_8272774(UnkTextStruct1 *r0, u32 r1); extern void sub_8272884(UnkTextStruct1 *r0, u32 r1); -void sub_8272760(u32 r0) +IWRAM_INIT void sub_8272760(u32 r0) { sub_8272774(gUnknown_2027370, r0); } +// Note: when decompiling make sure to add IWRAM_INIT before the function declaration just like in sub_8272760's case, so the compiler knows there to put the functions. + // TODO once sub_8272774 is decomped -//void sub_8272870(u32 r0) +//IWRAM_INIT void sub_8272870(u32 r0) //{ // sub_8272884(gUnknown_2027370, r0); //}