expansion changes to m4a and crt0

This commit is contained in:
cawtds 2025-01-04 20:19:15 +01:00
parent 40cf1bab25
commit d3dd6abf87
7 changed files with 26 additions and 27 deletions

View File

@ -67,7 +67,7 @@ SECTIONS {
asm/*.o(.text*);
} > ROM =0
script_data (READONLY):
script_data :
ALIGN(4)
{
data/*.o(script_data);

View File

@ -38,7 +38,7 @@ SECTIONS {
__iwram_end = .;
} > IWRAM
.iwram.sbss (NOLOAD) :
.iwram.bss (NOLOAD) :
ALIGN(4)
{
src/*.o(.bss);
@ -55,13 +55,17 @@ SECTIONS {
data/*.o(COMMON);
test/*.o(COMMON);
*libc.a:sbrkr.o(COMMON);
. = ALIGN(4);
} > IWRAM
/* .persistent starts at 0x3007F00 */
/* WARNING: This is the end of the IRQ stack, if there's too
* much data it WILL be overwritten. */
. = 0x7F00;
test/*.o(.persistent);
/* .persistent starts at 0x3007F00 */
/* WARNING: This is the end of the IRQ stack, if there's too
* much data it WILL be overwritten. */
. = 0x03007F00;
.iwram.persistent (NOLOAD) :
ALIGN(4)
{
test/*.o(.persistent);
} > IWRAM
/* BEGIN ROM DATA */
@ -78,7 +82,7 @@ SECTIONS {
script_data :
ALIGN(4)
{
data/*.o(script_data);
data/*.o(script_data);
} > ROM =0
lib_text :
@ -113,7 +117,7 @@ SECTIONS {
} > ROM =0
.data.iwram :
ALIGN(4)
ALIGN(8)
{
__iwram_lma = .;
. = . + (__iwram_end - __iwram_start);

View File

@ -14,15 +14,15 @@ Init::
mov r0, #PSR_SYS_MODE
msr cpsr_cf, r0
ldr sp, sp_sys
@ Prepare for interrupt handling
ldr r1, =INTR_VECTOR
adr r0, IntrMain
str r0, [r1]
@ Dispatch memory reset request to hardware
mov r0, #255 @ RESET_ALL
svc #1 << 16
@ Fill RAM areas with appropriate data
bl InitializeWorkingMemory
@ Prepare for interrupt handling
ldr r1, =INTR_VECTOR
adr r0, IntrMain
str r0, [r1]
@ Jump to AgbMain
ldr r1, =AgbMain + 1
mov lr, pc

View File

@ -1303,7 +1303,7 @@ static void _GiveEggFromDaycare(struct DayCare *daycare)
{
struct Pokemon egg;
u16 species;
u8 parentSlots[DAYCARE_MON_COUNT];
u8 parentSlots[DAYCARE_MON_COUNT] = {0};
bool8 isEgg;
species = DetermineEggSpeciesAndParentSlots(daycare, parentSlots);

View File

@ -5,8 +5,6 @@ extern const u8 gCgb3Vol[];
#define BSS_CODE __attribute__((section(".bss.code")))
BSS_CODE ALIGNED(4) char SoundMainRAM_Buffer[0x800] = {0};
struct SoundInfo gSoundInfo;
struct PokemonCrySong gPokemonCrySongs[MAX_POKEMON_CRIES];
struct MusicPlayerInfo gPokemonCryMusicPlayers[MAX_POKEMON_CRIES];
@ -71,8 +69,6 @@ void m4aSoundInit(void)
{
s32 i;
CpuCopy32((void *)((s32)SoundMainRAM & ~1), SoundMainRAM_Buffer, sizeof(SoundMainRAM_Buffer));
SoundInit(&gSoundInfo);
MPlayExtender(gCgbChans);
m4aSoundMode(SOUND_MODE_DA_BIT_8

View File

@ -52,11 +52,11 @@ SoundMain_3:
cmp r3, 0
beq SoundMain_4
ldr r0, [r0, o_SoundInfo_musicPlayerHead]
bl _081DD25E
bl call_r3
ldr r0, [sp, 0x18]
SoundMain_4:
ldr r3, [r0, o_SoundInfo_CgbSound]
bl _081DD25E
bl call_r3
ldr r0, [sp, 0x18]
ldr r3, [r0, o_SoundInfo_pcmSamplesPerVBlank]
mov r8, r3
@ -73,18 +73,19 @@ SoundMain_4:
SoundMain_5:
str r5, [sp, 0x8]
ldr r6, lt_PCM_DMA_BUF_SIZE
ldr r3, lt_SoundMainRAM_Buffer
ldr r3, lt_SoundMainRAM
bx r3
.align 2, 0
lt_SOUND_INFO_PTR: .word SOUND_INFO_PTR
lt_ID_NUMBER: .word ID_NUMBER
lt_SoundMainRAM_Buffer: .word SoundMainRAM_Buffer + 1
lt_SoundMainRAM: .word SoundMainRAM + 1
lt_REG_VCOUNT: .word REG_VCOUNT
lt_o_SoundInfo_pcmBuffer: .word o_SoundInfo_pcmBuffer
lt_PCM_DMA_BUF_SIZE: .word PCM_DMA_BUF_SIZE
thumb_func_end SoundMain
.section .iwram.code
thumb_func_start SoundMainRAM
SoundMainRAM:
ldrb r3, [r0, o_SoundInfo_reverb]
@ -708,6 +709,7 @@ _081DD594:
.pool
arm_func_end SoundMainRAM_Unk2
.text
thumb_func_start SoundMainBTM
SoundMainBTM:
mov r12, r4

View File

@ -67,7 +67,6 @@ u16 gKeyRepeatContinueDelay;
u8 gSoftResetDisabled;
IntrFunc gIntrTable[INTR_COUNT];
bool8 gLinkVSyncDisabled;
u32 IntrMain_Buffer[0x200];
u8 gPcmDmaCounter;
void *gAgbMainLoop_sp;
@ -309,9 +308,7 @@ void InitIntrHandlers(void)
for (i = 0; i < INTR_COUNT; i++)
gIntrTable[i] = gIntrTableTemplate[i];
DmaCopy32(3, IntrMain, IntrMain_Buffer, sizeof(IntrMain_Buffer));
INTR_VECTOR = IntrMain_Buffer;
INTR_VECTOR = IntrMain;
SetVBlankCallback(NULL);
SetHBlankCallback(NULL);