mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
use more constants in InterruptMain
This commit is contained in:
parent
9024595c93
commit
064051d247
40
asm/crt0.s
40
asm/crt0.s
@ -50,48 +50,48 @@ InterruptMain:
|
|||||||
strh r0, [r3, 0x8]
|
strh r0, [r3, 0x8]
|
||||||
and r1, r2, r2, lsr 16
|
and r1, r2, r2, lsr 16
|
||||||
mov r12, 0
|
mov r12, 0
|
||||||
ands r0, r1, 0x4
|
ands r0, r1, INTR_FLAG_VCOUNT
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
mov r0, 0x1
|
mov r0, 0x1
|
||||||
strh r0, [r3, 0x8]
|
strh r0, [r3, 0x8]
|
||||||
ands r0, r1, 0x80
|
ands r0, r1, INTR_FLAG_SERIAL
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x40
|
ands r0, r1, INTR_FLAG_TIMER3
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x2
|
ands r0, r1, INTR_FLAG_HBLANK
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x1
|
ands r0, r1, INTR_FLAG_VBLANK
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x8
|
ands r0, r1, INTR_FLAG_TIMER0
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x10
|
ands r0, r1, INTR_FLAG_TIMER1
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x20
|
ands r0, r1, INTR_FLAG_TIMER2
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x100
|
ands r0, r1, INTR_FLAG_DMA0
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x200
|
ands r0, r1, INTR_FLAG_DMA1
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x400
|
ands r0, r1, INTR_FLAG_DMA2
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x800
|
ands r0, r1, INTR_FLAG_DMA3
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x1000
|
ands r0, r1, INTR_FLAG_KEYPAD
|
||||||
bne _08000320
|
bne _08000320
|
||||||
add r12, r12, 0x4
|
add r12, r12, 0x4
|
||||||
ands r0, r1, 0x2000
|
ands r0, r1, INTR_FLAG_GAMEPAK
|
||||||
strbne r0, [r3, -0x17C]
|
strbne r0, [r3, -0x17C]
|
||||||
_0800031C:
|
_0800031C:
|
||||||
bne _0800031C
|
bne _0800031C
|
||||||
@ -103,13 +103,13 @@ _08000320:
|
|||||||
ldrb r0, [r0, 0xA]
|
ldrb r0, [r0, 0xA]
|
||||||
mov r1, 0x8
|
mov r1, 0x8
|
||||||
mov r0, r1, lsl r0
|
mov r0, r1, lsl r0
|
||||||
orr r0, r0, 0x2000
|
orr r0, r0, INTR_FLAG_GAMEPAK
|
||||||
orr r1, r0, 0xC6
|
orr r1, r0, INTR_FLAG_SERIAL | INTR_FLAG_TIMER3 | INTR_FLAG_VCOUNT | INTR_FLAG_HBLANK
|
||||||
and r1, r1, r2
|
and r1, r1, r2
|
||||||
strh r1, [r3]
|
strh r1, [r3]
|
||||||
mrs r3, cpsr
|
mrs r3, cpsr
|
||||||
bic r3, r3, 0xDF
|
bic r3, r3, PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK
|
||||||
orr r3, r3, 0x1F
|
orr r3, r3, PSR_SYS_MODE
|
||||||
msr cpsr_cf, r3
|
msr cpsr_cf, r3
|
||||||
ldr r1, =0x03002710
|
ldr r1, =0x03002710
|
||||||
add r1, r1, r12
|
add r1, r1, r12
|
||||||
@ -119,8 +119,8 @@ _08000320:
|
|||||||
bx r0
|
bx r0
|
||||||
ldmia sp!, {lr}
|
ldmia sp!, {lr}
|
||||||
mrs r3, cpsr
|
mrs r3, cpsr
|
||||||
bic r3, r3, 0xDF
|
bic r3, r3, PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK
|
||||||
orr r3, r3, 0x92
|
orr r3, r3, PSR_I_BIT | PSR_IRQ_MODE
|
||||||
msr cpsr_cf, r3
|
msr cpsr_cf, r3
|
||||||
ldmia sp!, {r0-r3,lr}
|
ldmia sp!, {r0-r3,lr}
|
||||||
strh r2, [r3]
|
strh r2, [r3]
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
.set PSR_USR_MODE, 0x00000010
|
.set PSR_USR_MODE, 0x00000010
|
||||||
.set PSR_FIQ_MODE, 0x00000011
|
.set PSR_FIQ_MODE, 0x00000011
|
||||||
.set PSR_IRQ_MODE, 0x00000012
|
.set PSR_IRQ_MODE, 0x00000012
|
||||||
.set PSR_SVC_MODE, 0x00000013
|
.set PSR_SVC_MODE, 0x00000013
|
||||||
.set PSR_ABT_MODE, 0x00000017
|
.set PSR_ABT_MODE, 0x00000017
|
||||||
.set PSR_UND_MODE, 0x0000001b
|
.set PSR_UND_MODE, 0x0000001b
|
||||||
.set PSR_SYS_MODE, 0x0000001f
|
.set PSR_SYS_MODE, 0x0000001f
|
||||||
|
.set PSR_MODE_MASK, 0x0000001f
|
||||||
|
.set PSR_T_BIT, 0x00000020
|
||||||
|
.set PSR_F_BIT, 0x00000040
|
||||||
|
.set PSR_I_BIT, 0x00000080
|
||||||
|
|
||||||
.set EWRAM_START, 0x02000000
|
.set EWRAM_START, 0x02000000
|
||||||
.set EWRAM_END, EWRAM_START + 0x40000
|
.set EWRAM_END, EWRAM_START + 0x40000
|
||||||
@ -12,3 +16,18 @@
|
|||||||
.set IWRAM_END, IWRAM_START + 0x8000
|
.set IWRAM_END, IWRAM_START + 0x8000
|
||||||
|
|
||||||
.set INTR_VECTOR, IWRAM_END - 0x4
|
.set INTR_VECTOR, IWRAM_END - 0x4
|
||||||
|
|
||||||
|
.set INTR_FLAG_VBLANK, 1 << 0
|
||||||
|
.set INTR_FLAG_HBLANK, 1 << 1
|
||||||
|
.set INTR_FLAG_VCOUNT, 1 << 2
|
||||||
|
.set INTR_FLAG_TIMER0, 1 << 3
|
||||||
|
.set INTR_FLAG_TIMER1, 1 << 4
|
||||||
|
.set INTR_FLAG_TIMER2, 1 << 5
|
||||||
|
.set INTR_FLAG_TIMER3, 1 << 6
|
||||||
|
.set INTR_FLAG_SERIAL, 1 << 7
|
||||||
|
.set INTR_FLAG_DMA0, 1 << 8
|
||||||
|
.set INTR_FLAG_DMA1, 1 << 9
|
||||||
|
.set INTR_FLAG_DMA2, 1 << 10
|
||||||
|
.set INTR_FLAG_DMA3, 1 << 11
|
||||||
|
.set INTR_FLAG_KEYPAD, 1 << 12
|
||||||
|
.set INTR_FLAG_GAMEPAK, 1 << 13
|
||||||
|
Loading…
Reference in New Issue
Block a user