summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron Hall <cameronghall@cox.net>2019-08-04 18:52:05 -0500
committerCameron Hall <cameronghall@cox.net>2019-08-04 18:52:05 -0500
commitea69c98caa3c8aaa68125756714137265882d90b (patch)
treeb8d3525efb9852a9f10ddb4331eea8248e5fae1c
parentaa6920a31c8265c0f66d83cd91aa65730345db1f (diff)
replace raw addresses in m4a code
-rwxr-xr-xasm/m4a_1.s4
-rwxr-xr-xdata/rom.s41
-rwxr-xr-xld_script.txt4
-rwxr-xr-xsrc/m4a.c14
4 files changed, 43 insertions, 20 deletions
diff --git a/asm/m4a_1.s b/asm/m4a_1.s
index 071f2a6..a55b1d4 100755
--- a/asm/m4a_1.s
+++ b/asm/m4a_1.s
@@ -1458,7 +1458,7 @@ call_r3:
bx r3
.align 2, 0
-lt_gClockTable: .word 0x0852DB0C @ gClockTable
+lt_gClockTable: .word gClockTable
lt2_SOUND_INFO_PTR: .word SOUND_INFO_PTR
lt2_ID_NUMBER: .word ID_NUMBER
thumb_func_end MPlayMain
@@ -1547,7 +1547,7 @@ ply_note:
ldr r1, =SOUND_INFO_PTR
ldr r1, [r1]
str r1, [sp, 0x4]
- ldr r1, =gUnknown_0852DB0C @ gClockTable
+ ldr r1, =gClockTable
adds r0, r1
ldrb r0, [r0]
strb r0, [r5, o_MusicPlayerTrack_gateTime]
diff --git a/data/rom.s b/data/rom.s
index 3eab3d1..4764ced 100755
--- a/data/rom.s
+++ b/data/rom.s
@@ -1820,10 +1820,37 @@ gGBAButtonIcons_Pals:: @ 0x0852B668
gOptionsSprites_Gfx:: @ 0x0852B868
.incbin "graphics/options/sprites.4bpp"
-.incbin "baserom.gba", 0x52D888, 0x52DB0C - 0x52D888
+.incbin "baserom.gba", 0x52D888, 0x52D928 - 0x52D888
-gUnknown_0852DB0C:: @ 0x0852DB0C
- .incbin "baserom.gba", 0x52DB0C, 0x5260
+gScaleTable:: @ 0x0852D928
+ .incbin "baserom.gba", 0x52D928, 0xB4
+
+gFreqTable:: @ 0x0852D9DC
+ .incbin "baserom.gba", 0x52D9DC, 0x30
+
+gPcmSamplesPerVBlankTable:: @ 0x0852DA0C
+ .incbin "baserom.gba", 0x52DA0C, 0x18
+
+gCgbScaleTable:: @ 0x0852DA24
+ .incbin "baserom.gba", 0x52DA24, 0x84
+
+gCgbFreqTable:: @ 0x0852DAA8
+ .incbin "baserom.gba", 0x52DAA8, 0x18
+
+gNoiseTable:: @ 0x0852DAC0
+ .incbin "baserom.gba", 0x52DAC0, 0x3C
+
+gCgb3Vol:: @ 0x0852DAFC
+ .incbin "baserom.gba", 0x52DAFC, 0x10
+
+gClockTable:: @ 0x0852DB0C
+ .incbin "baserom.gba", 0x52DB0C, 0x34
+
+gPokemonCrySongTemplate:: @ 0x0852DB40
+ .incbin "baserom.gba", 0x52DB40, 0x34
+
+gXcmdTable:: @ 0x0852DB74
+ .incbin "baserom.gba", 0x52DB74, 0x51F8
gUnknown_08532D6C:: @ 0x08532D6C
.incbin "baserom.gba", 0x532D6C, 0x5F4
@@ -1835,7 +1862,13 @@ gUnknown_08533960:: @ 0x08533960
.incbin "baserom.gba", 0x533960, 0x600
gUnknown_08533F60:: @ 0x08533F60
- .incbin "baserom.gba", 0x533F60, 0x16B2E0
+ .incbin "baserom.gba", 0x533F60, 0xE74
+
+gMPlayTable:: @ 0x08534DD4
+ .incbin "baserom.gba", 0x534DD4, 0x30
+
+gSongTable:: @ 0x08534E04
+ .incbin "baserom.gba", 0x534E04, 0x16A43C
gUnknown_0869F240:: @ 0x0869F240
.incbin "baserom.gba", 0x69F240, 0x60
diff --git a/ld_script.txt b/ld_script.txt
index b12f880..15cf11d 100755
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -74,3 +74,7 @@ SECTIONS
*(*);
}
}
+
+/* m4a parameters */
+gMaxLines = 0x3C;
+gNumMusicPlayers = 0x4;
diff --git a/src/m4a.c b/src/m4a.c
index 2c70083..29b2be8 100755
--- a/src/m4a.c
+++ b/src/m4a.c
@@ -5,20 +5,6 @@ extern const u8 gCgb3Vol[];
#define BSS_CODE __attribute__((section(".bss.code")))
-asm(".set gScaleTable, 0x0852D928"); // TODO:
-asm(".set gFreqTable, 0x0852D9DC"); // TODO:
-asm(".set gMPlayTable, 0x08534DD4"); // TODO:
-asm(".set gPokemonCrySongTemplate, 0x0852DB40"); // TODO:
-asm(".set gSongTable, 0x08534E04"); // TODO:
-asm(".set gMaxLines, 0x3C"); // TODO:
-asm(".set gPcmSamplesPerVBlankTable, 0x0852DA0C"); // TODO:
-asm(".set gNoiseTable, 0x0852DAC0"); // TODO:
-asm(".set gCgbScaleTable, 0x0852DA24"); // TODO:
-asm(".set gCgbFreqTable, 0x0852DAA8"); // TODO:
-asm(".set gNumMusicPlayers, 0x4"); // TODO:
-asm(".set gCgb3Vol, 0x0852DAFC"); // TODO:
-asm(".set gXcmdTable, 0x0852DB74"); // TODO:
-
BSS_CODE ALIGNED(4) char SoundMainRAM_Buffer[0x800] = {0};
struct SoundInfo gSoundInfo;