mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Merge pull request #1246 from PikalaxALT/simplify_ram_reset
Simplify RAM reset adaptation for modern
This commit is contained in:
commit
75b12b86dc
@ -91,6 +91,10 @@ Init: @ 8000204
|
|||||||
ldr r1, =INTR_VECTOR
|
ldr r1, =INTR_VECTOR
|
||||||
adr r0, IntrMain
|
adr r0, IntrMain
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
|
.if MODERN
|
||||||
|
mov r0, #255 @ RESET_ALL
|
||||||
|
svc #1 << 16
|
||||||
|
.endif @ MODERN
|
||||||
ldr r1, =AgbMain + 1
|
ldr r1, =AgbMain + 1
|
||||||
mov lr, pc
|
mov lr, pc
|
||||||
bx r1
|
bx r1
|
||||||
|
18
src/main.c
18
src/main.c
@ -85,25 +85,9 @@ void EnableVCountIntrAtLine150(void);
|
|||||||
|
|
||||||
void AgbMain()
|
void AgbMain()
|
||||||
{
|
{
|
||||||
#if MODERN
|
|
||||||
// Modern compilers are liberal with the stack on entry to this function,
|
// Modern compilers are liberal with the stack on entry to this function,
|
||||||
// so RegisterRamReset may crash if it resets IWRAM.
|
// so RegisterRamReset may crash if it resets IWRAM.
|
||||||
RegisterRamReset(RESET_ALL & ~RESET_IWRAM);
|
#if !MODERN
|
||||||
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
|
|
||||||
RegisterRamReset(RESET_ALL);
|
RegisterRamReset(RESET_ALL);
|
||||||
#endif //MODERN
|
#endif //MODERN
|
||||||
*(vu16 *)BG_PLTT = 0x7FFF;
|
*(vu16 *)BG_PLTT = 0x7FFF;
|
||||||
|
Loading…
Reference in New Issue
Block a user