diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c index d0c9ff7b4..47a957ce0 100644 --- a/src/main.c +++ b/src/main.c @@ -85,7 +85,14 @@ void EnableVCountIntrAtLine150(void); void AgbMain() { - RegisterRamReset(MODERN ? RESET_ALL & ~RESET_IWRAM : RESET_ALL); +#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, IWRAM_START, 0x7E00); +#else + RegisterRamReset(RESET_ALL); +#endif //MODERN *(vu16 *)BG_PLTT = 0x7FFF; InitGpuRegManager(); REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3; |