summaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2015-10-10 10:06:17 -0700
committerYamaArashi <shadow962@live.com>2015-10-10 10:06:17 -0700
commit8cb7dcb2daa7f9110e6bc5262d7251920c5ee206 (patch)
tree87023fc78e41008c0c756a40ea16a93f965ec26a /asm
parent14a95252f805c04132eeb80ec9fe9186132bf60d (diff)
add I/O register constants
Diffstat (limited to 'asm')
-rw-r--r--asm/crt0.s52
1 files changed, 26 insertions, 26 deletions
diff --git a/asm/crt0.s b/asm/crt0.s
index b4044495c..6173a2f1a 100644
--- a/asm/crt0.s
+++ b/asm/crt0.s
@@ -40,63 +40,63 @@ sp_irq: .4byte IWRAM_END - 0x60
arm_func_start InterruptMain
InterruptMain:
- mov r3, 0x4000000
+ mov r3, REG_BASE
add r3, r3, 0x200
- ldr r2, [r3]
- ldrh r1, [r3, 0x8]
+ ldr r2, [r3, OFFSET_REG_IE - 0x200]
+ ldrh r1, [r3, OFFSET_REG_IME - 0x200]
mrs r0, spsr
stmdb sp!, {r0-r3,lr}
mov r0, 0
- strh r0, [r3, 0x8]
+ strh r0, [r3, OFFSET_REG_IME - 0x200]
and r1, r2, r2, lsr 16
mov r12, 0
ands r0, r1, INTR_FLAG_VCOUNT
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
mov r0, 0x1
- strh r0, [r3, 0x8]
+ strh r0, [r3, OFFSET_REG_IME - 0x200]
ands r0, r1, INTR_FLAG_SERIAL
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_TIMER3
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_HBLANK
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_VBLANK
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_TIMER0
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_TIMER1
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_TIMER2
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_DMA0
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_DMA1
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_DMA2
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_DMA3
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_KEYPAD
- bne _08000320
+ bne @foundInterrupt
add r12, r12, 0x4
ands r0, r1, INTR_FLAG_GAMEPAK
- strbne r0, [r3, -0x17C]
-_0800031C:
- bne _0800031C
-_08000320:
- strh r0, [r3, 0x2]
+ strbne r0, [r3, OFFSET_REG_SOUNDCNT_X - 0x200]
+@loop:
+ bne @loop
+@foundInterrupt:
+ strh r0, [r3, OFFSET_REG_IF - 0x200]
bic r2, r2, r0
ldr r0, =0x03007868
ldr r0, [r0]
@@ -106,7 +106,7 @@ _08000320:
orr r0, r0, INTR_FLAG_GAMEPAK
orr r1, r0, INTR_FLAG_SERIAL | INTR_FLAG_TIMER3 | INTR_FLAG_VCOUNT | INTR_FLAG_HBLANK
and r1, r1, r2
- strh r1, [r3]
+ strh r1, [r3, OFFSET_REG_IE - 0x200]
mrs r3, cpsr
bic r3, r3, PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK
orr r3, r3, PSR_SYS_MODE
@@ -123,8 +123,8 @@ _08000320:
orr r3, r3, PSR_I_BIT | PSR_IRQ_MODE
msr cpsr_cf, r3
ldmia sp!, {r0-r3,lr}
- strh r2, [r3]
- strh r1, [r3, 0x8]
+ strh r2, [r3, OFFSET_REG_IE - 0x200]
+ strh r1, [r3, OFFSET_REG_IME - 0x200]
msr spsr_cf, r0
bx lr