Skip to content

Commit 38a44b1

Browse files
committed
irq_disable reversed, combined irq files
1 parent d47a4c5 commit 38a44b1

5 files changed

Lines changed: 27 additions & 40 deletions

File tree

asm/code_2.s

Lines changed: 0 additions & 13 deletions
This file was deleted.

ldscript.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ SECTIONS
2323
build/crashbandicootxs/src/main.o(.text);
2424
build/crashbandicootxs/src/memory.o(.text);
2525
build/crashbandicootxs/src/irq.o(.text);
26-
build/crashbandicootxs/asm/code_2.o(.text);
27-
build/crashbandicootxs/src/irq2.o(.text);
2826
build/crashbandicootxs/asm/code_3.o(.text);
2927

3028
/* Data */

src/irq.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
extern void* gUnknown_030009E8[5];
44
extern void* gUnknown_03000A20[5];
55
extern void nullsub_10();
6+
extern u32 IntrMain_Buffer;
67

78
// TODO: PROPERLY UNDERSTAND WHAT THIS FUNCTION IS USED FOR, MIGHT BE A CALLBACK INIT FUNCTION FOR SOME TYPE OF MESSAGE
89
// irq_handler_clear_index maybe?
@@ -32,3 +33,27 @@ void sub_80005A0(s32 interruptIndex, s32 arg1) {
3233
gUnknown_030009E8[interruptIndex] = arg1;
3334
REG_IE |= 1 << interruptIndex;
3435
}
36+
37+
38+
void irq_disable(void) {
39+
REG_IME = 0;
40+
}
41+
42+
u32 irq_setup() {
43+
u32* intrbuffer = &IntrMain_Buffer;
44+
u32 data = &nullsub_10;
45+
u32** dst1 = (u32** )0x03000A20;
46+
u32** dst2 = (u32** )0x030009E8;
47+
s32 count = 0xD;
48+
49+
for (;count >= 0;) {
50+
*dst1++ = data;
51+
*dst2++ = data;
52+
count --;
53+
}
54+
55+
INTR_VECTOR = intrbuffer;
56+
REG_IME = 1;
57+
58+
return 0;
59+
}

src/irq2.c

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
s32 mem_heap_init(u32);
55
extern void sub_8000518(); /* extern */
6-
extern void sub_80005D0(); /* extern */
6+
extern void irq_disable(); /* extern */
77
extern u32 irq_setup(); /* extern */
88
extern void sub_8000620(); /* extern */
99
extern s32 sub_8026EEC(); /* extern */
@@ -27,7 +27,7 @@ s32 AgbMain(void) {
2727
return -1;
2828
}
2929

30-
sub_80005D0();
30+
irq_disable();
3131
sub_8000518();
3232

3333
return 0;

0 commit comments

Comments
 (0)