summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/crt0.s76
-rw-r--r--asm/dma3_manager.s8
-rw-r--r--asm/gpu_bg.s8
-rw-r--r--asm/gpu_obj.s8
-rw-r--r--asm/libagbbackup.s8
-rw-r--r--asm/libagbsyscall.s8
-rw-r--r--asm/libgcc.s8
-rw-r--r--asm/libgcnmultiboot.s35
-rw-r--r--asm/libmks4agb.s8
-rw-r--r--asm/librfu.s8
-rw-r--r--asm/librtc.s8
-rw-r--r--asm/main.s8
-rw-r--r--asm/main_menu.s8
-rw-r--r--asm/malloc.s8
-rw-r--r--asm/multiboot.s8
-rw-r--r--asm/pixel_buffer.s8
-rw-r--r--asm/rtc.s8
-rw-r--r--asm/string_util.s8
-rw-r--r--asm/task.s8
-rw-r--r--asm/text_renderer.s8
-rw-r--r--asm/tileset_animation.s8
-rw-r--r--asm/window.s8
22 files changed, 229 insertions, 42 deletions
diff --git a/asm/crt0.s b/asm/crt0.s
index a6d0b07d7..08745b5d6 100644
--- a/asm/crt0.s
+++ b/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.
diff --git a/asm/dma3_manager.s b/asm/dma3_manager.s
index 33f0ad976..15c4fbc89 100644
--- a/asm/dma3_manager.s
+++ b/asm/dma3_manager.s
@@ -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.
diff --git a/asm/gpu_bg.s b/asm/gpu_bg.s
index 602020c2b..76b383608 100644
--- a/asm/gpu_bg.s
+++ b/asm/gpu_bg.s
@@ -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.
diff --git a/asm/gpu_obj.s b/asm/gpu_obj.s
index cad02cb5b..2ae2eac56 100644
--- a/asm/gpu_obj.s
+++ b/asm/gpu_obj.s
@@ -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.
diff --git a/asm/libagbbackup.s b/asm/libagbbackup.s
index e5a48a721..01e972431 100644
--- a/asm/libagbbackup.s
+++ b/asm/libagbbackup.s
@@ -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.
diff --git a/asm/libagbsyscall.s b/asm/libagbsyscall.s
index cdfc70350..41f3718b9 100644
--- a/asm/libagbsyscall.s
+++ b/asm/libagbsyscall.s
@@ -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.
diff --git a/asm/libgcc.s b/asm/libgcc.s
index 5d779662a..6e313ee1d 100644
--- a/asm/libgcc.s
+++ b/asm/libgcc.s
@@ -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.
diff --git a/asm/libgcnmultiboot.s b/asm/libgcnmultiboot.s
index e6d1b1eae..7d8e4d340 100644
--- a/asm/libgcnmultiboot.s
+++ b/asm/libgcnmultiboot.s
@@ -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.
diff --git a/asm/libmks4agb.s b/asm/libmks4agb.s
index 1957f7578..c0af24a0e 100644
--- a/asm/libmks4agb.s
+++ b/asm/libmks4agb.s
@@ -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.
diff --git a/asm/librfu.s b/asm/librfu.s
index 51d56376f..d0ee616b2 100644
--- a/asm/librfu.s
+++ b/asm/librfu.s
@@ -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.
diff --git a/asm/librtc.s b/asm/librtc.s
index cabc70f13..6bfc89922 100644
--- a/asm/librtc.s
+++ b/asm/librtc.s
@@ -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.
diff --git a/asm/main.s b/asm/main.s
index fe10dafb0..f02f39ed8 100644
--- a/asm/main.s
+++ b/asm/main.s
@@ -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.
diff --git a/asm/main_menu.s b/asm/main_menu.s
index 9dfc3f5a9..ec3053a9d 100644
--- a/asm/main_menu.s
+++ b/asm/main_menu.s
@@ -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.
diff --git a/asm/malloc.s b/asm/malloc.s
index d9cb84e8e..529b654c7 100644
--- a/asm/malloc.s
+++ b/asm/malloc.s
@@ -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.
diff --git a/asm/multiboot.s b/asm/multiboot.s
index 0600ad5ba..cf072a87c 100644
--- a/asm/multiboot.s
+++ b/asm/multiboot.s
@@ -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.
diff --git a/asm/pixel_buffer.s b/asm/pixel_buffer.s
index 9582e494e..0dcbccd18 100644
--- a/asm/pixel_buffer.s
+++ b/asm/pixel_buffer.s
@@ -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.
diff --git a/asm/rtc.s b/asm/rtc.s
index c9c293d2a..87ff95e80 100644
--- a/asm/rtc.s
+++ b/asm/rtc.s
@@ -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.
diff --git a/asm/string_util.s b/asm/string_util.s
index 5bc343735..6eda21515 100644
--- a/asm/string_util.s
+++ b/asm/string_util.s
@@ -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.
diff --git a/asm/task.s b/asm/task.s
index 27bfaed69..1d5d4d1db 100644
--- a/asm/task.s
+++ b/asm/task.s
@@ -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.
diff --git a/asm/text_renderer.s b/asm/text_renderer.s
index bbf719224..285bcf15a 100644
--- a/asm/text_renderer.s
+++ b/asm/text_renderer.s
@@ -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.
diff --git a/asm/tileset_animation.s b/asm/tileset_animation.s
index b99cc857d..3e6dbfc9a 100644
--- a/asm/tileset_animation.s
+++ b/asm/tileset_animation.s
@@ -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.
diff --git a/asm/window.s b/asm/window.s
index 31ecd0ecb..5ea0462ac 100644
--- a/asm/window.s
+++ b/asm/window.s
@@ -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.