make asm compatible with stock gas
This commit is contained in:
+46
-30
@@ -1,23 +1,38 @@
|
||||
RomBase: @ 8000000
|
||||
.include "constants/gba_constants.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.global Start
|
||||
|
||||
.text
|
||||
|
||||
.arm
|
||||
|
||||
Start: @ 8000000
|
||||
b Init
|
||||
|
||||
.include "asm/rom_header.s"
|
||||
|
||||
@ 80000C0
|
||||
.4byte 0
|
||||
.word 0
|
||||
|
||||
.global GPIOPortData
|
||||
GPIOPortData: @ 80000C4
|
||||
.2byte 0
|
||||
.hword 0
|
||||
|
||||
.global GPIOPortDirection
|
||||
GPIOPortDirection: @ 80000C6
|
||||
.2byte 0
|
||||
.hword 0
|
||||
|
||||
GPIOPortReadWrite: @ 80000C8
|
||||
.2byte 0
|
||||
.global GPIOPortReadEnable
|
||||
GPIOPortReadEnable: @ 80000C8
|
||||
.hword 0
|
||||
|
||||
.incbin "base_emerald.gba", 0xCA, 0x204 - 0xCA
|
||||
|
||||
arm_func_start Init
|
||||
.arm
|
||||
.align 2, 0
|
||||
.global Init
|
||||
Init: @ 8000204
|
||||
mov r0, PSR_IRQ_MODE
|
||||
msr cpsr_cf, r0
|
||||
@@ -34,14 +49,14 @@ Init: @ 8000204
|
||||
b Init
|
||||
|
||||
.align 2, 0
|
||||
sp_sys: .4byte IWRAM_END - 0x1c0
|
||||
sp_irq: .4byte IWRAM_END - 0x60
|
||||
sp_sys: .word IWRAM_END - 0x1c0
|
||||
sp_irq: .word IWRAM_END - 0x60
|
||||
|
||||
.pool
|
||||
|
||||
arm_func_end Init
|
||||
|
||||
arm_func_start InterruptMain
|
||||
.arm
|
||||
.align 2, 0
|
||||
.global InterruptMain
|
||||
InterruptMain: @ 8000248
|
||||
mov r3, REG_BASE
|
||||
add r3, r3, 0x200
|
||||
@@ -54,51 +69,51 @@ InterruptMain: @ 8000248
|
||||
and r1, r2, r2, lsr 16
|
||||
mov r12, 0
|
||||
ands r0, r1, INTR_FLAG_VCOUNT
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
mov r0, 0x1
|
||||
strh r0, [r3, OFFSET_REG_IME - 0x200]
|
||||
ands r0, r1, INTR_FLAG_SERIAL
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_TIMER3
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_HBLANK
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_VBLANK
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_TIMER0
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_TIMER1
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_TIMER2
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_DMA0
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_DMA1
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_DMA2
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_DMA3
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_KEYPAD
|
||||
bne $foundInterrupt
|
||||
bne InterruptMain_FoundIntr
|
||||
add r12, r12, 0x4
|
||||
ands r0, r1, INTR_FLAG_GAMEPAK
|
||||
strbne r0, [r3, OFFSET_REG_SOUNDCNT_X - 0x200]
|
||||
$loop:
|
||||
bne $loop
|
||||
$foundInterrupt:
|
||||
InterruptMain_Loop:
|
||||
bne InterruptMain_Loop
|
||||
InterruptMain_FoundIntr:
|
||||
strh r0, [r3, OFFSET_REG_IF - 0x200]
|
||||
bic r2, r2, r0
|
||||
ldr r0, =0x03007868
|
||||
@@ -118,8 +133,9 @@ $foundInterrupt:
|
||||
add r1, r1, r12
|
||||
ldr r0, [r1]
|
||||
stmdb sp!, {lr}
|
||||
add lr, pc, 0
|
||||
adr lr, InterruptMain_RetAddr
|
||||
bx r0
|
||||
InterruptMain_RetAddr:
|
||||
ldmia sp!, {lr}
|
||||
mrs r3, cpsr
|
||||
bic r3, r3, PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK
|
||||
@@ -133,4 +149,4 @@ $foundInterrupt:
|
||||
|
||||
.pool
|
||||
|
||||
arm_func_end InterruptMain
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
||||
Reference in New Issue
Block a user