summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index d7ef91df0..75845213f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -89,7 +89,14 @@ static void WaitForVBlank(void);
void AgbMain()
{
+#if MODERN
+ // Modern compilers are liberal with the stack on entry to this function,
+ // so RegisterRamReset may crash if it resets IWRAM.
+ RegisterRamReset(RESET_ALL & ~RESET_IWRAM);
+ DmaFill32(3, 0, (void *)0x03000000, 0x7E00);
+#else
RegisterRamReset(RESET_ALL);
+#endif //MODERN
REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3;
InitKeys();
InitIntrHandlers();