From ef0b022707bd6e4167f43fa0c9396dc507ef9042 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Sep 2017 09:32:46 -0400 Subject: [PATCH] BSS: src/main.o, src/dma3_manager.o --- asm/librfu.s | 4 ++-- include/dma3.h | 14 -------------- src/dma3_manager.c | 18 ++++++++++++++---- src/main.c | 2 +- src/malloc.c | 1 + sym_bss.txt | 24 ++---------------------- 6 files changed, 20 insertions(+), 43 deletions(-) diff --git a/asm/librfu.s b/asm/librfu.s index d8ca7538c..129e0f34a 100644 --- a/asm/librfu.s +++ b/asm/librfu.s @@ -2762,7 +2762,7 @@ sub_82E424C: @ 82E424C b _082E4266 .align 2, 0 _082E4254: .4byte gUnknown_089A324C -_082E4258: .4byte gUnknown_030000F0 +_082E4258: .4byte gDma3Requests + 0xE0 thumb_func_end sub_82E424C thumb_func_start sub_82E425C @@ -2810,7 +2810,7 @@ _082E4274: movs r0, 0 b _082E42BE .align 2, 0 -_082E42B0: .4byte gUnknown_030000FA +_082E42B0: .4byte gDma3Requests + 0xEA _082E42B4: .4byte gUnknown_03007890 _082E42B8: .4byte gUnknown_03007894 _082E42BC: diff --git a/include/dma3.h b/include/dma3.h index db75ea9e3..265b47824 100644 --- a/include/dma3.h +++ b/include/dma3.h @@ -1,20 +1,6 @@ #ifndef GUARD_DMA3_H #define GUARD_DMA3_H -extern u8 gDma3ManagerLocked; -extern u8 gDma3RequestCursor; - -struct DmaRequestsStruct -{ - /* 0x00 */ const u8 *src; - /* 0x04 */ u8 *dest; - /* 0x08 */ u16 size; - /* 0x0A */ u16 mode; - /* 0x0C */ u32 value; -}; - -extern struct DmaRequestsStruct gDma3Requests[128]; - void ClearDma3Requests(void); void ProcessDma3Requests(void); int RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode); diff --git a/src/dma3_manager.c b/src/dma3_manager.c index 7cce06c15..bb015c5cf 100644 --- a/src/dma3_manager.c +++ b/src/dma3_manager.c @@ -1,12 +1,23 @@ #include "global.h" #include "dma3.h" +IWRAM_DATA struct { + /* 0x00 */ const u8 *src; + /* 0x04 */ u8 *dest; + /* 0x08 */ u16 size; + /* 0x0A */ u16 mode; + /* 0x0C */ u32 value; +} gDma3Requests[128]; + +static bool8 gDma3ManagerLocked; +static u8 gDma3RequestCursor; + void ClearDma3Requests(void) { int i; gDma3ManagerLocked = TRUE; - gDma3RequestCursor = FALSE; + gDma3RequestCursor = 0; for(i = 0; i < (u8)ARRAY_COUNT(gDma3Requests); i++) { @@ -22,7 +33,6 @@ void ClearDma3Requests(void) void ProcessDma3Requests(void) { // NOTE: the fillerA member of the DMA struct is actually u32 value; - // NOTE: gUnknown_0300001C is just a pointer inside the gDma3Requests structure, not a true symbol; feel free to remove u16 total_size; if (gDma3ManagerLocked) @@ -331,7 +341,7 @@ _08000DB2:\n\ mov r5, r12\n\ ldrb r0, [r5]\n\ lsls r0, 4\n\ - ldr r3, =gUnknown_0300001C\n\ + ldr r3, =gDma3Requests + 0x0C\n\ adds r0, r3\n\ ldr r0, [r0]\n\ strh r0, [r1]\n\ @@ -347,7 +357,7 @@ _08000DB2:\n\ bhi _08000DB2\n\ ldrb r0, [r5]\n\ lsls r0, 4\n\ - ldr r5, =gUnknown_0300001C\n\ + ldr r5, =gDma3Requests + 0x0C\n\ adds r0, r5\n\ ldr r0, [r0]\n\ strh r0, [r1]\n\ diff --git a/src/main.c b/src/main.c index 5707e18af..665a4dd84 100644 --- a/src/main.c +++ b/src/main.c @@ -77,7 +77,7 @@ const IntrFunc gIntrTableTemplate[] = #define INTR_COUNT ((int)(sizeof(gIntrTableTemplate)/sizeof(IntrFunc))) -extern u16 gUnknown_03000000; +static u16 gUnknown_03000000; extern u16 gKeyRepeatStartDelay; extern u8 gUnknown_030022B4; diff --git a/src/malloc.c b/src/malloc.c index ccb2f7d20..1d64351c3 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -2,6 +2,7 @@ static void *sHeapStart; static u32 sHeapSize; +static u32 malloc_c_unused_0300000c; // needed to align dma3_manager.o(.bss) #define MALLOC_SYSTEM_ID 0xA3A3 diff --git a/sym_bss.txt b/sym_bss.txt index aacfa59a0..2cc5279f3 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -1,27 +1,7 @@ gUnknown_03000000: @ 3000000 - .space 0x4 - + .include "src/main.o" .include "src/malloc.o" - - .align 4 -gDma3Requests: @ 3000010 - .space 0xC - -gUnknown_0300001C: @ 300001C - .space 0xD4 - -gUnknown_030000F0: @ 30000F0 - .space 0xA - -gUnknown_030000FA: @ 30000FA - .space 0x716 - -gDma3ManagerLocked: @ 3000810 - .space 0x1 - -gDma3RequestCursor: @ 3000811 - .space 0x7 - + .include "src/dma3_manager.o" .include "src/gpu_regs.o" .include "src/bg.o" .include "src/text.o"