diff --git a/berry_fix/payload/asm/libagbsyscall.s b/berry_fix/payload/asm/libagbsyscall.s index 9548e80d2..f13d08d76 100644 --- a/berry_fix/payload/asm/libagbsyscall.s +++ b/berry_fix/payload/asm/libagbsyscall.s @@ -6,13 +6,13 @@ .text thumb_func_start CpuSet -CpuSet: @ 81E3B64 +CpuSet: svc 0xB bx lr thumb_func_end CpuSet thumb_func_start Div -Div: @ 81E3B68 +Div: svc 0x6 bx lr thumb_func_end Div @@ -25,19 +25,19 @@ Mod: thumb_func_end Mod thumb_func_start LZ77UnCompVram -LZ77UnCompVram: @ 81E3B6C +LZ77UnCompVram: svc 0x12 bx lr thumb_func_end LZ77UnCompVram thumb_func_start RegisterRamReset -RegisterRamReset: @ 81E3B80 +RegisterRamReset: svc 0x1 bx lr thumb_func_end RegisterRamReset thumb_func_start VBlankIntrWait -VBlankIntrWait: @ 81E3BA0 +VBlankIntrWait: movs r2, 0 svc 0x5 bx lr diff --git a/src/crt0.s b/src/crt0.s index 7c679c13b..523061f52 100644 --- a/src/crt0.s +++ b/src/crt0.s @@ -6,7 +6,7 @@ .align 2, 0 .global Init -Init: @ 8000204 +Init: mov r0, #PSR_IRQ_MODE msr cpsr_cf, r0 ldr sp, sp_irq @@ -34,7 +34,7 @@ sp_irq: .word IWRAM_END - 0x60 .arm .align 2, 0 .global IntrMain -IntrMain: @ 8000248 +IntrMain: mov r3, #REG_BASE add r3, r3, #OFFSET_REG_IE ldr r2, [r3] diff --git a/src/libgcnmultiboot.s b/src/libgcnmultiboot.s index 5ecc7d2f9..968a0836e 100644 --- a/src/libgcnmultiboot.s +++ b/src/libgcnmultiboot.s @@ -40,7 +40,7 @@ .text thumb_func_start GameCubeMultiBoot_Hash -GameCubeMultiBoot_Hash: @ 82DED70 +GameCubeMultiBoot_Hash: push {r4,lr} ldr r4, pool_HashVal eors r3, r1 @@ -61,7 +61,7 @@ GameCubeMultiBoot_Hash_SkipEor: thumb_func_start GameCubeMultiBoot_Main @ void GameCubeMultiBoot_Main(struct GameCubeMultiBoot *mb); -GameCubeMultiBoot_Main: @ 82DED84 +GameCubeMultiBoot_Main: @ If there is no interrupt handler, skip counter manipulation ldr r1, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER] cmp r1, 0 @@ -246,7 +246,7 @@ pool_NintendoLogo: .4byte RomHeaderNintendoLogo thumb_func_start GameCubeMultiBoot_ExecuteProgram @ void GameCubeMultiBoot_ExecuteProgram(struct GameCubeMultiBoot *mb); -GameCubeMultiBoot_ExecuteProgram: @ 82DEE84 +GameCubeMultiBoot_ExecuteProgram: @ If there's no multiboot image ready, just return to caller ldrb r1, [r0, GCMB_STRUCT_MBPROGRESS] cmp r1, MBPROGRESS_READY_TO_BOOT @@ -265,7 +265,7 @@ GameCubeMultiBoot_ExecuteProgram_Fail: thumb_func_start GameCubeMultiBoot_Init @ void GameCubeMultiBoot_Init(struct GameCubeMultiBoot *mb); -GameCubeMultiBoot_Init: @ 82DEE98 +GameCubeMultiBoot_Init: ldr r3, pool_InterruptRegs @ Save IME register. @@ -336,7 +336,7 @@ GameCubeMultiBoot_Init_ClearStructLoop: non_word_aligned_thumb_func_start GameCubeMultiBoot_HandleSerialInterrupt @ void GameCubeMultiBoot_HandleSerialInterrupt(struct GameCubeMultiBoot *mb); -GameCubeMultiBoot_HandleSerialInterrupt: @ 82DEEE2 +GameCubeMultiBoot_HandleSerialInterrupt: ldr r3, pool_SerialRegs @ Acknowledge reset/receive/send flags. @@ -400,7 +400,7 @@ GameCubeMultiBoot_BeginHandshake: .align 2, 0 -GcMbIntrHandler_CheckGameCodeSent: @ 82DEF24 +GcMbIntrHandler_CheckGameCodeSent: lsls r1, 31 bcc GcMbIntrHandler_Stop @ stop if send failed bmi GameCubeMultiBoot_CheckHandshakeResponse @ branch if receive is complete @@ -412,7 +412,7 @@ GcMbIntrHandler_CheckGameCodeSent: @ 82DEF24 .align 2, 0 -GcMbIntrHandler_CheckHandshakeResponse: @ 82DEF30 +GcMbIntrHandler_CheckHandshakeResponse: lsrs r1, 1 @ is receive complete? bcc GcMbIntrHandler_Stop @ stop if not @@ -429,7 +429,7 @@ GameCubeMultiBoot_CheckHandshakeResponse: .align 2, 0 -GcMbIntrHandler_ReceiveKeyA: @ 82DEF44 +GcMbIntrHandler_ReceiveKeyA: lsrs r1, 1 @ is receive complete? bcc GcMbIntrHandler_Stop @ branch if not ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120] @@ -473,7 +473,7 @@ GameCubeMultiBoot_KeyBCheckEnd: .align 2, 0 -GcMbIntrHandler_CheckKeyBSent: @ 82DEF84 +GcMbIntrHandler_CheckKeyBSent: lsls r1, 31 bcc GcMbIntrHandler_Stop @ stop if send failed bmi GameCubeMultiBoot_CheckImageSizeResponse @ branch if receive is complete @@ -482,7 +482,7 @@ GcMbIntrHandler_CheckKeyBSent: @ 82DEF84 .align 2, 0 -GcMbIntrHandler_CheckImageSizeResponse: @ 82DEF90 +GcMbIntrHandler_CheckImageSizeResponse: lsrs r1, 1 @ is receive complete? bcc GcMbIntrHandler_Stop @ branch if not GameCubeMultiBoot_CheckImageSizeResponse: @@ -505,7 +505,7 @@ GcMbIntrHandler_StopIfNotEqual: .align 2, 0 -GcMbIntrHandler_CheckImageResponse: @ 82DEFB4 +GcMbIntrHandler_CheckImageResponse: lsrs r1, 1 @ is receive complete? bcc GcMbIntrHandler_Stop @ branch if not ldr r2, [r0, GCMB_STRUCT_CUR_DEST_PTR] @@ -553,7 +553,7 @@ GcMbIntrHandler_StopIfSendFailed: .align 2, 0 -GcMbIntrHandler_CheckKeyCDerivationSent: @ 82DEFF0 +GcMbIntrHandler_CheckKeyCDerivationSent: lsls r1, 31 bcc GcMbIntrHandler_StopIfSendFailed @ branch if send failed bmi GameCubeMultiBoot_CheckBootKeyResponse @ branch if receive is complete @@ -562,7 +562,7 @@ GcMbIntrHandler_CheckKeyCDerivationSent: @ 82DEFF0 .align 2, 0 -GcMbIntrHandler_CheckBootKeyResponse: @ 82DEFFC +GcMbIntrHandler_CheckBootKeyResponse: lsrs r1, 1 @ is receive complete? bcc GcMbIntrHandler_StopIfSendFailed @ branch if not @@ -580,14 +580,14 @@ GameCubeMultiBoot_CheckBootKeyResponse: .align 2, 0 -GcMbIntrHandler_StopUnconditionally: @ 82DF010 +GcMbIntrHandler_StopUnconditionally: b GcMbIntrHandler_Stop thumb_func_end GameCubeMultiBoot_HandleSerialInterrupt non_word_aligned_thumb_func_start GameCubeMultiBoot_Quit @ void GameCubeMultiBoot_Quit(); -GameCubeMultiBoot_Quit: @ 82DF012 +GameCubeMultiBoot_Quit: ldr r3, pool_InterruptRegs @ Save IME register. diff --git a/src/rom_header.s b/src/rom_header.s index 5ed45124d..9ab7240fb 100644 --- a/src/rom_header.s +++ b/src/rom_header.s @@ -2,7 +2,7 @@ @ It's populated by gbafix using data provided in the Makefile. .global Start -Start: @ 8000000 +Start: b Init .global RomHeaderNintendoLogo @@ -41,23 +41,20 @@ RomHeaderChecksum: RomHeaderReserved2: .space 2 -@ 80000C0 .word 0 .global GPIOPortData -GPIOPortData: @ 80000C4 +GPIOPortData: .2byte 0 .global GPIOPortDirection -GPIOPortDirection: @ 80000C6 +GPIOPortDirection: .2byte 0 .global GPIOPortReadEnable -GPIOPortReadEnable: @ 80000C8 +GPIOPortReadEnable: .2byte 0 -@ 80000CA .2byte 0 -@ 80000CC .space 0x34