mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
make asm compatible with stock gas
This commit is contained in:
parent
f910e326a1
commit
a05857f889
76
asm/crt0.s
76
asm/crt0.s
@ -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.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start ClearDma3Requests
|
||||
@ void ClearDma3Requests()
|
||||
ClearDma3Requests: @ 8000BB8
|
||||
@ -544,3 +550,5 @@ _08000FDC:
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end CheckForSpaceForDma3Request
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start ResetBgs
|
||||
@ void ResetBgs()
|
||||
ResetBgs: @ 80012F0
|
||||
@ -3354,3 +3360,5 @@ _08002BD6:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end IsTileMapOutsideWram
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start ResetAllObjectData
|
||||
@ void ResetAllObjectData()
|
||||
ResetAllObjectData: @ 8006974
|
||||
@ -4551,3 +4557,5 @@ _08008AE6:
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end AddSpritesFromSpriteOamTable
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start SwitchFlashBank
|
||||
SwitchFlashBank: @ 82E185C
|
||||
lsls r0, 24
|
||||
@ -1069,3 +1075,5 @@ _082E2146:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end ProgramFlashSector
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start ArcTan2
|
||||
ArcTan2: @ 82E7078
|
||||
swi 0xA
|
||||
@ -105,3 +111,5 @@ VBlankIntrWait: @ 82E70C8
|
||||
swi 0x5
|
||||
bx lr
|
||||
thumb_func_end VBlankIntrWait
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start _call_via_r0
|
||||
_call_via_r0: @ 82E70D0
|
||||
bx r0
|
||||
@ -5228,3 +5234,5 @@ _082E951C:
|
||||
bne _082E951C
|
||||
adds r0, r6, 0
|
||||
pop {r4-r6,pc}
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,9 +1,18 @@
|
||||
@ This library can be used to download and execute a multi-boot image from
|
||||
@ a GameCube using the JOY Bus protocol over the link cable.
|
||||
|
||||
.set GCMB_STRUCT_BASE_DEST_PTR, 0x20
|
||||
.set GCMB_STRUCT_CUR_DEST_PTR, 0x24
|
||||
.set GCMB_STRUCT_SERIAL_INTR_HANDLER, 0x28
|
||||
.include "asm/macros.s"
|
||||
.include "constants/constants.s"
|
||||
|
||||
.equiv GCMB_STRUCT_BASE_DEST_PTR, 0x20
|
||||
.equiv GCMB_STRUCT_CUR_DEST_PTR, 0x24
|
||||
.equiv GCMB_STRUCT_SERIAL_INTR_HANDLER, 0x28
|
||||
|
||||
.equiv ROM_HEADER_NINTENDO_LOGO_OFFSET, 0x4
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start GameCubeMultiBoot_Hash
|
||||
GameCubeMultiBoot_Hash: @ 82DED70
|
||||
@ -12,15 +21,15 @@ GameCubeMultiBoot_Hash: @ 82DED70
|
||||
eors r3, r1
|
||||
movs r2, 0x20
|
||||
|
||||
$loop:
|
||||
GameCubeMultiBoot_Hash_Loop:
|
||||
lsrs r3, 1
|
||||
bcc $skipEor
|
||||
bcc GameCubeMultiBoot_Hash_SkipEor
|
||||
|
||||
eors r3, r4
|
||||
|
||||
$skipEor:
|
||||
GameCubeMultiBoot_Hash_SkipEor:
|
||||
subs r2, 0x1
|
||||
bne $loop
|
||||
bne GameCubeMultiBoot_Hash_Loop
|
||||
|
||||
pop {r4,pc}
|
||||
thumb_func_end GameCubeMultiBoot_Hash
|
||||
@ -61,7 +70,7 @@ _082DEDAA:
|
||||
bcc _082DEE76
|
||||
push {r4-r6}
|
||||
movs r1, 0x98
|
||||
adds r2, RomHeaderNintendoLogo - RomBase
|
||||
adds r2, ROM_HEADER_NINTENDO_LOGO_OFFSET
|
||||
ldr r4, pool_NintendoLogo
|
||||
_082DEDC6:
|
||||
ldm r2!, {r5}
|
||||
@ -175,14 +184,14 @@ pool_NintendoLogo: .4byte RomHeaderNintendoLogo
|
||||
GameCubeMultiBoot_ExecuteProgram: @ 82DEE84
|
||||
ldrb r1, [r0, 0x2]
|
||||
cmp r1, 0x2
|
||||
bne $unableToExecute
|
||||
bne GameCubeMultiBoot_ExecuteProgram_Fail
|
||||
ldr r3, pool_InterruptRegs
|
||||
movs r1, 0
|
||||
strh r1, [r3, OFFSET_REG_IME - 0x200]
|
||||
ldr r1, pool_MultiBootLoadAddr
|
||||
adds r1, 0xC0
|
||||
bx r1
|
||||
$unableToExecute:
|
||||
GameCubeMultiBoot_ExecuteProgram_Fail:
|
||||
bx lr
|
||||
thumb_func_end GameCubeMultiBoot_ExecuteProgram
|
||||
|
||||
@ -213,10 +222,10 @@ GameCubeMultiBoot_Init: @ 82DEE98
|
||||
adds r3, GCMB_STRUCT_BASE_DEST_PTR
|
||||
|
||||
@ clear all but the last 3 fields of the struct
|
||||
$clearStructLoop:
|
||||
GameCubeMultiBoot_Init_ClearStructLoop:
|
||||
stm r0!, {r1}
|
||||
cmp r0, r3
|
||||
blo $clearStructLoop
|
||||
blo GameCubeMultiBoot_Init_ClearStructLoop
|
||||
|
||||
pop {r0,r3}
|
||||
lsrs r3, 1
|
||||
@ -537,3 +546,5 @@ pool_RegDispstat: .4byte REG_DISPSTAT
|
||||
pool_RubyUSAGameCode: .ascii "AXVE"
|
||||
|
||||
pool_MultiBootLoadAddr: .4byte EWRAM_START
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start umul3232H32
|
||||
umul3232H32: @ 82DF04C
|
||||
adr r2, _082DF050
|
||||
@ -5282,3 +5288,5 @@ sub_82E1850: @ 82E1850
|
||||
.align 2, 0
|
||||
_082E1858: .4byte 0x030077b0
|
||||
thumb_func_end sub_82E1850
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start STWI_init_all
|
||||
STWI_init_all: @ 82E2A18
|
||||
push {r4,lr}
|
||||
@ -8913,3 +8919,5 @@ _082E706C: .4byte 0x0000494e
|
||||
_082E7070: .4byte 0x00000257
|
||||
_082E7074: .4byte 0x04000128
|
||||
thumb_func_end sub_82E6FA2
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start RTC_SetReadWrite
|
||||
@ void RTC_SetReadWrite()
|
||||
RTC_SetReadWrite: @ 82E2150
|
||||
@ -1150,3 +1156,5 @@ RTC_SetReadOnlyInternal: @ 82E2A04
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end RTC_SetReadOnlyInternal
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start Main
|
||||
Main:
|
||||
push {r4-r7,lr}
|
||||
@ -711,3 +717,5 @@ sub_8000964: @ 8000964
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8000964
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start CB2_MainMenu
|
||||
@ void CB2_MainMenu()
|
||||
CB2_MainMenu: @ 802F6B0
|
||||
@ -5466,3 +5472,5 @@ _08032644:
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end task_new_game_prof_birch_speech_part2_1
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start PutMemBlockHeader
|
||||
@ void PutMemBlockHeader(void *block, struct MemBlock *prev, struct MemBlock *next, u32 size)
|
||||
PutMemBlockHeader: @ 8000988
|
||||
@ -329,3 +335,5 @@ _08000BB2:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end CheckHeap
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start MultiBootInit
|
||||
@ void MultiBootInit(MultiBootParam *mp)
|
||||
MultiBootInit: @ 81BA6D0
|
||||
@ -895,3 +901,5 @@ _081BAD6C:
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end MultiBootWaitSendDone
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start BlitBitmapRect4BitWithoutColorKey
|
||||
@ void BlitBitmapRect4BitWithoutColorKey(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height)
|
||||
BlitBitmapRect4BitWithoutColorKey: @ 8002BDC
|
||||
@ -812,3 +818,5 @@ _080031AC:
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end FillBitmapRect8Bit
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start GameFreakRTC_ClearIME
|
||||
@ void GameFreakRTC_ClearIME()
|
||||
GameFreakRTC_ClearIME: @ 802F0CC
|
||||
@ -808,3 +814,5 @@ GameFreakRTC_GetNumDays: @ 802F69C
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end GameFreakRTC_GetNumDays
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start CopyString_Limit10
|
||||
@ u8 *CopyString_Limit10(u8 *dest, u8 *src)
|
||||
CopyString_Limit10: @ 8008B10
|
||||
@ -1361,3 +1367,5 @@ _080093C0:
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end StripExtendedControlCodes
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start clear_tasks
|
||||
@ void clear_tasks()
|
||||
clear_tasks: @ 80A8F50
|
||||
@ -518,3 +524,5 @@ _080A92E8:
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end get_word_task_arg
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start SetFontsPointer
|
||||
@ void SetFontsPointer(struct FontInfo *fonts)
|
||||
SetFontsPointer: @ 80045A4
|
||||
@ -4625,3 +4631,5 @@ DecompressGlyphFont9: @ 8006928
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end DecompressGlyphFont9
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_80A0954
|
||||
@ void sub_80A0954()
|
||||
sub_80A0954: @ 80A0954
|
||||
@ -1870,3 +1876,5 @@ _080A18D6:
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80A1884
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -1,3 +1,9 @@
|
||||
.include "asm/macros.s"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start nullsub_8
|
||||
nullsub_8: @ 80031BC
|
||||
bx lr
|
||||
@ -2598,3 +2604,5 @@ _08004590:
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end GetNumActiveWindowsOnBg8Bit
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
Loading…
Reference in New Issue
Block a user