From c70c44fa48282632ec7457d4f2bbb5a19a4d70c9 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 6 Nov 2020 12:29:40 -0500 Subject: [PATCH 1/2] Simplify RAM reset adaptation for modern --- src/crt0.s | 4 ++++ src/main.c | 18 +----------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/crt0.s b/src/crt0.s index cb7c93a6bc..ba068f8d98 100644 --- a/src/crt0.s +++ b/src/crt0.s @@ -91,6 +91,10 @@ Init: @ 8000204 ldr r1, =INTR_VECTOR adr r0, IntrMain str r0, [r1] + .if MODERN + mov r0, #255 @ RESET_ALL + swi #1 << 16 + .endif @ MODERN ldr r1, =AgbMain + 1 mov lr, pc bx r1 diff --git a/src/main.c b/src/main.c index ab0c232849..9fd1d0a35f 100644 --- a/src/main.c +++ b/src/main.c @@ -85,25 +85,9 @@ void EnableVCountIntrAtLine150(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); - asm("mov\tr1, #0xC0\n" - "\tlsl\tr1, r1, #0x12\n" - "\tmov r2, #0xFC\n" - "\tlsl r2, r2, #0x7\n" - "\tadd\tr2, r1, r2\n" - "\tmov\tr0, #0\n" - "\tmov\tr3, r0\n" - "\tmov\tr4, r0\n" - "\tmov\tr5, r0\n" - ".LCU0:\n" - "\tstmia r1!, {r0, r3, r4, r5}\n" - "\tcmp\tr1, r2\n" - "\tbcc\t.LCU0\n" - ); -#else +#if !MODERN RegisterRamReset(RESET_ALL); #endif //MODERN *(vu16 *)BG_PLTT = 0x7FFF; From 3112cf5726424457c49307082c21fa3740bc0b3a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 6 Nov 2020 12:34:57 -0500 Subject: [PATCH 2/2] swi --> svc --- src/crt0.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crt0.s b/src/crt0.s index ba068f8d98..49f214f80d 100644 --- a/src/crt0.s +++ b/src/crt0.s @@ -93,7 +93,7 @@ Init: @ 8000204 str r0, [r1] .if MODERN mov r0, #255 @ RESET_ALL - swi #1 << 16 + svc #1 << 16 .endif @ MODERN ldr r1, =AgbMain + 1 mov lr, pc