summaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
Diffstat (limited to 'asm')
-rw-r--r--asm/battle_1.s2
-rw-r--r--asm/battle_9.s2
-rw-r--r--asm/battle_anim_812C144.s40
-rw-r--r--asm/battle_anim_813F0F4.s2
-rwxr-xr-xasm/battle_intro.s50
-rwxr-xr-xasm/bug.s825
-rw-r--r--asm/contest_ai.s2
-rw-r--r--asm/contest_effect.s2
-rw-r--r--asm/contest_link_80C2020.s30
-rw-r--r--asm/contest_link_80C857C.s2
-rw-r--r--asm/crt0.s227
-rwxr-xr-xasm/current.s2
-rw-r--r--asm/cute_sketch.s2
-rwxr-xr-xasm/dark.s42
-rwxr-xr-xasm/dragon.s1214
-rwxr-xr-xasm/fight.s14
-rwxr-xr-xasm/flying.s2
-rwxr-xr-xasm/ghost.s8
-rwxr-xr-xasm/ground.s66
-rwxr-xr-xasm/ice.s2
-rw-r--r--asm/libagbsyscall.s91
-rw-r--r--asm/libgcnmultiboot.s641
-rw-r--r--asm/m4a_1.s1911
-rw-r--r--asm/m4a_3.s2
-rw-r--r--asm/macros.inc149
-rw-r--r--asm/macros/asm.inc17
-rw-r--r--asm/macros/battle_ai_script.inc554
-rw-r--r--asm/macros/battle_anim.inc266
-rw-r--r--asm/macros/battle_script.inc1414
-rw-r--r--asm/macros/contest_ai_script.inc506
-rw-r--r--asm/macros/ec.inc8
-rw-r--r--asm/macros/event.inc1481
-rw-r--r--asm/macros/field_effect_script.inc42
-rw-r--r--asm/macros/function.inc29
-rw-r--r--asm/macros/m4a.inc13
-rw-r--r--asm/macros/map.inc96
-rw-r--r--asm/macros/movement.inc116
-rw-r--r--asm/macros/music_voice.inc125
-rw-r--r--asm/macros/pokemon_data.inc57
-rwxr-xr-xasm/normal.s34
-rwxr-xr-xasm/pc_screen_effect.s2
-rwxr-xr-xasm/poison.s364
-rw-r--r--asm/pokedex_area_screen.s2
-rw-r--r--asm/pokedex_cry_screen.s2
-rw-r--r--asm/pokemon_item_effect.s2
-rw-r--r--asm/pokemon_storage_system.s2
-rw-r--r--asm/pokenav.s24
-rwxr-xr-xasm/psychic.s16
-rwxr-xr-xasm/rock.s12
-rwxr-xr-xasm/unk_text_8095904.s2
-rwxr-xr-xasm/water.s46
-rwxr-xr-xasm/wisp_fire.s678
52 files changed, 208 insertions, 11032 deletions
diff --git a/asm/battle_1.s b/asm/battle_1.s
index da604c6b6..980bd6a65 100644
--- a/asm/battle_1.s
+++ b/asm/battle_1.s
@@ -1,6 +1,6 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/battle_9.s b/asm/battle_9.s
index b86914ca6..fc4cbcf4b 100644
--- a/asm/battle_9.s
+++ b/asm/battle_9.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/battle_anim_812C144.s b/asm/battle_anim_812C144.s
index 02eec98ec..03ffc0eda 100644
--- a/asm/battle_anim_812C144.s
+++ b/asm/battle_anim_812C144.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -1752,7 +1752,7 @@ _0812CE70:
ldrsh r0, [r5, r6]
cmp r1, r0
bgt _0812CEA6
- ldr r4, _0812CEB0 @ =gUnknown_03004DE0
+ ldr r4, _0812CEB0 @ =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r0, r4
@@ -1777,7 +1777,7 @@ _0812CEA6:
ldr r0, _0812CEB4 @ =REG_BG1HOFS
b _0812CEBA
.align 2, 0
-_0812CEB0: .4byte gUnknown_03004DE0
+_0812CEB0: .4byte gScanlineEffectRegBuffers
_0812CEB4: .4byte REG_BG1HOFS
_0812CEB8:
ldr r0, _0812CEE4 @ =REG_BG2HOFS
@@ -1794,7 +1794,7 @@ _0812CEBA:
ldr r0, [sp]
ldr r1, [sp, 0x4]
ldr r2, [sp, 0x8]
- bl sub_80895F8
+ bl ScanlineEffect_SetParams
ldr r0, _0812CEEC @ =sub_812CEF0
str r0, [r5]
add sp, 0xC
@@ -1889,7 +1889,7 @@ _0812CF74:
ldrsh r0, [r4, r2]
cmp r1, r0
bge _0812CFA8
- ldr r5, _0812D000 @ =gUnknown_03004DE0
+ ldr r5, _0812D000 @ =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r6, r5, r0
@@ -1917,7 +1917,7 @@ _0812CFA8:
ldrsh r0, [r4, r2]
cmp r1, r0
bgt _0812CFDC
- ldr r5, _0812D000 @ =gUnknown_03004DE0
+ ldr r5, _0812D000 @ =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r6, r5, r0
@@ -1946,7 +1946,7 @@ _0812CFDC:
ldrsh r0, [r4, r1]
cmp r0, 0
beq _0812CFF2
- ldr r1, _0812D004 @ =gUnknown_03004DC0
+ ldr r1, _0812D004 @ =gScanlineEffect
movs r0, 0x3
strb r0, [r1, 0x15]
_0812CFF2:
@@ -1957,8 +1957,8 @@ _0812CFF8:
pop {r0}
bx r0
.align 2, 0
-_0812D000: .4byte gUnknown_03004DE0
-_0812D004: .4byte gUnknown_03004DC0
+_0812D000: .4byte gScanlineEffectRegBuffers
+_0812D004: .4byte gScanlineEffect
thumb_func_end sub_812CEF0
thumb_func_start sub_812D008
@@ -6545,7 +6545,7 @@ _0812F3EE:
ldrh r3, [r0]
movs r7, 0
movs r2, 0
- ldr r6, _0812F468 @ =gUnknown_03004DE0
+ ldr r6, _0812F468 @ =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r0, r6
@@ -6586,7 +6586,7 @@ _0812F3FE:
ldr r0, [sp]
ldr r1, [sp, 0x4]
ldr r2, [sp, 0x8]
- bl sub_80895F8
+ bl ScanlineEffect_SetParams
ldr r0, _0812F470 @ =sub_812F474
str r0, [r4]
add sp, 0xC
@@ -6599,7 +6599,7 @@ _0812F458: .4byte REG_BLDCNT
_0812F45C: .4byte 0x00003f44
_0812F460: .4byte gBattle_BG2_X
_0812F464: .4byte gBattle_BG2_Y
-_0812F468: .4byte gUnknown_03004DE0
+_0812F468: .4byte gScanlineEffectRegBuffers
_0812F46C: .4byte 0xa6600001
_0812F470: .4byte sub_812F474
thumb_func_end sub_812F314
@@ -6711,7 +6711,7 @@ _0812F4EA:
ldrsh r0, [r6, r3]
cmp r1, r0
ble _0812F60A
- ldr r0, _0812F660 @ =gUnknown_03004DC0
+ ldr r0, _0812F660 @ =gScanlineEffect
mov r10, r0
ldr r1, [sp, 0x4]
lsls r0, r1, 16
@@ -6732,7 +6732,7 @@ _0812F55A:
subs r0, r1
lsls r0, 7
adds r2, r0
- ldr r0, _0812F664 @ =gUnknown_03004DE0
+ ldr r0, _0812F664 @ =gScanlineEffectRegBuffers
adds r2, r0
lsls r4, 16
asrs r4, 16
@@ -6750,7 +6750,7 @@ _0812F55A:
subs r0, r1
lsls r0, 7
adds r3, r0
- ldr r1, _0812F664 @ =gUnknown_03004DE0
+ ldr r1, _0812F664 @ =gScanlineEffectRegBuffers
adds r3, r1
lsls r1, r7, 16
asrs r1, 16
@@ -6814,7 +6814,7 @@ _0812F60A:
lsls r1, r2, 17
cmp r1, 0
blt _0812F636
- ldr r4, _0812F664 @ =gUnknown_03004DE0
+ ldr r4, _0812F664 @ =gScanlineEffectRegBuffers
ldr r7, [sp, 0x4]
lsls r0, r7, 16
asrs r0, 16
@@ -6856,8 +6856,8 @@ _0812F636:
strh r0, [r6, 0xE]
b _0812F676
.align 2, 0
-_0812F660: .4byte gUnknown_03004DC0
-_0812F664: .4byte gUnknown_03004DE0
+_0812F660: .4byte gScanlineEffect
+_0812F664: .4byte gScanlineEffectRegBuffers
_0812F668: .4byte gSineTable
_0812F66C: .4byte 0xffff0000
_0812F670:
@@ -6898,14 +6898,14 @@ _0812F6A6:
asrs r0, 16
cmp r0, 0xC
ble _0812F712
- ldr r1, _0812F6C0 @ =gUnknown_03004DC0
+ ldr r1, _0812F6C0 @ =gScanlineEffect
movs r0, 0x3
strb r0, [r1, 0x15]
movs r0, 0
strh r0, [r6, 0xC]
b _0812F700
.align 2, 0
-_0812F6C0: .4byte gUnknown_03004DC0
+_0812F6C0: .4byte gScanlineEffect
_0812F6C4:
ldrh r0, [r6, 0xC]
adds r0, 0x1
diff --git a/asm/battle_anim_813F0F4.s b/asm/battle_anim_813F0F4.s
index fb9c25a82..ccb4854af 100644
--- a/asm/battle_anim_813F0F4.s
+++ b/asm/battle_anim_813F0F4.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/battle_intro.s b/asm/battle_intro.s
index 4bfcf42fb..5b29f56a4 100755
--- a/asm/battle_intro.s
+++ b/asm/battle_intro.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -299,9 +299,9 @@ _080E45E6:
strh r0, [r1, 0xC]
_080E45FE:
movs r3, 0
- ldr r5, _080E46A0 @ =gUnknown_03004DC0
+ ldr r5, _080E46A0 @ =gScanlineEffect
mov r9, r5
- ldr r7, _080E46A4 @ =gUnknown_03004DE0
+ ldr r7, _080E46A4 @ =gScanlineEffectRegBuffers
mov r6, r9
adds r5, r1, 0
_080E460A:
@@ -319,8 +319,8 @@ _080E460A:
ble _080E460A
cmp r3, 0x9F
bgt _080E464E
- ldr r7, _080E46A4 @ =gUnknown_03004DE0
- ldr r6, _080E46A0 @ =gUnknown_03004DC0
+ ldr r7, _080E46A4 @ =gScanlineEffectRegBuffers
+ ldr r6, _080E46A0 @ =gScanlineEffect
ldr r1, _080E46A8 @ =gTasks
mov r2, r12
adds r0, r2, r4
@@ -377,8 +377,8 @@ _080E4690: .4byte gBattle_BG1_Y
_080E4694: .4byte 0x0000ffc8
_080E4698: .4byte gBattle_WIN0V
_080E469C: .4byte 0xfffffc04
-_080E46A0: .4byte gUnknown_03004DC0
-_080E46A4: .4byte gUnknown_03004DE0
+_080E46A0: .4byte gScanlineEffect
+_080E46A4: .4byte gScanlineEffectRegBuffers
_080E46A8: .4byte gTasks
_080E46AC: .4byte 0x0600e000
_080E46B0: .4byte 0x05000200
@@ -669,9 +669,9 @@ _080E48CC:
strh r0, [r1, 0xC]
_080E48E0:
movs r3, 0
- ldr r4, _080E4978 @ =gUnknown_03004DC0
+ ldr r4, _080E4978 @ =gScanlineEffect
mov r8, r4
- ldr r0, _080E497C @ =gUnknown_03004DE0
+ ldr r0, _080E497C @ =gScanlineEffectRegBuffers
mov r12, r0
mov r7, r8
adds r4, r1, 0
@@ -690,9 +690,9 @@ _080E48EE:
ble _080E48EE
cmp r3, 0x9F
bgt _080E4932
- ldr r1, _080E497C @ =gUnknown_03004DE0
+ ldr r1, _080E497C @ =gScanlineEffectRegBuffers
mov r12, r1
- ldr r7, _080E4978 @ =gUnknown_03004DC0
+ ldr r7, _080E4978 @ =gScanlineEffect
ldr r1, _080E4980 @ =gTasks
adds r0, r6, r5
lsls r0, 3
@@ -745,8 +745,8 @@ _080E4932:
.align 2, 0
_080E4970: .4byte gBattle_WIN0V
_080E4974: .4byte 0xfffffc04
-_080E4978: .4byte gUnknown_03004DC0
-_080E497C: .4byte gUnknown_03004DE0
+_080E4978: .4byte gScanlineEffect
+_080E497C: .4byte gScanlineEffectRegBuffers
_080E4980: .4byte gTasks
_080E4984: .4byte 0x0600e000
_080E4988: .4byte 0x05000200
@@ -978,9 +978,9 @@ _080E4B3A:
strh r0, [r1, 0xC]
_080E4B50:
movs r3, 0
- ldr r6, _080E4BE8 @ =gUnknown_03004DC0
+ ldr r6, _080E4BE8 @ =gScanlineEffect
mov r8, r6
- ldr r7, _080E4BEC @ =gUnknown_03004DE0
+ ldr r7, _080E4BEC @ =gScanlineEffectRegBuffers
adds r5, r1, 0
_080E4B5A:
lsls r2, r3, 1
@@ -997,8 +997,8 @@ _080E4B5A:
ble _080E4B5A
cmp r3, 0x9F
bgt _080E4B9E
- ldr r7, _080E4BEC @ =gUnknown_03004DE0
- ldr r6, _080E4BE8 @ =gUnknown_03004DC0
+ ldr r7, _080E4BEC @ =gScanlineEffectRegBuffers
+ ldr r6, _080E4BE8 @ =gScanlineEffect
ldr r1, _080E4BF0 @ =gTasks
mov r2, r12
adds r0, r2, r4
@@ -1053,8 +1053,8 @@ _080E4B9E:
.align 2, 0
_080E4BE0: .4byte gBattle_WIN0V
_080E4BE4: .4byte 0xfffffc04
-_080E4BE8: .4byte gUnknown_03004DC0
-_080E4BEC: .4byte gUnknown_03004DE0
+_080E4BE8: .4byte gScanlineEffect
+_080E4BEC: .4byte gScanlineEffectRegBuffers
_080E4BF0: .4byte gTasks
_080E4BF4: .4byte 0x0600e000
_080E4BF8: .4byte 0x05000200
@@ -1323,9 +1323,9 @@ _080E4E00:
strh r0, [r1, 0xC]
_080E4E16:
movs r3, 0
- ldr r0, _080E4EA4 @ =gUnknown_03004DC0
+ ldr r0, _080E4EA4 @ =gScanlineEffect
mov r9, r0
- ldr r2, _080E4EA8 @ =gUnknown_03004DE0
+ ldr r2, _080E4EA8 @ =gScanlineEffectRegBuffers
mov r8, r2
mov r7, r9
adds r4, r1, 0
@@ -1344,9 +1344,9 @@ _080E4E24:
ble _080E4E24
cmp r3, 0x9F
bgt _080E4E68
- ldr r0, _080E4EA8 @ =gUnknown_03004DE0
+ ldr r0, _080E4EA8 @ =gScanlineEffectRegBuffers
mov r8, r0
- ldr r7, _080E4EA4 @ =gUnknown_03004DC0
+ ldr r7, _080E4EA4 @ =gScanlineEffect
ldr r1, _080E4EAC @ =gTasks
adds r0, r5, r6
lsls r0, 3
@@ -1395,8 +1395,8 @@ _080E4E94:
.align 2, 0
_080E4E9C: .4byte gBattle_WIN0V
_080E4EA0: .4byte 0xfffffc04
-_080E4EA4: .4byte gUnknown_03004DC0
-_080E4EA8: .4byte gUnknown_03004DE0
+_080E4EA4: .4byte gScanlineEffect
+_080E4EA8: .4byte gScanlineEffectRegBuffers
_080E4EAC: .4byte gTasks
_080E4EB0: .4byte REG_BG1CNT
_080E4EB4:
diff --git a/asm/bug.s b/asm/bug.s
deleted file mode 100755
index 83170e9a7..000000000
--- a/asm/bug.s
+++ /dev/null
@@ -1,825 +0,0 @@
- .include "constants/gba_constants.inc"
- .include "asm/macros.inc"
-
- .syntax unified
-
- .text
-
- @ bug
-
- thumb_func_start sub_80DC824
-sub_80DC824: @ 80DC824
- push {r4-r6,lr}
- adds r6, r0, 0
- bl IsContest
- lsls r0, 24
- cmp r0, 0
- beq _080DC850
- adds r0, r6, 0
- movs r1, 0x2
- bl StartSpriteAffineAnim
- ldr r0, _080DC84C @ =gBattleAnimArgs
- ldrh r1, [r0, 0x4]
- negs r1, r1
- strh r1, [r0, 0x4]
- ldrh r1, [r0]
- negs r1, r1
- strh r1, [r0]
- b _080DC880
- .align 2, 0
-_080DC84C: .4byte gBattleAnimArgs
-_080DC850:
- ldr r0, _080DC8E4 @ =gAnimBankTarget
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- bne _080DC880
- adds r0, r6, 0
- movs r1, 0x1
- bl StartSpriteAffineAnim
- ldr r1, _080DC8E8 @ =gBattleAnimArgs
- ldrh r0, [r1, 0x2]
- negs r0, r0
- strh r0, [r1, 0x2]
- ldrh r0, [r1, 0x4]
- negs r0, r0
- strh r0, [r1, 0x4]
- ldrh r0, [r1, 0x6]
- negs r0, r0
- strh r0, [r1, 0x6]
- ldrh r0, [r1]
- negs r0, r0
- strh r0, [r1]
-_080DC880:
- ldr r5, _080DC8E4 @ =gAnimBankTarget
- ldrb r0, [r5]
- movs r1, 0x2
- bl sub_8077EE4
- lsls r0, 24
- ldr r4, _080DC8E8 @ =gBattleAnimArgs
- lsrs r0, 24
- ldrh r1, [r4]
- adds r0, r1
- strh r0, [r6, 0x20]
- ldrb r0, [r5]
- movs r1, 0x3
- bl sub_8077EE4
- lsls r0, 24
- lsrs r0, 24
- ldrh r1, [r4, 0x2]
- adds r0, r1
- strh r0, [r6, 0x22]
- ldrh r0, [r4, 0x8]
- strh r0, [r6, 0x2E]
- ldrb r0, [r5]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- ldrh r1, [r4, 0x4]
- adds r0, r1
- strh r0, [r6, 0x32]
- ldrb r0, [r5]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- ldrh r4, [r4, 0x6]
- adds r0, r4
- strh r0, [r6, 0x36]
- ldr r0, _080DC8EC @ =sub_8078B34
- str r0, [r6, 0x1C]
- ldr r1, _080DC8F0 @ =DestroyAnimSprite
- adds r0, r6, 0
- bl StoreSpriteCallbackInData
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_080DC8E4: .4byte gAnimBankTarget
-_080DC8E8: .4byte gBattleAnimArgs
-_080DC8EC: .4byte sub_8078B34
-_080DC8F0: .4byte DestroyAnimSprite
- thumb_func_end sub_80DC824
-
- thumb_func_start sub_80DC8F4
-sub_80DC8F4: @ 80DC8F4
- push {r4-r6,lr}
- adds r6, r0, 0
- bl IsContest
- lsls r0, 24
- cmp r0, 0
- beq _080DC918
- ldr r1, _080DC914 @ =gBattleAnimArgs
- ldrh r0, [r1]
- negs r0, r0
- strh r0, [r1]
- adds r0, r6, 0
- movs r1, 0x2
- bl StartSpriteAffineAnim
- b _080DC934
- .align 2, 0
-_080DC914: .4byte gBattleAnimArgs
-_080DC918:
- ldr r0, _080DC990 @ =gAnimBankTarget
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- bne _080DC934
- ldr r0, _080DC994 @ =gBattleAnimArgs
- ldrh r1, [r0, 0x2]
- negs r1, r1
- strh r1, [r0, 0x2]
- ldrh r1, [r0]
- negs r1, r1
- strh r1, [r0]
-_080DC934:
- ldr r5, _080DC990 @ =gAnimBankTarget
- ldrb r0, [r5]
- movs r1, 0x2
- bl sub_8077EE4
- lsls r0, 24
- ldr r4, _080DC994 @ =gBattleAnimArgs
- lsrs r0, 24
- ldrh r1, [r4]
- adds r0, r1
- strh r0, [r6, 0x20]
- ldrb r0, [r5]
- movs r1, 0x3
- bl sub_8077EE4
- lsls r0, 24
- lsrs r0, 24
- ldrh r1, [r4, 0x2]
- adds r0, r1
- strh r0, [r6, 0x22]
- ldrh r0, [r4, 0x4]
- strh r0, [r6, 0x2E]
- ldrb r0, [r5]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r6, 0x32]
- ldrb r0, [r5]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r6, 0x36]
- ldr r0, _080DC998 @ =sub_8078B34
- str r0, [r6, 0x1C]
- ldr r1, _080DC99C @ =DestroyAnimSprite
- adds r0, r6, 0
- bl StoreSpriteCallbackInData
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_080DC990: .4byte gAnimBankTarget
-_080DC994: .4byte gBattleAnimArgs
-_080DC998: .4byte sub_8078B34
-_080DC99C: .4byte DestroyAnimSprite
- thumb_func_end sub_80DC8F4
-
- thumb_func_start sub_80DC9A0
-sub_80DC9A0: @ 80DC9A0
- push {r4,r5,lr}
- adds r5, r0, 0
- bl IsContest
- lsls r0, 24
- cmp r0, 0
- beq _080DC9BC
- ldr r0, _080DC9FC @ =gBattleAnimArgs
- movs r2, 0x4
- ldrsh r1, [r0, r2]
- lsrs r2, r1, 31
- adds r1, r2
- asrs r1, 1
- strh r1, [r0, 0x4]
-_080DC9BC:
- adds r0, r5, 0
- movs r1, 0x1
- bl sub_80787B0
- ldr r1, _080DC9FC @ =gBattleAnimArgs
- ldrh r0, [r1, 0x4]
- strh r0, [r5, 0x2E]
- ldrh r0, [r5, 0x20]
- strh r0, [r5, 0x30]
- ldrh r0, [r5, 0x22]
- strh r0, [r5, 0x34]
- movs r2, 0x8
- ldrsh r0, [r1, r2]
- cmp r0, 0
- bne _080DCA04
- ldr r4, _080DCA00 @ =gAnimBankTarget
- ldrb r0, [r4]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x32]
- ldrb r0, [r4]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x36]
- b _080DCA16
- .align 2, 0
-_080DC9FC: .4byte gBattleAnimArgs
-_080DCA00: .4byte gAnimBankTarget
-_080DCA04:
- ldr r0, _080DCA2C @ =gAnimBankTarget
- ldrb r0, [r0]
- adds r2, r5, 0
- adds r2, 0x32
- adds r3, r5, 0
- adds r3, 0x36
- movs r1, 0x1
- bl sub_807A3FC
-_080DCA16:
- adds r0, r5, 0
- bl sub_8078BD4
- ldr r0, _080DCA30 @ =gBattleAnimArgs
- ldrh r0, [r0, 0x6]
- strh r0, [r5, 0x38]
- ldr r0, _080DCA34 @ =sub_80DCA38
- str r0, [r5, 0x1C]
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_080DCA2C: .4byte gAnimBankTarget
-_080DCA30: .4byte gBattleAnimArgs
-_080DCA34: .4byte sub_80DCA38
- thumb_func_end sub_80DC9A0
-
- thumb_func_start sub_80DCA38
-sub_80DCA38: @ 80DCA38
- push {r4,lr}
- adds r4, r0, 0
- bl sub_8078B5C
- lsls r0, 24
- cmp r0, 0
- beq _080DCA4E
- adds r0, r4, 0
- bl DestroyAnimSprite
- b _080DCA6A
-_080DCA4E:
- movs r1, 0x3A
- ldrsh r0, [r4, r1]
- movs r2, 0x38
- ldrsh r1, [r4, r2]
- bl Sin
- ldrh r1, [r4, 0x24]
- adds r0, r1
- strh r0, [r4, 0x24]
- ldrh r0, [r4, 0x3A]
- adds r0, 0xD
- movs r1, 0xFF
- ands r0, r1
- strh r0, [r4, 0x3A]
-_080DCA6A:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_80DCA38
-
- thumb_func_start sub_80DCA70
-sub_80DCA70: @ 80DCA70
- push {r4,lr}
- adds r4, r0, 0
- ldr r0, _080DCAA0 @ =gAnimBankTarget
- ldrb r0, [r0]
- adds r2, r4, 0
- adds r2, 0x20
- adds r3, r4, 0
- adds r3, 0x22
- movs r1, 0
- bl sub_807A3FC
- ldr r0, _080DCAA4 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- beq _080DCAAC
- ldr r0, _080DCAA8 @ =gBattleAnimArgs
- ldrh r1, [r4, 0x20]
- ldrh r2, [r0]
- subs r1, r2
- strh r1, [r4, 0x20]
- b _080DCAB8
- .align 2, 0
-_080DCAA0: .4byte gAnimBankTarget
-_080DCAA4: .4byte gAnimBankAttacker
-_080DCAA8: .4byte gBattleAnimArgs
-_080DCAAC:
- ldr r1, _080DCAE0 @ =gBattleAnimArgs
- ldrh r0, [r1]
- ldrh r2, [r4, 0x20]
- adds r0, r2
- strh r0, [r4, 0x20]
- adds r0, r1, 0
-_080DCAB8:
- ldrh r0, [r0, 0x2]
- ldrh r1, [r4, 0x22]
- adds r0, r1
- strh r0, [r4, 0x22]
- ldr r0, _080DCAE4 @ =gAnimBankTarget
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- bne _080DCAD4
- ldrh r0, [r4, 0x22]
- adds r0, 0x8
- strh r0, [r4, 0x22]
-_080DCAD4:
- ldr r0, _080DCAE8 @ =sub_80DCAEC
- str r0, [r4, 0x1C]
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_080DCAE0: .4byte gBattleAnimArgs
-_080DCAE4: .4byte gAnimBankTarget
-_080DCAE8: .4byte sub_80DCAEC
- thumb_func_end sub_80DCA70
-
- thumb_func_start sub_80DCAEC
-sub_80DCAEC: @ 80DCAEC
- push {lr}
- adds r3, r0, 0
- ldrh r0, [r3, 0x2E]
- adds r0, 0x1
- strh r0, [r3, 0x2E]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x3
- bne _080DCB20
- movs r0, 0
- strh r0, [r3, 0x2E]
- movs r0, 0x3E
- adds r0, r3
- mov r12, r0
- ldrb r2, [r0]
- lsls r0, r2, 29
- lsrs r0, 31
- movs r1, 0x1
- eors r1, r0
- lsls r1, 2
- movs r0, 0x5
- negs r0, r0
- ands r0, r2
- orrs r0, r1
- mov r1, r12
- strb r0, [r1]
-_080DCB20:
- ldrh r0, [r3, 0x30]
- adds r0, 0x1
- strh r0, [r3, 0x30]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x33
- bne _080DCB34
- adds r0, r3, 0
- bl DestroyAnimSprite
-_080DCB34:
- pop {r0}
- bx r0
- thumb_func_end sub_80DCAEC
-
- thumb_func_start sub_80DCB38
-sub_80DCB38: @ 80DCB38
- ldr r2, _080DCB54 @ =REG_BLDCNT
- movs r3, 0xFD
- lsls r3, 6
- adds r1, r3, 0
- strh r1, [r2]
- adds r2, 0x2
- movs r1, 0x10
- strh r1, [r2]
- movs r1, 0x10
- strh r1, [r0, 0x2E]
- ldr r1, _080DCB58 @ =sub_80DCB5C
- str r1, [r0, 0x1C]
- bx lr
- .align 2, 0
-_080DCB54: .4byte REG_BLDCNT
-_080DCB58: .4byte sub_80DCB5C
- thumb_func_end sub_80DCB38
-
- thumb_func_start sub_80DCB5C
-sub_80DCB5C: @ 80DCB5C
- push {lr}
- adds r3, r0, 0
- ldrh r1, [r3, 0x32]
- movs r2, 0x32
- ldrsh r0, [r3, r2]
- cmp r0, 0x13
- bgt _080DCB70
- adds r0, r1, 0x1
- strh r0, [r3, 0x32]
- b _080DCBA8
-_080DCB70:
- ldrh r1, [r3, 0x30]
- adds r0, r1, 0x1
- strh r0, [r3, 0x30]
- movs r0, 0x1
- ands r0, r1
- cmp r0, 0
- beq _080DCBA8
- ldrh r1, [r3, 0x2E]
- subs r1, 0x1
- strh r1, [r3, 0x2E]
- ldr r2, _080DCBAC @ =REG_BLDALPHA
- movs r0, 0x10
- subs r0, r1
- lsls r0, 8
- orrs r1, r0
- strh r1, [r2]
- movs r1, 0x2E
- ldrsh r0, [r3, r1]
- cmp r0, 0
- bne _080DCBA8
- adds r2, r3, 0
- adds r2, 0x3E
- ldrb r0, [r2]
- movs r1, 0x4
- orrs r0, r1
- strb r0, [r2]
- ldr r0, _080DCBB0 @ =sub_80DCBB4
- str r0, [r3, 0x1C]
-_080DCBA8:
- pop {r0}
- bx r0
- .align 2, 0
-_080DCBAC: .4byte REG_BLDALPHA
-_080DCBB0: .4byte sub_80DCBB4
- thumb_func_end sub_80DCB5C
-
- thumb_func_start sub_80DCBB4
-sub_80DCBB4: @ 80DCBB4
- push {lr}
- ldr r1, _080DCBC8 @ =REG_BLDCNT
- movs r2, 0
- strh r2, [r1]
- adds r1, 0x2
- strh r2, [r1]
- bl DestroyAnimSprite
- pop {r0}
- bx r0
- .align 2, 0
-_080DCBC8: .4byte REG_BLDCNT
- thumb_func_end sub_80DCBB4
-
- thumb_func_start sub_80DCBCC
-sub_80DCBCC: @ 80DCBCC
- push {r4-r7,lr}
- sub sp, 0x4
- adds r7, r0, 0
- bl IsContest
- lsls r0, 24
- cmp r0, 0
- beq _080DCBEC
- ldr r1, _080DCBE8 @ =gBattleAnimArgs
- ldrh r0, [r1, 0x4]
- negs r0, r0
- strh r0, [r1, 0x4]
- b _080DCC0E
- .align 2, 0
-_080DCBE8: .4byte gBattleAnimArgs
-_080DCBEC:
- ldr r0, _080DCCE8 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- beq _080DCC0E
- ldr r1, _080DCCEC @ =gBattleAnimArgs
- ldrh r0, [r1, 0x4]
- negs r0, r0
- strh r0, [r1, 0x4]
- ldrh r0, [r1, 0x2]
- negs r0, r0
- strh r0, [r1, 0x2]
- ldrh r0, [r1, 0x6]
- negs r0, r0
- strh r0, [r1, 0x6]
-_080DCC0E:
- bl IsContest
- lsls r0, 24
- cmp r0, 0
- bne _080DCC5E
- ldr r0, _080DCCE8 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankSide
- adds r4, r0, 0
- ldr r5, _080DCCF0 @ =gAnimBankTarget
- ldrb r0, [r5]
- bl GetBankSide
- lsls r4, 24
- lsls r0, 24
- cmp r4, r0
- bne _080DCC5E
- ldrb r0, [r5]
- bl GetBankIdentity
- lsls r0, 24
- cmp r0, 0
- beq _080DCC4C
- ldrb r0, [r5]
- bl GetBankIdentity
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x1
- bne _080DCC5E
-_080DCC4C:
- ldr r0, _080DCCEC @ =gBattleAnimArgs
- movs r2, 0x4
- ldrsh r1, [r0, r2]
- negs r1, r1
- strh r1, [r0, 0x4]
- movs r2, 0
- ldrsh r1, [r0, r2]
- negs r1, r1
- strh r1, [r0]
-_080DCC5E:
- adds r0, r7, 0
- movs r1, 0x1
- bl sub_80787B0
- ldr r5, _080DCCF0 @ =gAnimBankTarget
- ldrb r0, [r5]
- movs r1, 0x2
- bl GetBankPosition
- adds r4, r0, 0
- lsls r4, 24
- ldr r6, _080DCCEC @ =gBattleAnimArgs
- lsrs r4, 24
- ldrh r0, [r6, 0x4]
- adds r4, r0
- lsls r4, 16
- lsrs r4, 16
- ldrb r0, [r5]
- movs r1, 0x3
- bl GetBankPosition
- adds r1, r0, 0
- lsls r1, 24
- lsrs r1, 24
- ldrh r2, [r6, 0x6]
- adds r1, r2
- lsls r1, 16
- ldrh r2, [r7, 0x20]
- lsls r0, r4, 16
- asrs r0, 16
- subs r0, r2
- lsls r0, 16
- asrs r0, 16
- ldrh r2, [r7, 0x22]
- lsrs r5, r1, 16
- asrs r1, 16
- subs r1, r2
- lsls r1, 16
- asrs r1, 16
- bl sub_80790F0
- lsls r0, 16
- movs r1, 0xC0
- lsls r1, 24
- adds r0, r1
- lsrs r0, 16
- movs r3, 0x80
- lsls r3, 1
- str r0, [sp]
- adds r0, r7, 0
- movs r1, 0
- adds r2, r3, 0
- bl sub_8078FDC
- ldrh r0, [r6, 0x8]
- strh r0, [r7, 0x2E]
- strh r4, [r7, 0x32]
- strh r5, [r7, 0x36]
- ldr r0, _080DCCF4 @ =sub_8078B34
- str r0, [r7, 0x1C]
- ldr r1, _080DCCF8 @ =DestroyAnimSprite
- adds r0, r7, 0
- bl StoreSpriteCallbackInData
- add sp, 0x4
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_080DCCE8: .4byte gAnimBankAttacker
-_080DCCEC: .4byte gBattleAnimArgs
-_080DCCF0: .4byte gAnimBankTarget
-_080DCCF4: .4byte sub_8078B34
-_080DCCF8: .4byte DestroyAnimSprite
- thumb_func_end sub_80DCBCC
-
- thumb_func_start sub_80DCCFC
-sub_80DCCFC: @ 80DCCFC
- push {r4-r6,lr}
- adds r6, r0, 0
- movs r1, 0x1
- bl sub_80787B0
- ldr r0, _080DCD68 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- beq _080DCD1C
- ldr r1, _080DCD6C @ =gBattleAnimArgs
- ldrh r0, [r1, 0x4]
- negs r0, r0
- strh r0, [r1, 0x4]
-_080DCD1C:
- ldr r4, _080DCD6C @ =gBattleAnimArgs
- ldrh r0, [r4, 0x8]
- strh r0, [r6, 0x2E]
- ldr r5, _080DCD70 @ =gAnimBankTarget
- ldrb r0, [r5]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- ldrh r1, [r4, 0x4]
- adds r0, r1
- strh r0, [r6, 0x32]
- ldrb r0, [r5]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- ldrh r1, [r4, 0x6]
- adds r0, r1
- strh r0, [r6, 0x36]
- ldrh r0, [r4, 0xA]
- strh r0, [r6, 0x38]
- adds r0, r6, 0
- bl sub_80786EC
- ldr r0, _080DCD74 @ =sub_80DCD78
- str r0, [r6, 0x1C]
- adds r2, r6, 0
- adds r2, 0x3E
- ldrb r0, [r2]
- movs r1, 0x4
- orrs r0, r1
- strb r0, [r2]
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_080DCD68: .4byte gAnimBankAttacker
-_080DCD6C: .4byte gBattleAnimArgs
-_080DCD70: .4byte gAnimBankTarget
-_080DCD74: .4byte sub_80DCD78
- thumb_func_end sub_80DCCFC
-
- thumb_func_start sub_80DCD78
-sub_80DCD78: @ 80DCD78
- push {r4-r7,lr}
- mov r7, r8
- push {r7}
- sub sp, 0x14
- adds r4, r0, 0
- adds r2, r4, 0
- adds r2, 0x3E
- ldrb r0, [r2]
- movs r1, 0x5
- negs r1, r1
- ands r1, r0
- strb r1, [r2]
- adds r0, r4, 0
- bl sub_8078718
- lsls r0, 24
- cmp r0, 0
- beq _080DCDA4
- adds r0, r4, 0
- bl DestroyAnimSprite
- b _080DCE34
-_080DCDA4:
- movs r0, 0x2E
- adds r0, r4
- mov r8, r0
- ldrh r7, [r4, 0x20]
- ldrh r5, [r4, 0x24]
- ldrh r1, [r4, 0x22]
- mov r12, r1
- ldrh r6, [r4, 0x26]
- mov r2, r8
- add r1, sp, 0x4
- movs r3, 0x7
-_080DCDBA:
- ldrh r0, [r2]
- strh r0, [r1]
- adds r2, 0x2
- adds r1, 0x2
- subs r3, 0x1
- cmp r3, 0
- bge _080DCDBA
- adds r0, r7, r5
- lsls r0, 16
- lsrs r5, r0, 16
- mov r2, r12
- adds r0, r2, r6
- lsls r0, 16
- lsrs r6, r0, 16
- adds r0, r4, 0
- bl sub_8078718
- lsls r0, 24
- cmp r0, 0
- bne _080DCE34
- ldrh r0, [r4, 0x24]
- ldrh r1, [r4, 0x20]
- adds r0, r1
- lsls r1, r5, 16
- asrs r1, 16
- subs r0, r1
- lsls r0, 16
- asrs r0, 16
- ldrh r1, [r4, 0x26]
- ldrh r2, [r4, 0x22]
- adds r1, r2
- lsls r2, r6, 16
- asrs r2, 16
- subs r1, r2
- lsls r1, 16
- asrs r1, 16
- bl sub_80790F0
- lsls r0, 16
- movs r1, 0xC0
- lsls r1, 24
- adds r0, r1
- lsrs r0, 16
- movs r3, 0x80
- lsls r3, 1
- str r0, [sp]
- adds r0, r4, 0
- movs r1, 0
- adds r2, r3, 0
- bl sub_8078FDC
- add r2, sp, 0x4
- mov r1, r8
- movs r3, 0x7
-_080DCE26:
- ldrh r0, [r2]
- strh r0, [r1]
- adds r2, 0x2
- adds r1, 0x2
- subs r3, 0x1
- cmp r3, 0
- bge _080DCE26
-_080DCE34:
- add sp, 0x14
- pop {r3}
- mov r8, r3
- pop {r4-r7}
- pop {r0}
- bx r0
- thumb_func_end sub_80DCD78
-
- thumb_func_start sub_80DCE40
-sub_80DCE40: @ 80DCE40
- push {r4,r5,lr}
- adds r5, r0, 0
- ldr r0, _080DCE54 @ =gBattleAnimArgs
- movs r1, 0
- ldrsh r0, [r0, r1]
- cmp r0, 0
- bne _080DCE5C
- ldr r4, _080DCE58 @ =gAnimBankAttacker
- b _080DCE5E
- .align 2, 0
-_080DCE54: .4byte gBattleAnimArgs
-_080DCE58: .4byte gAnimBankAttacker
-_080DCE5C:
- ldr r4, _080DCE90 @ =gAnimBankTarget
-_080DCE5E:
- ldrb r0, [r4]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x20]
- ldrb r0, [r4]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- adds r0, 0x12
- strh r0, [r5, 0x22]
- ldr r1, _080DCE94 @ =move_anim_8074EE0
- adds r0, r5, 0
- bl StoreSpriteCallbackInData
- ldr r0, _080DCE98 @ =sub_80785E4
- str r0, [r5, 0x1C]
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_080DCE90: .4byte gAnimBankTarget
-_080DCE94: .4byte move_anim_8074EE0
-_080DCE98: .4byte sub_80785E4
- thumb_func_end sub_80DCE40
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/asm/contest_ai.s b/asm/contest_ai.s
index 94347f2ad..709b289c2 100644
--- a/asm/contest_ai.s
+++ b/asm/contest_ai.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/contest_effect.s b/asm/contest_effect.s
index d06789976..341cb0903 100644
--- a/asm/contest_effect.s
+++ b/asm/contest_effect.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/contest_link_80C2020.s b/asm/contest_link_80C2020.s
index 71788c918..af239f3f7 100644
--- a/asm/contest_link_80C2020.s
+++ b/asm/contest_link_80C2020.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -94,9 +94,9 @@ sub_80C2020: @ 80C2020
strh r2, [r0]
ldr r0, _080C2128 @ =gBattle_BG2_Y
strh r2, [r0]
- ldr r0, _080C212C @ =gUnknown_030041B0
+ ldr r0, _080C212C @ =gBattle_BG3_X
strh r2, [r0]
- ldr r0, _080C2130 @ =gUnknown_030041B8
+ ldr r0, _080C2130 @ =gBattle_BG3_Y
strh r2, [r0]
ldr r0, _080C2134 @ =gBattle_WIN0H
strh r2, [r0]
@@ -125,8 +125,8 @@ _080C211C: .4byte gBattle_BG1_X
_080C2120: .4byte gBattle_BG1_Y
_080C2124: .4byte gBattle_BG2_X
_080C2128: .4byte gBattle_BG2_Y
-_080C212C: .4byte gUnknown_030041B0
-_080C2130: .4byte gUnknown_030041B8
+_080C212C: .4byte gBattle_BG3_X
+_080C2130: .4byte gBattle_BG3_Y
_080C2134: .4byte gBattle_WIN0H
_080C2138: .4byte gBattle_WIN0V
_080C213C: .4byte gBattle_WIN1H
@@ -396,7 +396,7 @@ sub_80C2358: @ 80C2358
movs r0, 0
bl SetVBlankCallback
bl sub_80C2020
- bl dp12_8087EA4
+ bl ScanlineEffect_Clear
bl ResetPaletteFade
bl ResetSpriteData
bl ResetTasks
@@ -506,11 +506,11 @@ sub_80C2448: @ 80C2448
ldrh r0, [r0]
strh r0, [r1]
adds r1, 0x2
- ldr r0, _080C24DC @ =gUnknown_030041B0
+ ldr r0, _080C24DC @ =gBattle_BG3_X
ldrh r0, [r0]
strh r0, [r1]
adds r1, 0x2
- ldr r0, _080C24E0 @ =gUnknown_030041B8
+ ldr r0, _080C24E0 @ =gBattle_BG3_Y
ldrh r0, [r0]
strh r0, [r1]
adds r1, 0x22
@@ -532,7 +532,7 @@ sub_80C2448: @ 80C2448
bl LoadOam
bl ProcessSpriteCopyRequests
bl TransferPlttBuffer
- bl sub_8089668
+ bl ScanlineEffect_InitHBlankDmaTransfer
pop {r0}
bx r0
.align 2, 0
@@ -543,8 +543,8 @@ _080C24CC: .4byte gBattle_BG1_X
_080C24D0: .4byte gBattle_BG1_Y
_080C24D4: .4byte gBattle_BG2_X
_080C24D8: .4byte gBattle_BG2_Y
-_080C24DC: .4byte gUnknown_030041B0
-_080C24E0: .4byte gUnknown_030041B8
+_080C24DC: .4byte gBattle_BG3_X
+_080C24E0: .4byte gBattle_BG3_Y
_080C24E4: .4byte gBattle_WIN0H
_080C24E8: .4byte gBattle_WIN0V
_080C24EC: .4byte gBattle_WIN1H
@@ -1826,11 +1826,11 @@ _080C2F24: .4byte c2_exit_to_overworld_1_continue_scripts_restart_music
thumb_func_start sub_80C2F28
sub_80C2F28: @ 80C2F28
push {r4,r5,lr}
- ldr r2, _080C2F5C @ =gUnknown_030041B0
+ ldr r2, _080C2F5C @ =gBattle_BG3_X
ldrh r3, [r2]
adds r0, r3, 0x2
strh r0, [r2]
- ldr r4, _080C2F60 @ =gUnknown_030041B8
+ ldr r4, _080C2F60 @ =gBattle_BG3_Y
ldrh r5, [r4]
adds r1, r5, 0x1
strh r1, [r4]
@@ -1854,8 +1854,8 @@ _080C2F56:
pop {r0}
bx r0
.align 2, 0
-_080C2F5C: .4byte gUnknown_030041B0
-_080C2F60: .4byte gUnknown_030041B8
+_080C2F5C: .4byte gBattle_BG3_X
+_080C2F60: .4byte gBattle_BG3_Y
thumb_func_end sub_80C2F28
thumb_func_start sub_80C2F64
diff --git a/asm/contest_link_80C857C.s b/asm/contest_link_80C857C.s
index 13d01d5a9..b29e03583 100644
--- a/asm/contest_link_80C857C.s
+++ b/asm/contest_link_80C857C.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/crt0.s b/asm/crt0.s
deleted file mode 100644
index 049392be9..000000000
--- a/asm/crt0.s
+++ /dev/null
@@ -1,227 +0,0 @@
- .include "constants/gba_constants.inc"
- .include "constants/misc_constants.inc"
- .include "constants/version.inc"
-
- .syntax unified
-
- .global Start
-
- .text
-
- .arm
-
-Start: @ 8000000
- b Init
-
- .include "asm/rom_header.inc"
-
-@ 80000C0
- .word 0
-
- .global GPIOPortData
-GPIOPortData: @ 80000C4
- .hword 0
-
- .global GPIOPortDirection
-GPIOPortDirection: @ 80000C6
- .hword 0
-
- .global GPIOPortReadEnable
-GPIOPortReadEnable: @ 80000C8
- .hword 0
-
- .space 6
-
-@ 80000D0
-
-@ TODO: figure out what this data is
-
- .ifdef GERMAN
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte 0xFFFFFFFF
- .4byte GAME_VERSION
- .4byte GAME_LANGUAGE
- .ifdef SAPPHIRE
- .ascii "pokemon sapphire version"
- .space 8
- .else
- .ascii "pokemon ruby version"
- .space 12
- .endif
- .4byte gMonFrontPicTable
- .4byte gMonBackPicTable
- .4byte gMonPaletteTable
- .4byte gMonShinyPaletteTable
- .4byte gMonIconTable
- .4byte gMonIconPaletteIndices
- .4byte gMonIconPaletteTable
- .4byte gSpeciesNames
- .4byte gMoveNames
- .4byte gDecorations
- .4byte 0x1220
- .4byte 0x1340
- .4byte 0x18
- .4byte 0x938
- .4byte 0x3A8C
- .4byte 0x46
- .4byte 0x836
- .4byte 0x84C
- .4byte 0x182
- .4byte 0xA0A0A07
- .4byte 0xC060C0C
- .4byte 0xC121006
- .4byte 0x8010B0F
- .4byte 0xC
- .4byte 0x890
- .4byte 0x3AC0
- .4byte 0x234
- .4byte 0x238
- .4byte 9
- .4byte 0xA
- .4byte 0
- .4byte 8
- .4byte 0x556
- .4byte 0x557
- .4byte 0x312F
- .4byte 0x311B
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0
- .4byte 0xFFFFFFFF
- .endif
-
- .arm
- .align 2, 0
- .global Init
-Init:
- mov r0, PSR_IRQ_MODE
- msr cpsr_cf, r0
- ldr sp, sp_irq
- mov r0, PSR_SYS_MODE
- msr cpsr_cf, r0
- ldr sp, sp_sys
- ldr r1, =INTR_VECTOR
- adr r0, IntrMain
- str r0, [r1]
- ldr r1, =AgbMain
- mov lr, pc
- bx r1
- b Init
-
- .align 2, 0
-sp_sys: .word IWRAM_END - 0x1a0
-sp_irq: .word IWRAM_END - 0x60
-
- .arm
- .align 2, 0
- .global IntrMain
-IntrMain:
- mov r3, REG_BASE
- add r3, r3, 0x200
- ldr r2, [r3, OFFSET_REG_IE - 0x200]
- ldrh r1, [r3, OFFSET_REG_IME - 0x200]
- mrs r0, spsr
- stmdb sp!, {r0-r3,lr}
- mov r0, 1
- strh r0, [r3, OFFSET_REG_IME - 0x200]
- and r1, r2, r2, lsr 16
- mov r12, 0
- ands r0, r1, INTR_FLAG_SERIAL
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_TIMER3
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_HBLANK
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_VBLANK
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_VCOUNT
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_TIMER0
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_TIMER1
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_TIMER2
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_DMA0
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_DMA1
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_DMA2
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_DMA3
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_KEYPAD
- bne IntrMain_FoundIntr
- add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_GAMEPAK
- strbne r0, [r3, OFFSET_REG_SOUNDCNT_X - 0x200]
-IntrMain_Loop:
- bne IntrMain_Loop
-IntrMain_FoundIntr:
- strh r0, [r3, OFFSET_REG_IF - 0x200]
- mov r1, INTR_FLAG_SERIAL | INTR_FLAG_TIMER3 | INTR_FLAG_HBLANK
- bic r2, r2, r0
- and r1, r1, r2
- 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
- msr cpsr_cf, r3
- ldr r1, =gIntrTable
- add r1, r1, r12
- ldr r0, [r1]
- stmdb sp!, {lr}
- adr lr, IntrMain_RetAddr
- bx r0
-IntrMain_RetAddr:
- ldmia sp!, {lr}
- mrs r3, cpsr
- bic r3, r3, PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK
- orr r3, r3, PSR_I_BIT | PSR_IRQ_MODE
- msr cpsr_cf, r3
- ldmia sp!, {r0-r3,lr}
- strh r2, [r3, OFFSET_REG_IE - 0x200]
- strh r1, [r3, OFFSET_REG_IME - 0x200]
- msr spsr_cf, r0
- bx lr
-
- .pool
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/asm/current.s b/asm/current.s
index e77218cc9..4ef537dc3 100755
--- a/asm/current.s
+++ b/asm/current.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/cute_sketch.s b/asm/cute_sketch.s
index da5dea0ce..8cb6cdbd8 100644
--- a/asm/cute_sketch.s
+++ b/asm/cute_sketch.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/dark.s b/asm/dark.s
index f3274861c..9f6ad3278 100755
--- a/asm/dark.s
+++ b/asm/dark.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -386,7 +386,7 @@ _080E01F4:
movs r0, 0x3
bl sub_80E08CC
movs r3, 0
- ldr r4, _080E0290 @ =gUnknown_03004DE0
+ ldr r4, _080E0290 @ =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r6, r4, r0
@@ -406,7 +406,7 @@ _080E0220:
ldr r0, [sp]
ldr r1, [sp, 0x4]
ldr r2, [sp, 0x8]
- bl sub_80895F8
+ bl ScanlineEffect_SetParams
ldr r1, _080E0294 @ =REG_WINOUT
movs r0, 0x3F
eors r7, r0
@@ -441,7 +441,7 @@ _080E0280: .4byte 0x00003f44
_080E0284: .4byte REG_BG2VOFS
_080E0288: .4byte gBattle_BG1_X
_080E028C: .4byte 0xa2600001
-_080E0290: .4byte gUnknown_03004DE0
+_080E0290: .4byte gScanlineEffectRegBuffers
_080E0294: .4byte REG_WINOUT
_080E0298: .4byte gBattle_WIN0H
_080E029C: .4byte gBattle_WIN0V
@@ -575,7 +575,7 @@ _080E0380:
.align 2, 0
_080E0398: .4byte gBattle_WIN0H
_080E039C:
- ldr r1, _080E03AC @ =gUnknown_03004DC0
+ ldr r1, _080E03AC @ =gScanlineEffect
movs r0, 0x3
strb r0, [r1, 0x15]
_080E03A2:
@@ -584,7 +584,7 @@ _080E03A2:
strh r0, [r4, 0x8]
b _080E03B6
.align 2, 0
-_080E03AC: .4byte gUnknown_03004DC0
+_080E03AC: .4byte gScanlineEffect
_080E03B0:
adds r0, r2, 0
bl DestroyAnimVisualTask
@@ -786,7 +786,7 @@ _080E054E:
str r0, [sp, 0xC]
movs r3, 0
add r4, sp, 0xC
- ldr r6, _080E059C @ =gUnknown_03004DE0
+ ldr r6, _080E059C @ =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r7, r6, r0
@@ -815,7 +815,7 @@ _080E055C:
strb r2, [r4, 0x9]
ldr r0, [sp, 0xC]
ldr r2, [r4, 0x8]
- bl sub_80895F8
+ bl ScanlineEffect_SetParams
_080E0590:
ldrh r0, [r5, 0x8]
adds r0, 0x1
@@ -823,7 +823,7 @@ _080E0590:
b _080E05F2
.align 2, 0
_080E0598: .4byte REG_BG2VOFS
-_080E059C: .4byte gUnknown_03004DE0
+_080E059C: .4byte gScanlineEffectRegBuffers
_080E05A0: .4byte 0xa2600001
_080E05A4:
movs r1, 0xE
@@ -1043,7 +1043,7 @@ _080E0732:
.align 2, 0
_080E0750: .4byte REG_BLDALPHA
_080E0754:
- ldr r1, _080E0764 @ =gUnknown_03004DC0
+ ldr r1, _080E0764 @ =gScanlineEffect
movs r0, 0x3
strb r0, [r1, 0x15]
_080E075A:
@@ -1052,7 +1052,7 @@ _080E075A:
strh r0, [r4, 0x8]
b _080E0784
.align 2, 0
-_080E0764: .4byte gUnknown_03004DC0
+_080E0764: .4byte gScanlineEffect
_080E0768:
ldr r0, _080E078C @ =gBattle_WIN0H
movs r1, 0
@@ -1102,9 +1102,9 @@ sub_80E079C: @ 80E079C
movs r4, 0
cmp r0, 0
ble _080E07FC
- ldr r0, _080E0888 @ =gUnknown_03004DE0
+ ldr r0, _080E0888 @ =gScanlineEffectRegBuffers
mov r12, r0
- ldr r7, _080E088C @ =gUnknown_03004DC0
+ ldr r7, _080E088C @ =gScanlineEffect
_080E07D0:
lsls r2, r4, 16
asrs r2, 16
@@ -1136,9 +1136,9 @@ _080E07FC:
ldrsh r0, [r6, r2]
cmp r1, r0
bgt _080E0846
- ldr r0, _080E0888 @ =gUnknown_03004DE0
+ ldr r0, _080E0888 @ =gScanlineEffectRegBuffers
mov r12, r0
- ldr r7, _080E088C @ =gUnknown_03004DC0
+ ldr r7, _080E088C @ =gScanlineEffect
_080E0810:
asrs r4, r3, 16
cmp r4, 0
@@ -1179,8 +1179,8 @@ _080E0846:
ldrsh r0, [r6, r3]
cmp r1, r0
bge _080E08BE
- ldr r7, _080E0888 @ =gUnknown_03004DE0
- ldr r4, _080E088C @ =gUnknown_03004DC0
+ ldr r7, _080E0888 @ =gScanlineEffectRegBuffers
+ ldr r4, _080E088C @ =gScanlineEffect
_080E085E:
asrs r3, r2, 16
cmp r3, 0
@@ -1204,15 +1204,15 @@ _080E0876:
blt _080E085E
b _080E08BE
.align 2, 0
-_080E0888: .4byte gUnknown_03004DE0
-_080E088C: .4byte gUnknown_03004DC0
+_080E0888: .4byte gScanlineEffectRegBuffers
+_080E088C: .4byte gScanlineEffect
_080E0890:
movs r1, 0x1C
ldrsh r0, [r6, r1]
adds r5, r0, 0
adds r5, 0x9F
movs r4, 0
- ldr r3, _080E08C8 @ =gUnknown_03004DE0
+ ldr r3, _080E08C8 @ =gScanlineEffectRegBuffers
movs r2, 0xF0
lsls r2, 3
adds r6, r3, r2
@@ -1238,7 +1238,7 @@ _080E08BE:
pop {r0}
bx r0
.align 2, 0
-_080E08C8: .4byte gUnknown_03004DE0
+_080E08C8: .4byte gScanlineEffectRegBuffers
thumb_func_end sub_80E079C
thumb_func_start sub_80E08CC
diff --git a/asm/dragon.s b/asm/dragon.s
deleted file mode 100755
index 7c4ea0547..000000000
--- a/asm/dragon.s
+++ /dev/null
@@ -1,1214 +0,0 @@
- .include "constants/gba_constants.inc"
- .include "asm/macros.inc"
-
- .syntax unified
-
- .text
-
- @ dragon
-
- thumb_func_start sub_80DF5A0
-sub_80DF5A0: @ 80DF5A0
- push {r4,r5,lr}
- adds r5, r0, 0
- ldr r4, _080DF5E8 @ =gAnimBankAttacker
- ldrb r0, [r4]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x20]
- ldrb r0, [r4]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x22]
- ldrb r0, [r4]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- beq _080DF5F0
- ldr r2, _080DF5EC @ =gBattleAnimArgs
- ldrh r0, [r5, 0x20]
- ldrh r1, [r2]
- subs r0, r1
- strh r0, [r5, 0x20]
- ldrh r0, [r2, 0x6]
- negs r0, r0
- strh r0, [r2, 0x6]
- ldrh r0, [r2, 0x8]
- negs r0, r0
- strh r0, [r2, 0x8]
- adds r1, r2, 0
- b _080DF5FA
- .align 2, 0
-_080DF5E8: .4byte gAnimBankAttacker
-_080DF5EC: .4byte gBattleAnimArgs
-_080DF5F0:
- ldr r1, _080DF630 @ =gBattleAnimArgs
- ldrh r0, [r1]
- ldrh r2, [r5, 0x20]
- adds r0, r2
- strh r0, [r5, 0x20]
-_080DF5FA:
- ldrh r0, [r1, 0x2]
- ldrh r2, [r5, 0x22]
- adds r0, r2
- strh r0, [r5, 0x22]
- ldrh r0, [r1, 0x4]
- strh r0, [r5, 0x2E]
- ldrh r0, [r1, 0x6]
- strh r0, [r5, 0x30]
- ldrh r0, [r1, 0x8]
- strh r0, [r5, 0x34]
- ldrh r0, [r1, 0xA]
- strh r0, [r5, 0x38]
- adds r2, r5, 0
- adds r2, 0x3E
- ldrb r0, [r2]
- movs r1, 0x4
- orrs r0, r1
- strb r0, [r2]
- ldr r1, _080DF634 @ =move_anim_8074EE0
- adds r0, r5, 0
- bl StoreSpriteCallbackInData
- ldr r0, _080DF638 @ =sub_8078504
- str r0, [r5, 0x1C]
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_080DF630: .4byte gBattleAnimArgs
-_080DF634: .4byte move_anim_8074EE0
-_080DF638: .4byte sub_8078504
- thumb_func_end sub_80DF5A0
-
- thumb_func_start sub_80DF63C
-sub_80DF63C: @ 80DF63C
- push {r4,r5,lr}
- adds r5, r0, 0
- bl sub_8078650
- ldr r4, _080DF694 @ =gAnimBankTarget
- ldrb r0, [r4]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x32]
- ldrb r0, [r4]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x36]
- ldr r0, _080DF698 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- beq _080DF6A0
- ldr r2, _080DF69C @ =gBattleAnimArgs
- ldrh r0, [r5, 0x20]
- ldrh r1, [r2, 0x2]
- subs r0, r1
- strh r0, [r5, 0x20]
- ldrh r0, [r5, 0x22]
- adds r1, r0
- strh r1, [r5, 0x22]
- ldrh r0, [r5, 0x32]
- ldrh r1, [r2, 0x4]
- subs r0, r1
- strh r0, [r5, 0x32]
- ldrh r0, [r2, 0x6]
- ldrh r1, [r5, 0x36]
- adds r0, r1
- strh r0, [r5, 0x36]
- b _080DF6CA
- .align 2, 0
-_080DF694: .4byte gAnimBankTarget
-_080DF698: .4byte gAnimBankAttacker
-_080DF69C: .4byte gBattleAnimArgs
-_080DF6A0:
- ldr r1, _080DF6E4 @ =gBattleAnimArgs
- ldrh r0, [r1]
- ldrh r2, [r5, 0x20]
- adds r0, r2
- strh r0, [r5, 0x20]
- ldrh r0, [r1, 0x2]
- ldrh r2, [r5, 0x22]
- adds r0, r2
- strh r0, [r5, 0x22]
- ldrh r0, [r1, 0x4]
- ldrh r2, [r5, 0x32]
- adds r0, r2
- strh r0, [r5, 0x32]
- ldrh r0, [r1, 0x6]
- ldrh r1, [r5, 0x36]
- adds r0, r1
- strh r0, [r5, 0x36]
- adds r0, r5, 0
- movs r1, 0x1
- bl StartSpriteAnim
-_080DF6CA:
- ldr r0, _080DF6E4 @ =gBattleAnimArgs
- ldrh r0, [r0, 0x8]
- strh r0, [r5, 0x2E]
- ldr r0, _080DF6E8 @ =sub_8078B34
- str r0, [r5, 0x1C]
- ldr r1, _080DF6EC @ =move_anim_8074EE0
- adds r0, r5, 0
- bl StoreSpriteCallbackInData
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_080DF6E4: .4byte gBattleAnimArgs
-_080DF6E8: .4byte sub_8078B34
-_080DF6EC: .4byte move_anim_8074EE0
- thumb_func_end sub_80DF63C
-
- thumb_func_start sub_80DF6F0
-sub_80DF6F0: @ 80DF6F0
- push {r4,r5,lr}
- adds r5, r0, 0
- ldr r0, _080DF704 @ =gBattleAnimArgs
- movs r1, 0
- ldrsh r0, [r0, r1]
- cmp r0, 0
- bne _080DF70C
- ldr r4, _080DF708 @ =gAnimBankAttacker
- b _080DF70E
- .align 2, 0
-_080DF704: .4byte gBattleAnimArgs
-_080DF708: .4byte gAnimBankAttacker
-_080DF70C:
- ldr r4, _080DF750 @ =gAnimBankTarget
-_080DF70E:
- ldrb r0, [r4]
- movs r1, 0
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x20]
- ldrb r0, [r4]
- movs r1, 0x1
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x22]
- ldr r4, _080DF754 @ =gBattleAnimArgs
- movs r0, 0x2
- ldrsh r1, [r4, r0]
- adds r0, r5, 0
- bl sub_807867C
- ldrh r0, [r4, 0x4]
- ldrh r1, [r5, 0x22]
- adds r0, r1
- strh r0, [r5, 0x22]
- ldr r0, _080DF758 @ =sub_8078600
- str r0, [r5, 0x1C]
- ldr r1, _080DF75C @ =move_anim_8074EE0
- adds r0, r5, 0
- bl StoreSpriteCallbackInData
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_080DF750: .4byte gAnimBankTarget
-_080DF754: .4byte gBattleAnimArgs
-_080DF758: .4byte sub_8078600
-_080DF75C: .4byte move_anim_8074EE0
- thumb_func_end sub_80DF6F0
-
- thumb_func_start sub_80DF760
-sub_80DF760: @ 80DF760
- push {r4,lr}
- adds r4, r0, 0
- ldr r0, _080DF788 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- beq _080DF77A
- adds r0, r4, 0
- movs r1, 0x1
- bl StartSpriteAffineAnim
-_080DF77A:
- adds r0, r4, 0
- bl sub_80DF63C
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_080DF788: .4byte gAnimBankAttacker
- thumb_func_end sub_80DF760
-
- thumb_func_start sub_80DF78C
-sub_80DF78C: @ 80DF78C
- push {r4-r7,lr}
- adds r6, r0, 0
- ldr r4, _080DF7E0 @ =gAnimBankAttacker
- ldrb r0, [r4]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- movs r5, 0
- strh r0, [r6, 0x20]
- ldrb r0, [r4]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r6, 0x22]
- strh r5, [r6, 0x36]
- movs r0, 0x1
- strh r0, [r6, 0x38]
- ldr r0, _080DF7E4 @ =gBattleAnimArgs
- ldrh r0, [r0]
- strh r0, [r6, 0x3A]
- ldr r4, _080DF7E8 @ =gBankAttacker
- ldrb r0, [r4]
- movs r1, 0
- bl sub_807A100
- lsls r7, r0, 16
- lsrs r5, r7, 16
- ldrb r0, [r4]
- movs r1, 0x1
- bl sub_807A100
- lsls r1, r0, 16
- lsrs r0, r1, 16
- cmp r5, r0
- bls _080DF7EC
- lsrs r0, r7, 17
- b _080DF7EE
- .align 2, 0
-_080DF7E0: .4byte gAnimBankAttacker
-_080DF7E4: .4byte gBattleAnimArgs
-_080DF7E8: .4byte gBankAttacker
-_080DF7EC:
- lsrs r0, r1, 17
-_080DF7EE:
- strh r0, [r6, 0x3C]
- movs r1, 0x3A
- ldrsh r0, [r6, r1]
- movs r2, 0x3C
- ldrsh r1, [r6, r2]
- bl Cos
- strh r0, [r6, 0x24]
- movs r1, 0x3A
- ldrsh r0, [r6, r1]
- movs r2, 0x3C
- ldrsh r1, [r6, r2]
- bl Sin
- strh r0, [r6, 0x26]
- ldr r0, _080DF818 @ =sub_80DF81C
- str r0, [r6, 0x1C]
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_080DF818: .4byte sub_80DF81C
- thumb_func_end sub_80DF78C
-
- thumb_func_start sub_80DF81C
-sub_80DF81C: @ 80DF81C
- push {r4,r5,lr}
- adds r4, r0, 0
- movs r0, 0x2E
- ldrsh r5, [r4, r0]
- cmp r5, 0
- beq _080DF82E
- cmp r5, 0x1
- beq _080DF89A
- b _080DF91E
-_080DF82E:
- ldrh r0, [r4, 0x3A]
- ldrh r1, [r4, 0x38]
- subs r0, r1
- movs r1, 0xFF
- ands r0, r1
- strh r0, [r4, 0x3A]
- movs r1, 0x3A
- ldrsh r0, [r4, r1]
- movs r2, 0x3C
- ldrsh r1, [r4, r2]
- bl Cos
- strh r0, [r4, 0x24]
- movs r1, 0x3A
- ldrsh r0, [r4, r1]
- movs r2, 0x3C
- ldrsh r1, [r4, r2]
- bl Sin
- strh r0, [r4, 0x26]
- ldrh r0, [r4, 0x36]
- adds r0, 0x1
- strh r0, [r4, 0x36]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x5
- ble _080DF880
- strh r5, [r4, 0x36]
- ldrh r1, [r4, 0x38]
- movs r2, 0x38
- ldrsh r0, [r4, r2]
- cmp r0, 0xF
- bgt _080DF880
- adds r0, r1, 0x1
- strh r0, [r4, 0x38]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0xF
- ble _080DF880
- movs r0, 0x10
- strh r0, [r4, 0x38]
-_080DF880:
- ldrh r0, [r4, 0x34]
- adds r0, 0x1
- strh r0, [r4, 0x34]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x3C
- ble _080DF91E
- movs r0, 0
- strh r0, [r4, 0x34]
- ldrh r0, [r4, 0x2E]
- adds r0, 0x1
- strh r0, [r4, 0x2E]
- b _080DF91E
-_080DF89A:
- ldrh r0, [r4, 0x3A]
- ldrh r1, [r4, 0x38]
- subs r0, r1
- movs r1, 0xFF
- ands r0, r1
- strh r0, [r4, 0x3A]
- ldrh r1, [r4, 0x3C]
- movs r2, 0x3C
- ldrsh r0, [r4, r2]
- cmp r0, 0x95
- bgt _080DF8C2
- adds r0, r1, 0
- adds r0, 0x8
- strh r0, [r4, 0x3C]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x95
- ble _080DF8C2
- movs r0, 0x96
- strh r0, [r4, 0x3C]
-_080DF8C2:
- movs r1, 0x3A
- ldrsh r0, [r4, r1]
- movs r2, 0x3C
- ldrsh r1, [r4, r2]
- bl Cos
- strh r0, [r4, 0x24]
- movs r1, 0x3A
- ldrsh r0, [r4, r1]
- movs r2, 0x3C
- ldrsh r1, [r4, r2]
- bl Sin
- strh r0, [r4, 0x26]
- ldrh r0, [r4, 0x36]
- adds r0, 0x1
- strh r0, [r4, 0x36]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x5
- ble _080DF90A
- movs r0, 0
- strh r0, [r4, 0x36]
- ldrh r1, [r4, 0x38]
- movs r2, 0x38
- ldrsh r0, [r4, r2]
- cmp r0, 0xF
- bgt _080DF90A
- adds r0, r1, 0x1
- strh r0, [r4, 0x38]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0xF
- ble _080DF90A
- movs r0, 0x10
- strh r0, [r4, 0x38]
-_080DF90A:
- ldrh r0, [r4, 0x34]
- adds r0, 0x1
- strh r0, [r4, 0x34]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x14
- ble _080DF91E
- adds r0, r4, 0
- bl DestroyAnimSprite
-_080DF91E:
- pop {r4,r5}
- pop {r0}
- bx r0
- thumb_func_end sub_80DF81C
-
- thumb_func_start sub_80DF924
-sub_80DF924: @ 80DF924
- push {r4-r6,lr}
- sub sp, 0xC
- lsls r0, 24
- lsrs r0, 24
- lsls r1, r0, 2
- adds r1, r0
- lsls r1, 3
- ldr r0, _080DF950 @ =gTasks
- adds r4, r1, r0
- ldr r0, _080DF954 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankIdentity_permutated
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x1
- bne _080DF960
- ldr r0, _080DF958 @ =REG_BG1HOFS
- str r0, [sp]
- ldr r0, _080DF95C @ =gBattle_BG1_X
- b _080DF966
- .align 2, 0
-_080DF950: .4byte gTasks
-_080DF954: .4byte gAnimBankAttacker
-_080DF958: .4byte REG_BG1HOFS
-_080DF95C: .4byte gBattle_BG1_X
-_080DF960:
- ldr r0, _080DF9DC @ =REG_BG2HOFS
- str r0, [sp]
- ldr r0, _080DF9E0 @ =gBattle_BG2_X
-_080DF966:
- ldrh r0, [r0]
- strh r0, [r4, 0xC]
- ldr r0, _080DF9E4 @ =0xa2600001
- str r0, [sp, 0x4]
- mov r1, sp
- movs r5, 0
- movs r0, 0x1
- strb r0, [r1, 0x8]
- mov r0, sp
- strb r5, [r0, 0x9]
- ldr r0, _080DF9E8 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl sub_8077FC0
- lsls r0, 24
- lsrs r0, 24
- adds r1, r0, 0
- subs r1, 0x20
- strh r1, [r4, 0xE]
- adds r0, 0x20
- strh r0, [r4, 0x10]
- cmp r1, 0
- bge _080DF996
- strh r5, [r4, 0xE]
-_080DF996:
- ldrh r3, [r4, 0xE]
- movs r1, 0x10
- ldrsh r0, [r4, r1]
- cmp r3, r0
- bgt _080DF9C4
- ldr r5, _080DF9EC @ =gUnknown_03004DE0
- movs r0, 0xF0
- lsls r0, 3
- adds r6, r5, r0
-_080DF9A8:
- lsls r1, r3, 1
- adds r2, r1, r5
- ldrh r0, [r4, 0xC]
- strh r0, [r2]
- adds r1, r6
- ldrh r0, [r4, 0xC]
- strh r0, [r1]
- adds r0, r3, 0x1
- lsls r0, 16
- lsrs r3, r0, 16
- movs r1, 0x10
- ldrsh r0, [r4, r1]
- cmp r3, r0
- ble _080DF9A8
-_080DF9C4:
- ldr r0, [sp]
- ldr r1, [sp, 0x4]
- ldr r2, [sp, 0x8]
- bl sub_80895F8
- ldr r0, _080DF9F0 @ =sub_80DF9F4
- str r0, [r4]
- add sp, 0xC
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_080DF9DC: .4byte REG_BG2HOFS
-_080DF9E0: .4byte gBattle_BG2_X
-_080DF9E4: .4byte 0xa2600001
-_080DF9E8: .4byte gAnimBankAttacker
-_080DF9EC: .4byte gUnknown_03004DE0
-_080DF9F0: .4byte sub_80DF9F4
- thumb_func_end sub_80DF924
-
- thumb_func_start sub_80DF9F4
-sub_80DF9F4: @ 80DF9F4
- push {lr}
- lsls r0, 24
- lsrs r3, r0, 24
- lsls r0, r3, 2
- adds r0, r3
- lsls r0, 3
- ldr r1, _080DFA18 @ =gTasks
- adds r2, r0, r1
- movs r1, 0x8
- ldrsh r0, [r2, r1]
- cmp r0, 0x4
- bhi _080DFAAA
- lsls r0, 2
- ldr r1, _080DFA1C @ =_080DFA20
- adds r0, r1
- ldr r0, [r0]
- mov pc, r0
- .align 2, 0
-_080DFA18: .4byte gTasks
-_080DFA1C: .4byte _080DFA20
- .align 2, 0
-_080DFA20:
- .4byte _080DFA34
- .4byte _080DFA56
- .4byte _080DFA66
- .4byte _080DFA92
- .4byte _080DFAA4
-_080DFA34:
- ldrh r0, [r2, 0x16]
- adds r0, 0x1
- strh r0, [r2, 0x16]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x1
- ble _080DFA8A
- movs r0, 0
- strh r0, [r2, 0x16]
- ldrh r0, [r2, 0x14]
- adds r0, 0x1
- strh r0, [r2, 0x14]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x3
- bne _080DFA8A
- b _080DFA84
-_080DFA56:
- ldrh r0, [r2, 0xA]
- adds r0, 0x1
- strh r0, [r2, 0xA]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x3C
- ble _080DFA8A
- b _080DFA84
-_080DFA66:
- ldrh r0, [r2, 0x16]
- adds r0, 0x1
- strh r0, [r2, 0x16]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x1
- ble _080DFA8A
- movs r0, 0
- strh r0, [r2, 0x16]
- ldrh r0, [r2, 0x14]
- subs r0, 0x1
- strh r0, [r2, 0x14]
- lsls r0, 16
- cmp r0, 0
- bne _080DFA8A
-_080DFA84:
- ldrh r0, [r2, 0x8]
- adds r0, 0x1
- strh r0, [r2, 0x8]
-_080DFA8A:
- adds r0, r2, 0
- bl sub_80DFAB0
- b _080DFAAA
-_080DFA92:
- ldr r1, _080DFAA0 @ =gUnknown_03004DC0
- movs r0, 0x3
- strb r0, [r1, 0x15]
- ldrh r0, [r2, 0x8]
- adds r0, 0x1
- strh r0, [r2, 0x8]
- b _080DFAAA
- .align 2, 0
-_080DFAA0: .4byte gUnknown_03004DC0
-_080DFAA4:
- adds r0, r3, 0
- bl DestroyAnimVisualTask
-_080DFAAA:
- pop {r0}
- bx r0
- thumb_func_end sub_80DF9F4
-
- thumb_func_start sub_80DFAB0
-sub_80DFAB0: @ 80DFAB0
- push {r4-r7,lr}
- mov r7, r8
- push {r7}
- adds r5, r0, 0
- ldrh r3, [r5, 0x12]
- ldrh r4, [r5, 0xE]
- movs r1, 0x10
- ldrsh r0, [r5, r1]
- cmp r4, r0
- bgt _080DFB06
- ldr r7, _080DFB1C @ =gUnknown_03004DE0
- mov r12, r7
- ldr r0, _080DFB20 @ =gSineTable
- mov r8, r0
- ldr r6, _080DFB24 @ =gUnknown_03004DC0
-_080DFACE:
- lsls r2, r4, 1
- ldrb r1, [r6, 0x14]
- lsls r0, r1, 4
- subs r0, r1
- lsls r0, 7
- adds r2, r0
- add r2, r12
- lsls r0, r3, 1
- add r0, r8
- movs r7, 0
- ldrsh r1, [r0, r7]
- movs r7, 0x14
- ldrsh r0, [r5, r7]
- muls r0, r1
- asrs r0, 7
- ldrh r1, [r5, 0xC]
- adds r0, r1
- strh r0, [r2]
- adds r3, 0x8
- movs r0, 0xFF
- ands r3, r0
- adds r0, r4, 0x1
- lsls r0, 16
- lsrs r4, r0, 16
- movs r7, 0x10
- ldrsh r0, [r5, r7]
- cmp r4, r0
- ble _080DFACE
-_080DFB06:
- ldrh r0, [r5, 0x12]
- adds r0, 0x9
- movs r1, 0xFF
- ands r0, r1
- strh r0, [r5, 0x12]
- pop {r3}
- mov r8, r3
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_080DFB1C: .4byte gUnknown_03004DE0
-_080DFB20: .4byte gSineTable
-_080DFB24: .4byte gUnknown_03004DC0
- thumb_func_end sub_80DFAB0
-
- thumb_func_start sub_80DFB28
-sub_80DFB28: @ 80DFB28
- push {r4-r6,lr}
- mov r6, r8
- push {r6}
- adds r4, r0, 0
- ldr r5, _080DFBC8 @ =gBattleAnimArgs
- movs r0, 0x4
- ldrsh r1, [r5, r0]
- lsls r0, r1, 1
- adds r0, r1
- movs r1, 0x5
- bl __divsi3
- adds r6, r0, 0
- ldr r1, _080DFBCC @ =gAnimBankAttacker
- mov r8, r1
- ldrb r0, [r1]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r4, 0x20]
- mov r2, r8
- ldrb r0, [r2]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- ldrh r3, [r5, 0x8]
- adds r0, r3
- strh r0, [r4, 0x22]
- movs r1, 0x2
- ldrsh r0, [r5, r1]
- movs r2, 0x4
- ldrsh r1, [r5, r2]
- bl Cos
- strh r0, [r4, 0x30]
- movs r3, 0x2
- ldrsh r0, [r5, r3]
- lsls r6, 16
- asrs r6, 16
- adds r1, r6, 0
- bl Sin
- strh r0, [r4, 0x32]
- ldrh r1, [r4, 0x30]
- ldrh r2, [r5]
- adds r3, r2, 0
- muls r3, r1
- adds r1, r3, 0
- ldrh r3, [r4, 0x20]
- adds r1, r3
- strh r1, [r4, 0x20]
- adds r1, r2, 0
- muls r1, r0
- adds r0, r1, 0
- ldrh r2, [r4, 0x22]
- adds r0, r2
- strh r0, [r4, 0x22]
- ldrh r0, [r5, 0x6]
- strh r0, [r4, 0x34]
- ldr r0, _080DFBD0 @ =sub_80DFBD8
- str r0, [r4, 0x1C]
- adds r4, 0x2E
- ldr r2, _080DFBD4 @ =gUnknown_03000730
- movs r1, 0x6
-_080DFBB0:
- ldrh r0, [r4]
- strh r0, [r2]
- adds r4, 0x2
- adds r2, 0x2
- subs r1, 0x1
- cmp r1, 0
- bge _080DFBB0
- pop {r3}
- mov r8, r3
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_080DFBC8: .4byte gBattleAnimArgs
-_080DFBCC: .4byte gAnimBankAttacker
-_080DFBD0: .4byte sub_80DFBD8
-_080DFBD4: .4byte gUnknown_03000730
- thumb_func_end sub_80DFB28
-
- thumb_func_start sub_80DFBD8
-sub_80DFBD8: @ 80DFBD8
- push {r4,lr}
- adds r4, r0, 0
- ldrh r0, [r4, 0x30]
- ldrh r1, [r4, 0x36]
- adds r0, r1
- strh r0, [r4, 0x36]
- ldrh r0, [r4, 0x32]
- ldrh r2, [r4, 0x38]
- adds r0, r2
- strh r0, [r4, 0x38]
- movs r1, 0x36
- ldrsh r0, [r4, r1]
- movs r1, 0xA
- bl __divsi3
- strh r0, [r4, 0x24]
- movs r2, 0x38
- ldrsh r0, [r4, r2]
- movs r1, 0xA
- bl __divsi3
- strh r0, [r4, 0x26]
- ldrh r0, [r4, 0x2E]
- adds r0, 0x1
- strh r0, [r4, 0x2E]
- lsls r0, 16
- asrs r0, 16
- movs r2, 0x34
- ldrsh r1, [r4, r2]
- cmp r0, r1
- ble _080DFC1C
- adds r0, r4, 0
- bl DestroyAnimSprite
-_080DFC1C:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_80DFBD8
-
- thumb_func_start sub_80DFC24
-sub_80DFC24: @ 80DFC24
- push {r4,lr}
- lsls r0, 24
- lsrs r4, r0, 24
- ldr r0, _080DFC58 @ =gTasks
- lsls r1, r4, 2
- adds r1, r4
- lsls r1, 3
- adds r1, r0
- ldr r0, _080DFC5C @ =gBattleAnimArgs
- ldrh r0, [r0]
- strh r0, [r1, 0x8]
- ldr r0, _080DFC60 @ =gAnimBankAttacker
- ldrb r0, [r0]
- movs r2, 0x10
- strh r2, [r1, 0xA]
- ldr r1, _080DFC64 @ =REG_BLDALPHA
- strh r2, [r1]
- bl GetBankIdentity_permutated
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x1
- bne _080DFC70
- ldr r1, _080DFC68 @ =REG_BLDCNT
- ldr r2, _080DFC6C @ =0x00003f42
- b _080DFC74
- .align 2, 0
-_080DFC58: .4byte gTasks
-_080DFC5C: .4byte gBattleAnimArgs
-_080DFC60: .4byte gAnimBankAttacker
-_080DFC64: .4byte REG_BLDALPHA
-_080DFC68: .4byte REG_BLDCNT
-_080DFC6C: .4byte 0x00003f42
-_080DFC70:
- ldr r1, _080DFC8C @ =REG_BLDCNT
- ldr r2, _080DFC90 @ =0x00003f44
-_080DFC74:
- adds r0, r2, 0
- strh r0, [r1]
- ldr r0, _080DFC94 @ =gTasks
- lsls r1, r4, 2
- adds r1, r4
- lsls r1, 3
- adds r1, r0
- ldr r0, _080DFC98 @ =sub_80DFC9C
- str r0, [r1]
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_080DFC8C: .4byte REG_BLDCNT
-_080DFC90: .4byte 0x00003f44
-_080DFC94: .4byte gTasks
-_080DFC98: .4byte sub_80DFC9C
- thumb_func_end sub_80DFC24
-
- thumb_func_start sub_80DFC9C
-sub_80DFC9C: @ 80DFC9C
- push {r4,r5,lr}
- lsls r0, 24
- lsrs r5, r0, 24
- ldr r1, _080DFD04 @ =gTasks
- lsls r0, r5, 2
- adds r0, r5
- lsls r0, 3
- adds r4, r0, r1
- ldrh r0, [r4, 0xA]
- lsrs r2, r0, 8
- lsls r0, 24
- lsrs r1, r0, 24
- movs r3, 0xC
- ldrsh r0, [r4, r3]
- ldrb r3, [r4, 0x8]
- cmp r0, r3
- bne _080DFD18
- adds r2, 0x1
- lsls r2, 24
- lsrs r2, 24
- subs r0, r1, 0x1
- lsls r0, 24
- lsrs r0, 24
- lsls r1, r2, 8
- orrs r1, r0
- movs r3, 0
- strh r1, [r4, 0xA]
- ldr r0, _080DFD08 @ =REG_BLDALPHA
- strh r1, [r0]
- strh r3, [r4, 0xC]
- cmp r2, 0x10
- bne _080DFD1E
- ldr r2, _080DFD0C @ =gSprites
- ldr r1, _080DFD10 @ =gObjectBankIDs
- ldr r0, _080DFD14 @ =gAnimBankAttacker
- ldrb r0, [r0]
- adds r0, r1
- ldrb r1, [r0]
- lsls r0, r1, 4
- adds r0, r1
- lsls r0, 2
- adds r0, r2
- adds r0, 0x3E
- ldrb r1, [r0]
- movs r2, 0x4
- orrs r1, r2
- strb r1, [r0]
- adds r0, r5, 0
- bl DestroyAnimVisualTask
- b _080DFD1E
- .align 2, 0
-_080DFD04: .4byte gTasks
-_080DFD08: .4byte REG_BLDALPHA
-_080DFD0C: .4byte gSprites
-_080DFD10: .4byte gObjectBankIDs
-_080DFD14: .4byte gAnimBankAttacker
-_080DFD18:
- ldrh r0, [r4, 0xC]
- adds r0, 0x1
- strh r0, [r4, 0xC]
-_080DFD1E:
- pop {r4,r5}
- pop {r0}
- bx r0
- thumb_func_end sub_80DFC9C
-
- thumb_func_start sub_80DFD24
-sub_80DFD24: @ 80DFD24
- lsls r0, 24
- lsrs r0, 24
- ldr r2, _080DFD48 @ =gTasks
- lsls r1, r0, 2
- adds r1, r0
- lsls r1, 3
- adds r1, r2
- ldr r0, _080DFD4C @ =gBattleAnimArgs
- ldrh r0, [r0]
- strh r0, [r1, 0x8]
- movs r2, 0x80
- lsls r2, 5
- strh r2, [r1, 0xA]
- ldr r0, _080DFD50 @ =sub_80DFD58
- str r0, [r1]
- ldr r0, _080DFD54 @ =REG_BLDALPHA
- strh r2, [r0]
- bx lr
- .align 2, 0
-_080DFD48: .4byte gTasks
-_080DFD4C: .4byte gBattleAnimArgs
-_080DFD50: .4byte sub_80DFD58
-_080DFD54: .4byte REG_BLDALPHA
- thumb_func_end sub_80DFD24
-
- thumb_func_start sub_80DFD58
-sub_80DFD58: @ 80DFD58
- push {r4,r5,lr}
- lsls r0, 24
- lsrs r4, r0, 24
- ldr r1, _080DFDA8 @ =gTasks
- lsls r0, r4, 2
- adds r0, r4
- lsls r0, 3
- adds r2, r0, r1
- ldrh r0, [r2, 0xA]
- lsrs r1, r0, 8
- lsls r0, 24
- lsrs r5, r0, 24
- movs r3, 0xC
- ldrsh r0, [r2, r3]
- ldrb r3, [r2, 0x8]
- cmp r0, r3
- bne _080DFDB4
- subs r0, r1, 0x1
- lsls r0, 24
- lsrs r3, r0, 24
- adds r0, r5, 0x1
- lsls r0, 24
- lsrs r0, 24
- lsls r1, r3, 8
- orrs r1, r0
- movs r0, 0
- strh r1, [r2, 0xA]
- ldr r5, _080DFDAC @ =REG_BLDALPHA
- strh r1, [r5]
- strh r0, [r2, 0xC]
- cmp r3, 0
- bne _080DFDBA
- ldr r0, _080DFDB0 @ =REG_BLDCNT
- strh r3, [r0]
- strh r3, [r5]
- adds r0, r4, 0
- bl DestroyAnimVisualTask
- b _080DFDBA
- .align 2, 0
-_080DFDA8: .4byte gTasks
-_080DFDAC: .4byte REG_BLDALPHA
-_080DFDB0: .4byte REG_BLDCNT
-_080DFDB4:
- ldrh r0, [r2, 0xC]
- adds r0, 0x1
- strh r0, [r2, 0xC]
-_080DFDBA:
- pop {r4,r5}
- pop {r0}
- bx r0
- thumb_func_end sub_80DFD58
-
- thumb_func_start sub_80DFDC0
-sub_80DFDC0: @ 80DFDC0
- push {r4,lr}
- lsls r0, 24
- lsrs r4, r0, 24
- ldr r1, _080DFDE8 @ =REG_BLDALPHA
- movs r2, 0x80
- lsls r2, 5
- adds r0, r2, 0
- strh r0, [r1]
- ldr r0, _080DFDEC @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankIdentity_permutated
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x1
- bne _080DFDF8
- ldr r1, _080DFDF0 @ =REG_BLDCNT
- ldr r2, _080DFDF4 @ =0x00003f42
- b _080DFDFC
- .align 2, 0
-_080DFDE8: .4byte REG_BLDALPHA
-_080DFDEC: .4byte gAnimBankAttacker
-_080DFDF0: .4byte REG_BLDCNT
-_080DFDF4: .4byte 0x00003f42
-_080DFDF8:
- ldr r1, _080DFE0C @ =REG_BLDCNT
- ldr r2, _080DFE10 @ =0x00003f44
-_080DFDFC:
- adds r0, r2, 0
- strh r0, [r1]
- adds r0, r4, 0
- bl DestroyAnimVisualTask
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_080DFE0C: .4byte REG_BLDCNT
-_080DFE10: .4byte 0x00003f44
- thumb_func_end sub_80DFDC0
-
- thumb_func_start sub_80DFE14
-sub_80DFE14: @ 80DFE14
- push {r4-r6,lr}
- adds r4, r0, 0
- ldr r6, _080DFE80 @ =gAnimBankTarget
- ldrb r0, [r6]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r4, 0x30]
- ldr r5, _080DFE84 @ =gAnimBankAttacker
- ldrb r0, [r5]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r4, 0x32]
- ldrb r0, [r6]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r4, 0x34]
- ldrb r0, [r5]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r4, 0x36]
- movs r0, 0x7E
- strh r0, [r4, 0x2E]
- adds r0, r4, 0
- bl sub_8078A5C
- ldrh r0, [r4, 0x30]
- negs r0, r0
- strh r0, [r4, 0x34]
- ldrh r0, [r4, 0x32]
- negs r0, r0
- strh r0, [r4, 0x36]
- ldr r0, _080DFE88 @ =0x0000ffd8
- strh r0, [r4, 0x3A]
- ldr r1, _080DFE8C @ =sub_80DFE90
- str r1, [r4, 0x1C]
- adds r0, r4, 0
- bl _call_via_r1
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_080DFE80: .4byte gAnimBankTarget
-_080DFE84: .4byte gAnimBankAttacker
-_080DFE88: .4byte 0x0000ffd8
-_080DFE8C: .4byte sub_80DFE90
- thumb_func_end sub_80DFE14
-
- thumb_func_start sub_80DFE90
-sub_80DFE90: @ 80DFE90
- push {r4-r6,lr}
- adds r4, r0, 0
- ldrh r5, [r4, 0x30]
- ldrh r0, [r4, 0x34]
- adds r2, r5, r0
- strh r2, [r4, 0x34]
- ldrh r3, [r4, 0x32]
- ldrh r6, [r4, 0x36]
- adds r1, r3, r6
- strh r1, [r4, 0x36]
- lsls r0, r2, 16
- asrs r0, 24
- strh r0, [r4, 0x24]
- lsls r0, r1, 16
- asrs r0, 24
- strh r0, [r4, 0x26]
- movs r6, 0x3C
- ldrsh r0, [r4, r6]
- cmp r0, 0
- bne _080DFED2
- adds r0, r2, r5
- strh r0, [r4, 0x34]
- adds r1, r3
- strh r1, [r4, 0x36]
- lsls r0, 16
- asrs r0, 24
- strh r0, [r4, 0x24]
- lsls r1, 16
- asrs r1, 24
- strh r1, [r4, 0x26]
- ldrh r0, [r4, 0x2E]
- subs r0, 0x1
- strh r0, [r4, 0x2E]
-_080DFED2:
- movs r1, 0x38
- ldrsh r0, [r4, r1]
- movs r2, 0x3A
- ldrsh r1, [r4, r2]
- bl Sin
- ldrh r6, [r4, 0x26]
- adds r0, r6
- strh r0, [r4, 0x26]
- ldrh r0, [r4, 0x38]
- adds r0, 0x3
- movs r1, 0xFF
- ands r0, r1
- strh r0, [r4, 0x38]
- cmp r0, 0x7F
- ble _080DFF02
- movs r0, 0
- strh r0, [r4, 0x38]
- ldrh r0, [r4, 0x3A]
- adds r0, 0x14
- strh r0, [r4, 0x3A]
- ldrh r0, [r4, 0x3C]
- adds r0, 0x1
- strh r0, [r4, 0x3C]
-_080DFF02:
- ldrh r0, [r4, 0x2E]
- subs r0, 0x1
- strh r0, [r4, 0x2E]
- lsls r0, 16
- cmp r0, 0
- bne _080DFF14
- adds r0, r4, 0
- bl DestroyAnimSprite
-_080DFF14:
- pop {r4-r6}
- pop {r0}
- bx r0
- thumb_func_end sub_80DFE90
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/asm/fight.s b/asm/fight.s
index d0d042113..e8e3299af 100755
--- a/asm/fight.s
+++ b/asm/fight.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -1688,7 +1688,7 @@ _080D9CDE:
lsls r0, 24
cmp r0, 0
bne _080D9D14
- ldr r1, _080D9D10 @ =gUnknown_030041B0
+ ldr r1, _080D9D10 @ =gBattle_BG3_X
ldrh r0, [r4, 0x1A]
lsls r0, 16
asrs r0, 24
@@ -1699,9 +1699,9 @@ _080D9CDE:
b _080D9D24
.align 2, 0
_080D9D0C: .4byte gAnimBankTarget
-_080D9D10: .4byte gUnknown_030041B0
+_080D9D10: .4byte gBattle_BG3_X
_080D9D14:
- ldr r2, _080D9D64 @ =gUnknown_030041B0
+ ldr r2, _080D9D64 @ =gBattle_BG3_X
ldrh r1, [r4, 0x1A]
lsls r1, 16
asrs r1, 24
@@ -1710,7 +1710,7 @@ _080D9D14:
strh r0, [r2]
adds r7, r2, 0
_080D9D24:
- ldr r3, _080D9D68 @ =gUnknown_030041B8
+ ldr r3, _080D9D68 @ =gBattle_BG3_Y
ldrh r2, [r4, 0x1C]
lsls r0, r2, 16
asrs r0, 24
@@ -1741,8 +1741,8 @@ _080D9D5C:
pop {r0}
bx r0
.align 2, 0
-_080D9D64: .4byte gUnknown_030041B0
-_080D9D68: .4byte gUnknown_030041B8
+_080D9D64: .4byte gBattle_BG3_X
+_080D9D68: .4byte gBattle_BG3_Y
_080D9D6C: .4byte gBattleAnimArgs
thumb_func_end sub_80D9C80
diff --git a/asm/flying.s b/asm/flying.s
index 99cb11913..ce3fb050b 100755
--- a/asm/flying.s
+++ b/asm/flying.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/ghost.s b/asm/ghost.s
index 0db176d08..2934f6dbd 100755
--- a/asm/ghost.s
+++ b/asm/ghost.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -1334,7 +1334,7 @@ _080DE584:
_080DE59C:
movs r2, 0x2
movs r3, 0x6
- bl sub_8089944
+ bl ScanlineEffect_InitWave
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x1C]
@@ -1507,7 +1507,7 @@ _080DE6E8:
beq _080DE740
b _080DE7AA
_080DE6EE:
- ldr r1, _080DE710 @ =gUnknown_03004DC0
+ ldr r1, _080DE710 @ =gScanlineEffect
movs r0, 0x3
strb r0, [r1, 0x15]
movs r0, 0x1
@@ -1523,7 +1523,7 @@ _080DE6EE:
ldr r0, _080DE714 @ =0x0000fdff
b _080DE720
.align 2, 0
-_080DE710: .4byte gUnknown_03004DC0
+_080DE710: .4byte gScanlineEffect
_080DE714: .4byte 0x0000fdff
_080DE718:
movs r2, 0x80
diff --git a/asm/ground.s b/asm/ground.s
index fd4cecbfd..3d4b69a9f 100755
--- a/asm/ground.s
+++ b/asm/ground.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -631,7 +631,7 @@ _080E13D6:
_080E13F8: .4byte gBattle_BG2_Y
_080E13FC: .4byte gSprites
_080E1400:
- ldr r1, _080E1410 @ =gUnknown_03004DC0
+ ldr r1, _080E1410 @ =gScanlineEffect
movs r0, 0x3
strb r0, [r1, 0x15]
_080E1406:
@@ -640,7 +640,7 @@ _080E1406:
strh r0, [r4, 0x8]
b _080E1432
.align 2, 0
-_080E1410: .4byte gUnknown_03004DC0
+_080E1410: .4byte gScanlineEffect
_080E1414:
adds r0, r2, 0
bl DestroyAnimVisualTask
@@ -925,7 +925,7 @@ _080E161C:
ldrsh r0, [r0, r1]
cmp r0, 0
bne _080E1662
- ldr r1, _080E1658 @ =gUnknown_03004DC0
+ ldr r1, _080E1658 @ =gScanlineEffect
movs r0, 0x3
strb r0, [r1, 0x15]
_080E164A:
@@ -935,7 +935,7 @@ _080E164A:
b _080E1662
.align 2, 0
_080E1654: .4byte gSprites
-_080E1658: .4byte gUnknown_03004DC0
+_080E1658: .4byte gScanlineEffect
_080E165C:
adds r0, r2, 0
bl DestroyAnimVisualTask
@@ -980,7 +980,7 @@ _080E169C:
asrs r4, r0, 16
cmp r2, r0
bge _080E16C8
- ldr r5, _080E1720 @ =gUnknown_03004DE0
+ ldr r5, _080E1720 @ =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r6, r5, r0
@@ -1003,7 +1003,7 @@ _080E16C8:
asrs r0, r1, 16
cmp r0, 0x9F
bgt _080E16F6
- ldr r4, _080E1720 @ =gUnknown_03004DE0
+ ldr r4, _080E1720 @ =gScanlineEffectRegBuffers
lsls r0, r3, 16
asrs r0, 16
adds r3, r0, 0
@@ -1035,7 +1035,7 @@ _080E16F6:
ldr r0, [sp]
ldr r1, [sp, 0x4]
ldr r2, [sp, 0x8]
- bl sub_80895F8
+ bl ScanlineEffect_SetParams
add sp, 0xC
pop {r4-r6}
pop {r0}
@@ -1043,7 +1043,7 @@ _080E16F6:
.align 2, 0
_080E1718: .4byte gBattle_BG2_X
_080E171C: .4byte REG_BG2HOFS
-_080E1720: .4byte gUnknown_03004DE0
+_080E1720: .4byte gScanlineEffectRegBuffers
_080E1724: .4byte 0xa2600001
thumb_func_end sub_80E1668
@@ -1243,14 +1243,14 @@ _080E189C:
beq _080E18C8
cmp r0, 0x5
bne _080E1908
- ldr r0, _080E18C0 @ =gUnknown_030041B0
+ ldr r0, _080E18C0 @ =gBattle_BG3_X
ldrh r0, [r0]
strh r0, [r4, 0x22]
ldr r0, _080E18C4 @ =sub_80E1934
b _080E1926
.align 2, 0
_080E18BC: .4byte gAnimMovePower
-_080E18C0: .4byte gUnknown_030041B0
+_080E18C0: .4byte gBattle_BG3_X
_080E18C4: .4byte sub_80E1934
_080E18C8:
movs r0, 0
@@ -1351,16 +1351,16 @@ _080E1962:
ands r0, r1
cmp r0, 0
bne _080E198C
- ldr r1, _080E1988 @ =gUnknown_030041B0
+ ldr r1, _080E1988 @ =gBattle_BG3_X
ldrh r0, [r3, 0x26]
ldrh r2, [r3, 0x22]
adds r0, r2
strh r0, [r1]
b _080E1996
.align 2, 0
-_080E1988: .4byte gUnknown_030041B0
+_080E1988: .4byte gBattle_BG3_X
_080E198C:
- ldr r0, _080E19B4 @ =gUnknown_030041B0
+ ldr r0, _080E19B4 @ =gBattle_BG3_X
ldrh r1, [r3, 0x22]
ldrh r2, [r3, 0x26]
subs r1, r2
@@ -1382,7 +1382,7 @@ _080E1996:
strh r0, [r3, 0x24]
b _080E1A0C
.align 2, 0
-_080E19B4: .4byte gUnknown_030041B0
+_080E19B4: .4byte gBattle_BG3_X
_080E19B8:
ldrh r0, [r3, 0xA]
adds r0, 0x1
@@ -1397,16 +1397,16 @@ _080E19B8:
ands r1, r0
cmp r1, 0
bne _080E19E4
- ldr r1, _080E19E0 @ =gUnknown_030041B0
+ ldr r1, _080E19E0 @ =gBattle_BG3_X
ldrh r0, [r3, 0x24]
ldrh r2, [r3, 0x22]
adds r0, r2
strh r0, [r1]
b _080E19EE
.align 2, 0
-_080E19E0: .4byte gUnknown_030041B0
+_080E19E0: .4byte gBattle_BG3_X
_080E19E4:
- ldr r0, _080E1A14 @ =gUnknown_030041B0
+ ldr r0, _080E1A14 @ =gBattle_BG3_X
ldrh r1, [r3, 0x22]
ldrh r2, [r3, 0x24]
subs r1, r2
@@ -1433,9 +1433,9 @@ _080E1A0C:
strh r0, [r3, 0x8]
b _080E1A24
.align 2, 0
-_080E1A14: .4byte gUnknown_030041B0
+_080E1A14: .4byte gBattle_BG3_X
_080E1A18:
- ldr r1, _080E1A28 @ =gUnknown_030041B0
+ ldr r1, _080E1A28 @ =gBattle_BG3_X
ldrh r0, [r3, 0x22]
strh r0, [r1]
adds r0, r2, 0
@@ -1444,7 +1444,7 @@ _080E1A24:
pop {r0}
bx r0
.align 2, 0
-_080E1A28: .4byte gUnknown_030041B0
+_080E1A28: .4byte gBattle_BG3_X
thumb_func_end sub_80E1934
thumb_func_start sub_80E1A2C
@@ -1719,10 +1719,10 @@ _080E1BE2:
movs r0, 0xFF
ands r1, r0
strh r1, [r4, 0xC]
- ldr r2, _080E1C50 @ =gUnknown_030041B0
+ ldr r2, _080E1C50 @ =gBattle_BG3_X
ldrh r0, [r4, 0xA]
strh r0, [r2]
- ldr r0, _080E1C54 @ =gUnknown_030041B8
+ ldr r0, _080E1C54 @ =gBattle_BG3_Y
strh r1, [r0]
ldrh r0, [r6, 0x4]
strh r0, [r4, 0xE]
@@ -1736,8 +1736,8 @@ _080E1C40: .4byte gAnimBankAttacker
_080E1C44: .4byte sub_80E1C58
_080E1C48: .4byte gTasks
_080E1C4C: .4byte 0x000001ff
-_080E1C50: .4byte gUnknown_030041B0
-_080E1C54: .4byte gUnknown_030041B8
+_080E1C50: .4byte gBattle_BG3_X
+_080E1C54: .4byte gBattle_BG3_Y
thumb_func_end sub_80E1BB0
thumb_func_start sub_80E1C58
@@ -1757,10 +1757,10 @@ sub_80E1C58: @ 80E1C58
ldrsh r0, [r2, r4]
cmp r1, r0
bne _080E1C98
- ldr r0, _080E1C90 @ =gUnknown_030041B0
+ ldr r0, _080E1C90 @ =gBattle_BG3_X
movs r1, 0
strh r1, [r0]
- ldr r0, _080E1C94 @ =gUnknown_030041B8
+ ldr r0, _080E1C94 @ =gBattle_BG3_Y
strh r1, [r0]
adds r0, r3, 0
bl DestroyTask
@@ -1768,13 +1768,13 @@ sub_80E1C58: @ 80E1C58
.align 2, 0
_080E1C88: .4byte gTasks
_080E1C8C: .4byte gBattleAnimArgs
-_080E1C90: .4byte gUnknown_030041B0
-_080E1C94: .4byte gUnknown_030041B8
+_080E1C90: .4byte gBattle_BG3_X
+_080E1C94: .4byte gBattle_BG3_Y
_080E1C98:
- ldr r1, _080E1CAC @ =gUnknown_030041B0
+ ldr r1, _080E1CAC @ =gBattle_BG3_X
ldrh r0, [r2, 0xA]
strh r0, [r1]
- ldr r1, _080E1CB0 @ =gUnknown_030041B8
+ ldr r1, _080E1CB0 @ =gBattle_BG3_Y
ldrh r0, [r2, 0xC]
strh r0, [r1]
_080E1CA4:
@@ -1782,8 +1782,8 @@ _080E1CA4:
pop {r0}
bx r0
.align 2, 0
-_080E1CAC: .4byte gUnknown_030041B0
-_080E1CB0: .4byte gUnknown_030041B8
+_080E1CAC: .4byte gBattle_BG3_X
+_080E1CB0: .4byte gBattle_BG3_Y
thumb_func_end sub_80E1C58
.align 2, 0 @ Don't pad with nop.
diff --git a/asm/ice.s b/asm/ice.s
index 557be621c..032da59c3 100755
--- a/asm/ice.s
+++ b/asm/ice.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/libagbsyscall.s b/asm/libagbsyscall.s
deleted file mode 100644
index de59d4c27..000000000
--- a/asm/libagbsyscall.s
+++ /dev/null
@@ -1,91 +0,0 @@
- .include "asm/macros.inc"
- .syntax unified
-
- .text
-
- thumb_func_start ArcTan2
-ArcTan2: @ 81E07E0
- swi 0xA
- bx lr
- thumb_func_end ArcTan2
-
- thumb_func_start BgAffineSet
-BgAffineSet: @ 81E07E4
- swi 0xE
- bx lr
- thumb_func_end BgAffineSet
-
- thumb_func_start CpuFastSet
-CpuFastSet: @ 81E07E8
- swi 0xC
- bx lr
- thumb_func_end CpuFastSet
-
- thumb_func_start CpuSet
-CpuSet: @ 81E07EC
- swi 0xB
- bx lr
- thumb_func_end CpuSet
-
- thumb_func_start LZ77UnCompVram
-LZ77UnCompVram: @ 81E07F4
- swi 0x12
- bx lr
- thumb_func_end LZ77UnCompVram
-
- thumb_func_start LZ77UnCompWram
-LZ77UnCompWram: @ 81E07F8
- swi 0x11
- bx lr
- thumb_func_end LZ77UnCompWram
-
- thumb_func_start ObjAffineSet
-ObjAffineSet: @ 81E0804
- swi 0xF
- bx lr
- thumb_func_end ObjAffineSet
-
- thumb_func_start RLUnCompVram
-RLUnCompVram: @ 81E0808
- swi 0x15
- bx lr
- thumb_func_end RLUnCompVram
-
- thumb_func_start RLUnCompWram
-RLUnCompWram: @ 81E080C
- swi 0x14
- bx lr
- thumb_func_end RLUnCompWram
-
- thumb_func_start RegisterRamReset
-RegisterRamReset: @ 81E0810
- swi 0x1
- bx lr
- thumb_func_end RegisterRamReset
-
- thumb_func_start SoftReset
-SoftReset: @ 81E0814
- ldr r3, =0x04000208
- movs r2, 0
- strb r2, [r3]
- ldr r1, =0x03007f00 @ User Stack
- mov sp, r1
- swi 0x1
- swi 0
- .pool
- thumb_func_end SoftReset
-
- thumb_func_start Sqrt
-Sqrt: @ 81E082C
- swi 0x8
- bx lr
- thumb_func_end Sqrt
-
- thumb_func_start VBlankIntrWait
-VBlankIntrWait: @ 81E0830
- movs r2, 0
- swi 0x5
- bx lr
- thumb_func_end VBlankIntrWait
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/asm/libgcnmultiboot.s b/asm/libgcnmultiboot.s
deleted file mode 100644
index 91bc1890c..000000000
--- a/asm/libgcnmultiboot.s
+++ /dev/null
@@ -1,641 +0,0 @@
-@ 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.
-
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .equiv GCMB_STRUCT_COUNTER1, 0x00
- .equiv GCMB_STRUCT_COUNTER2, 0x01
- .equiv GCMB_STRUCT_MBPROGRESS, 0x02
- .equiv GCMB_STRUCT_SAVEDVCOUNT, 0x03
- .equiv GCMB_STRUCT_KEYA, 0x04
- .equiv GCMB_STRUCT_KEYB, 0x08
- .equiv GCMB_STRUCT_KEYC, 0x0C
- .equiv GCMB_STRUCT_BOOT_KEY, 0x10
- .equiv GCMB_STRUCT_IMAGE_SIZE, 0x12
- .equiv GCMB_STRUCT_SESSION_KEY, 0x14
- .equiv GCMB_STRUCT_HASH_VAL, 0x18
- .equiv GCMB_STRUCT_KEYC_DERIVATION, 0x1C
- .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, 0x04
- .equiv ROM_HEADER_NINTENDO_LOGO_LENGTH, 0x98
- .equiv ROM_HEADER_NINTENDO_LOGO_END, 0xA0
-
- .equiv MBPROGRESS_NONE, 0x00
- .equiv MBPROGRESS_LOGO_CORRECT, 0x01
- .equiv MBPROGRESS_READY_TO_BOOT, 0x02
-
- .equiv GCMB_MAGIC_BOOTKEY_HASHVAL, 0xBB
- .equiv GCMB_MAGIC_BOOTKEY, 0xBB
- .equiv GCMB_MAGIC_COUNTER2, 0xCC
- .equiv GCMB_MAGIC_KEYA, 0xDD
- .equiv GCMB_MAGIC_KEYB, 0xEE
- .equiv GCMB_MAGIC_KEYCDERIVATION, 0xFF
-
- .syntax unified
-
- .text
-
- thumb_func_start GameCubeMultiBoot_Hash
-GameCubeMultiBoot_Hash: @ 81DCB38
- push {r4,lr}
- ldr r4, pool_HashVal
- eors r3, r1
- movs r2, 0x20
-
-GameCubeMultiBoot_Hash_Loop:
- lsrs r3, 1
- bcc GameCubeMultiBoot_Hash_SkipEor
-
- eors r3, r4
-
-GameCubeMultiBoot_Hash_SkipEor:
- subs r2, 0x1
- bne GameCubeMultiBoot_Hash_Loop
-
- pop {r4,pc}
- thumb_func_end GameCubeMultiBoot_Hash
-
- thumb_func_start GameCubeMultiBoot_Main
-@ void GameCubeMultiBoot_Main(struct GameCubeMultiBoot *mb)@
-GameCubeMultiBoot_Main: @ 81DCB4C
- @ If there is no interrupt handler, skip counter manipulation
- ldr r1, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER]
- cmp r1, 0
- beq GameCubeMultiBoot_Main_SkipCounters
- @ Increment the second counter
- ldrb r1, [r0, GCMB_STRUCT_COUNTER2]
- adds r1, 0x1
- strb r1, [r0, GCMB_STRUCT_COUNTER2]
- @ If there is nothing more to do, bail out
- ldrb r1, [r0, GCMB_STRUCT_MBPROGRESS]
- cmp r1, MBPROGRESS_READY_TO_BOOT
- beq GameCubeMultiBoot_Main_Return
- @ Save current interrupt master register value
- ldr r3, pool_InterruptRegs
- ldrh r2, [r3, OFFSET_REG_IME - 0x200]
- @ Disable all interrupts
- movs r1, 0
- strh r1, [r3, OFFSET_REG_IME - 0x200]
- @ Increment the first counter, if it's less than or equal to 10.
- ldrb r1, [r0, GCMB_STRUCT_COUNTER1]
- cmp r1, 0xA
- bgt GameCubeMultiBoot_Main_SkipCounter1Inc
- adds r1, 0x1
- strb r1, [r0, GCMB_STRUCT_COUNTER1]
-GameCubeMultiBoot_Main_SkipCounter1Inc:
- @ Load the saved interrupt master register value (re-enables interrupts if they were enabled before)
- strh r2, [r3, OFFSET_REG_IME - 0x200]
-GameCubeMultiBoot_Main_SkipCounters:
- @ Initialise multiboot structures if required
- bcs GameCubeMultiBoot_Init
- @ Skip this section (check Nintendo logo) if the check has already passed
- ldrb r1, [r0, GCMB_STRUCT_MBPROGRESS]
- cmp r1, MBPROGRESS_NONE
- bne GameCubeMultiBoot_Main_SkipLogoCheck
- @ Bail out if no multiboot image data has been transferred yet
- ldr r1, [r0, GCMB_STRUCT_CUR_DEST_PTR]
- ldr r2, [r0, GCMB_STRUCT_BASE_DEST_PTR]
- subs r1, r2
- beq GameCubeMultiBoot_Main_Return2
- @ Also bail out if not enough data has been transferred
- cmp r1, ROM_HEADER_NINTENDO_LOGO_END
- bcc GameCubeMultiBoot_Main_Return2
- @ Compare the Nintendo logo of the transferred multiboot image header, with the one in the ROM image of the inserted cart
- push {r4-r6}
- movs r1, ROM_HEADER_NINTENDO_LOGO_LENGTH
- adds r2, ROM_HEADER_NINTENDO_LOGO_OFFSET
- ldr r4, pool_NintendoLogo
-GameCubeMultiBoot_Main_LogoCmpLoop:
- ldm r2!, {r5}
- ldm r4!, {r6}
- cmp r5, r6
- bne GameCubeMultiBoot_Main_LogoCmpEnd
- subs r1, 0x4
- bne GameCubeMultiBoot_Main_LogoCmpLoop
- ldm r2!, {r5}
- ldm r4!, {r6}
- eors r5, r6
- lsrs r5, 8
- str r2, [r0, GCMB_STRUCT_BASE_DEST_PTR]
-GameCubeMultiBoot_Main_LogoCmpEnd:
- pop {r4-r6}
- @ Throw everything away if the logo data didn't match
- bne GameCubeMultiBoot_Init
- @ Logo matched, set the relevent multiboot progress bit
- movs r1, MBPROGRESS_LOGO_CORRECT
- strb r1, [r0, GCMB_STRUCT_MBPROGRESS]
- @ XOR together KeyA and KeyB to get the initial multiboot image checksum value
- ldr r1, [r0, GCMB_STRUCT_KEYA]
- ldr r2, [r0, GCMB_STRUCT_KEYB]
- eors r1, r2
- str r1, [r0, GCMB_STRUCT_HASH_VAL]
- @ ...also use it as the initial value for the image encryption session key. Algorithm is the same as the GBA BIOS multiboot: sessionkey = (initialvalue * 0x6177614b) + 1
- ldr r2, pool_Kawa
- muls r1, r2
- adds r1, 0x1
- str r1, [r0, GCMB_STRUCT_SESSION_KEY]
-GameCubeMultiBoot_Main_Return:
- bx lr
-GameCubeMultiBoot_Main_SkipLogoCheck:
- @ If this code is executed, then the logo check has passed, and the data being transferred in is encrypted.
- @ Set up registers.
- ldr r1, [r0, GCMB_STRUCT_CUR_DEST_PTR]
- mov r12, r1
- ldr r3, [r0, GCMB_STRUCT_HASH_VAL]
- push {r4-r7}
- ldr r4, [r0, GCMB_STRUCT_BASE_DEST_PTR]
- ldr r5, pool_Kawa
- ldr r6, [r0, GCMB_STRUCT_SESSION_KEY]
- ldr r7, pool_HashVal
-GameCubeMultiBoot_Main_ImageDecryptHashLoop:
- @ If there's no more data, break out of the loop
- cmp r4, r12
- bcs GameCubeMultiBoot_Main_ImageDecryptHashEnd
- @ Get the next uint32
- ldr r1, [r4]
- @ Decrypt the ciphertext: plaintext = (ciphertext ^ sessionkey) + hashval
- eors r1, r6
- adds r1, r3
- @ Save the current uint32 of plaintext and advance the pointer
- stm r4!, {r1}
- @ Advance the hashval with this uint32 of plaintext -- this is the same code as GameCubeMultiBoot_Hash.
- eors r3, r1
- movs r2, 0x20
-GameCubeMultiBoot_Main_HashLoop:
- lsrs r3, 1
- bcc GameCubeMultiBoot_Main_HashSkipEor
- eors r3, r7
-GameCubeMultiBoot_Main_HashSkipEor:
- subs r2, 0x1
- bne GameCubeMultiBoot_Main_HashLoop
- @ Advance the sessionkey with the usual algorithm: sessionkey = (sessionkey * 0x6177614b) + 1
- muls r6, r5
- adds r6, 0x1
- b GameCubeMultiBoot_Main_ImageDecryptHashLoop
-GameCubeMultiBoot_Main_ImageDecryptHashEnd:
- @ Save the new pointer, sessionkey, hashval
- str r4, [r0, GCMB_STRUCT_BASE_DEST_PTR]
- str r6, [r0, GCMB_STRUCT_SESSION_KEY]
- pop {r4-r7}
- str r3, [r0, GCMB_STRUCT_HASH_VAL]
- @ Bail out if the image size is unknown
- ldrh r1, [r0, GCMB_STRUCT_IMAGE_SIZE]
- cmp r1, 0
- bne GameCubeMultiBoot_Main_Return2
- @ Bail out if no image data has been transferred
- ldr r1, [r0, GCMB_STRUCT_CUR_DEST_PTR]
- ldr r2, [r0, GCMB_STRUCT_BASE_DEST_PTR]
- cmp r1, r2
- bne GameCubeMultiBoot_Main_Return2
- @ If KeyC hasn't been generated yet, go generate it
- ldr r1, [r0, GCMB_STRUCT_KEYC]
- cmp r1, 0
- beq GameCubeMultiBoot_Main_GenerateKeyC
- @ If the other side hasn't sent its boot key yet, bail out
- ldrh r1, [r0, GCMB_STRUCT_BOOT_KEY]
- cmp r1, 0
- beq GameCubeMultiBoot_Main_Return
- @ Save off LR so it doesn't get clobbered by the upcoming function call
- mov r12, lr
- @ Generate the real boot key, which is the checksum of a hardcoded value and KeyC
- movs r1, GCMB_MAGIC_BOOTKEY_HASHVAL
- ldr r3, [r0, GCMB_STRUCT_KEYC]
- bl GameCubeMultiBoot_Hash
- ldrh r1, [r0, GCMB_STRUCT_BOOT_KEY]
- @ Restore the saved LR value
- mov lr, r12
- @ Compare the two boot keys (real and passed in), if they don't match then throw everything away
- subs r1, r3
- bne GameCubeMultiBoot_Init
- @ The two boot keys matched, tell the caller that the image is ready to boot
- movs r1, MBPROGRESS_READY_TO_BOOT
- strb r1, [r0, GCMB_STRUCT_MBPROGRESS]
- @ Nothing more to do, return.
- bx lr
-GameCubeMultiBoot_Main_GenerateKeyC:
- @ Save off LR so it doesn't get clobbered by the upcoming function call
- mov r12, lr
- @ KeyC = (SavedVCount << 24) - 1
- ldrb r1, [r0, GCMB_STRUCT_SAVEDVCOUNT]
- lsls r1, 24
- subs r1, 0x1
- str r1, [r0, GCMB_STRUCT_KEYC]
- @ Hash the KeyC with the multiboot image checksum to generate the KeyC derivation material to be sent to the other side of the link
- bl GameCubeMultiBoot_Hash
- @ Make sure the sent KeyC derivation material contains a magic value so that the other side can detect it
- lsls r3, 8
- adds r3, GCMB_MAGIC_KEYCDERIVATION
- @ Save off the KeyC derivation material and return to caller
- str r3, [r0, GCMB_STRUCT_KEYC_DERIVATION]
- bx r12
-GameCubeMultiBoot_Main_Return2:
- bx lr
- thumb_func_end GameCubeMultiBoot_Main
-
- .align 2, 0
-
-pool_HashVal: .4byte 0xa1c1
-
-pool_Kawa: .ascii "Kawa" @ name of BIOS developer
-
-pool_NintendoLogo: .4byte RomHeaderNintendoLogo
-
- thumb_func_start GameCubeMultiBoot_ExecuteProgram
-@ void GameCubeMultiBoot_ExecuteProgram(struct GameCubeMultiBoot *mb)@
-GameCubeMultiBoot_ExecuteProgram: @ 81DCC4C
- @ If there's no multiboot image ready, just return to caller
- ldrb r1, [r0, GCMB_STRUCT_MBPROGRESS]
- cmp r1, MBPROGRESS_READY_TO_BOOT
- bne GameCubeMultiBoot_ExecuteProgram_Fail
- @ Disable interrupts
- ldr r3, pool_InterruptRegs
- movs r1, 0
- strh r1, [r3, OFFSET_REG_IME - 0x200]
- @ Jump to the real entry point of the multiboot image (past the image header), in ARM mode
- ldr r1, pool_MultiBootLoadAddr
- adds r1, 0xC0
- bx r1
-GameCubeMultiBoot_ExecuteProgram_Fail:
- bx lr
- thumb_func_end GameCubeMultiBoot_ExecuteProgram
-
- thumb_func_start GameCubeMultiBoot_Init
-@ void GameCubeMultiBoot_Init(struct GameCubeMultiBoot *mb)@
-GameCubeMultiBoot_Init: @ 81DCC60
- ldr r3, pool_InterruptRegs
-
-@ Save IME register.
- ldrh r2, [r3, OFFSET_REG_IME - 0x200]
-
-@ Disable interrupts.
- movs r1, 0
- strh r1, [r3, OFFSET_REG_IME - 0x200]
-
-@ Set the handler to the "Stop" routine.
-@ Unless the first command that is received is a device reset command, the
-@ "Stop" routine will be executed and no further commands will be processed.
- adr r3, GcMbIntrHandler_Stop
- str r3, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER]
-
- ldrb r3, [r0, 0x3]
- push {r3}
- ldrb r3, [r0, 0x1]
- push {r0,r3}
-
- adds r3, r0, 0
- adds r3, GCMB_STRUCT_BASE_DEST_PTR
-
-@ clear all but the last 3 fields of the struct
-GameCubeMultiBoot_Init_ClearStructLoop:
- stm r0!, {r1}
- cmp r0, r3
- blo GameCubeMultiBoot_Init_ClearStructLoop
-
- pop {r0,r3}
- lsrs r3, 1
- strb r3, [r0, 0x3]
- pop {r3}
- strb r3, [r0, 0x1]
-
- ldr r3, pool_SerialRegs
-
-@ Turn off JOY Bus mode.
- lsls r0, r3, 10
- strh r0, [r3, OFFSET_REG_RCNT - 0x120]
-
-@ Turn on JOY Bus mode.
- movs r0, 0xC0
- lsls r0, 8
- strh r0, [r3, OFFSET_REG_RCNT - 0x120]
-
-@ Init JOY Bus registers.
- movs r0, 0x47
- strh r0, [r3, OFFSET_REG_JOYCNT - 0x120]
- strh r1, [r3, OFFSET_REG_JOYSTAT - 0x120]
-
- ldr r3, pool_InterruptRegs
-
-@ Acknowledge serial interrupt.
- movs r0, INTR_FLAG_SERIAL
- strh r0, [r3, OFFSET_REG_IF - 0x200]
-
-@ Enable serial interrupt.
- ldrh r1, [r3, OFFSET_REG_IE - 0x200]
- orrs r1, r0
- strh r1, [r3, OFFSET_REG_IE - 0x200]
-
-@ Restore IME register.
- strh r2, [r3, OFFSET_REG_IME - 0x200]
-
- bx lr
- thumb_func_end GameCubeMultiBoot_Init
-
- non_word_aligned_thumb_func_start GameCubeMultiBoot_HandleSerialInterrupt
-@ void GameCubeMultiBoot_HandleSerialInterrupt(struct GameCubeMultiBoot *mb)@
-GameCubeMultiBoot_HandleSerialInterrupt: @ 81DCCAA
- ldr r3, pool_SerialRegs
-
-@ Acknowledge reset/receive/send flags.
- ldrh r1, [r3, OFFSET_REG_JOYCNT - 0x120]
- strh r1, [r3, OFFSET_REG_JOYCNT - 0x120]
-
- movs r2, 0
- strb r2, [r0]
-
- ldr r2, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER]
- cmp r2, 0
- beq GameCubeMultiBoot_HandleSerialInterruptDone
-
- lsrs r1, 1 @ was a device reset command received?
- bcs GameCubeMultiBoot_BeginHandshake @ branch if so
-
- mov pc, r2
-
- .align 2, 0
-
-@ Zero the status and the interrupt handler pointer.
-@ Commands from the GameCube will not be processed after this is executed
-@ unless GameCubeMultiBoot_Init() is called again.
-GcMbIntrHandler_Stop:
- movs r2, 0
- strh r2, [r3, OFFSET_REG_JOYSTAT - 0x120]
-
-GameCubeMultiBoot_SetInterruptHandler:
- str r2, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER]
-
-GameCubeMultiBoot_ReadVCount:
- ldr r3, pool_RegDispstat
- ldrh r1, [r3, OFFSET_REG_VCOUNT - OFFSET_REG_DISPSTAT]
- strb r1, [r0, 0x3]
-
-GameCubeMultiBoot_HandleSerialInterruptDone:
- bx lr
-
-GameCubeMultiBoot_BeginHandshake:
- @ Throw away anything that got sent
- ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
- @ Send the game code, the other side of the link must send back the same game code
- ldr r1, pool_RubyUSAGameCode
- str r1, [r3, OFFSET_REG_JOY_TRANS - 0x120]
- movs r1, 0x10
- strh r1, [r3, OFFSET_REG_JOYSTAT - 0x120]
- @ Use the saved VCount value to provide 8 bits of entropy for KeyB
- ldrb r1, [r0, GCMB_STRUCT_SAVEDVCOUNT]
- strb r1, [r0, GCMB_STRUCT_KEYB + 1]
- @ If a multiboot image has been transferred at least enough such that the Nintendo logo check has passed, stop everything.
- ldrb r1, [r0, GCMB_STRUCT_MBPROGRESS]
- cmp r1, 0
- bne GcMbIntrHandler_Stop
- @ Set the image destination pointers.
- ldr r1, pool_MultiBootLoadAddr
- str r1, [r0, GCMB_STRUCT_BASE_DEST_PTR]
- str r1, [r0, GCMB_STRUCT_CUR_DEST_PTR]
- @ Set the new interrupt handler.
- adr r2, GcMbIntrHandler_CheckGameCodeSent
- b GameCubeMultiBoot_SetInterruptHandler
-
- .align 2, 0
-
-GcMbIntrHandler_CheckGameCodeSent: @ 81DCCEC
- lsls r1, 31
- bcc GcMbIntrHandler_Stop @ stop if send failed
- bmi GameCubeMultiBoot_CheckHandshakeResponse @ branch if receive is complete
-
-@ If the response hasn't been fully received yet,
-@ check again upon the next interrupt.
- adr r2, GcMbIntrHandler_CheckHandshakeResponse
- b GameCubeMultiBoot_SetInterruptHandler
-
- .align 2, 0
-
-GcMbIntrHandler_CheckHandshakeResponse: @ 81DCCF8
- lsrs r1, 1 @ is receive complete?
- bcc GcMbIntrHandler_Stop @ stop if not
-
-GameCubeMultiBoot_CheckHandshakeResponse:
- ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
- ldr r2, pool_RubyUSAGameCode
- cmp r1, r2
- bne GcMbIntrHandler_Stop @ stop if the GameCube didn't reply with the same game code
- @ Use the saved VCount value to provide another 8 bits of entropy for KeyB.
- ldrb r1, [r0, GCMB_STRUCT_SAVEDVCOUNT]
- strb r1, [r0, GCMB_STRUCT_KEYB + 3]
- adr r2, GcMbIntrHandler_ReceiveKeyA
- b GameCubeMultiBoot_SetInterruptHandler
-
- .align 2, 0
-
-GcMbIntrHandler_ReceiveKeyA: @ 81DCD0C
- lsrs r1, 1 @ is receive complete?
- bcc GcMbIntrHandler_Stop @ branch if not
- ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
- @ make sure top 8 bits of the received value is the KeyA magic number, stop if KeyA is invalid
- lsrs r2, r1, 24
- cmp r2, GCMB_MAGIC_KEYA
- bne GcMbIntrHandler_Stop
- @ save received KeyA
- str r1, [r0, GCMB_STRUCT_KEYA]
- @ use the second GameCubeMultiBoot_Main() counter as another 8 bits of entropy for KeyB
- ldrb r1, [r0, GCMB_STRUCT_COUNTER2]
- strb r1, [r0, GCMB_STRUCT_KEYB + 2]
- movs r2, 0
- movs r3, 0
- ldr r1, [r0, GCMB_STRUCT_KEYB]
- lsrs r1, 8
- @ make sure KeyB is valid (other side of the link is supposed to check KeyB too), if it's not then change the byte that was just set so it is
-GameCubeMultiBoot_KeyBCheckLoop:
- lsrs r1, 1
- adcs r2, r3
- cmp r1, 0
- bne GameCubeMultiBoot_KeyBCheckLoop
- cmp r2, 0xE
- bgt GameCubeMultiBoot_KeyBSaveNewByte
- cmp r2, 0x7
- bge GameCubeMultiBoot_KeyBCheckEnd
- movs r1, 0xFF
-GameCubeMultiBoot_KeyBSaveNewByte:
- strb r1, [r0, GCMB_STRUCT_KEYB + 2]
-GameCubeMultiBoot_KeyBCheckEnd:
- @ add in the KeyB magic number and send off KeyB
- ldr r1, [r0, GCMB_STRUCT_KEYB]
- adds r1, GCMB_MAGIC_KEYB
- ldr r3, pool_SerialRegs
- str r1, [r3, OFFSET_REG_JOY_TRANS - 0x120]
- movs r1, 0x30
- strh r1, [r3, OFFSET_REG_JOYSTAT - 0x120]
- @ set new interrupt handler
- adr r2, GcMbIntrHandler_CheckKeyBSent
- b GameCubeMultiBoot_SetInterruptHandler
-
- .align 2, 0
-
-GcMbIntrHandler_CheckKeyBSent: @ 81DCD4C
- lsls r1, 31
- bcc GcMbIntrHandler_Stop @ stop if send failed
- bmi GameCubeMultiBoot_CheckImageSizeResponse @ branch if receive is complete
- adr r2, GcMbIntrHandler_CheckImageSizeResponse
- b GameCubeMultiBoot_SetInterruptHandler
-
- .align 2, 0
-
-GcMbIntrHandler_CheckImageSizeResponse: @ 81DCD58
- lsrs r1, 1 @ is receive complete?
- bcc GcMbIntrHandler_Stop @ branch if not
-GameCubeMultiBoot_CheckImageSizeResponse:
- ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
- ldr r2, GameCubeMultiBoot_MaximumImageSizeUInt32s
- cmp r1, r2
- bhs GcMbIntrHandler_Stop
- adds r1, 0x1
- adds r1, r1
- strh r1, [r0, GCMB_STRUCT_IMAGE_SIZE]
- ldrb r1, [r0, GCMB_STRUCT_MBPROGRESS]
- cmp r1, 0
-GcMbIntrHandler_StopIfNotEqual:
- bne GcMbIntrHandler_Stop
- ldr r1, pool_MultiBootLoadAddr
- str r1, [r0, GCMB_STRUCT_BASE_DEST_PTR]
- str r1, [r0, GCMB_STRUCT_CUR_DEST_PTR]
- adr r2, GcMbIntrHandler_CheckImageResponse
- b GameCubeMultiBoot_SetInterruptHandler
-
- .align 2, 0
-
-GcMbIntrHandler_CheckImageResponse: @ 81DCD7C
- lsrs r1, 1 @ is receive complete?
- bcc GcMbIntrHandler_Stop @ branch if not
- ldr r2, [r0, GCMB_STRUCT_CUR_DEST_PTR]
- movs r1, 0x4
- ands r1, r2
- adds r1, 0x8
- lsls r1, 2
- strh r1, [r3, OFFSET_REG_JOYSTAT - 0x120]
- @ get the recieved uint32
- ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
- @ put it in the current destination pointer and advance that pointer
- stm r2!, {r1}
- @ save off the advanced pointer
- str r2, [r0, GCMB_STRUCT_CUR_DEST_PTR]
- @ decrease the image size (in uint32s)
- ldrh r1, [r0, GCMB_STRUCT_IMAGE_SIZE]
- subs r1, 0x1
- strh r1, [r0, GCMB_STRUCT_IMAGE_SIZE]
- @ branch away if the transfer is not yet complete
- bne GameCubeMultiBoot_ReadVCount
-
-GcMbIntrHandler_SendCounter2:
- @ send counter2 with magic number
- ldrb r1, [r0, GCMB_STRUCT_COUNTER2]
- lsls r1, 8
- adds r1, GCMB_MAGIC_COUNTER2
- str r1, [r3, OFFSET_REG_JOY_TRANS - 0x120]
- adr r2, GcMbIntrHandler_CheckCounter2Sent
- b GameCubeMultiBoot_SetInterruptHandler
-
- .align 2, 0
-
-GcMbIntrHandler_CheckCounter2Sent:
- lsls r1, 31
-
-GcMbIntrHandler_StopIfSendFailed:
- bcc GcMbIntrHandler_Stop @ stop if send failed
- @ if KeyC derivation value has not yet been generated, send Counter2 again, otherwise, send KeyC derivation
- ldr r1, [r0, GCMB_STRUCT_KEYC_DERIVATION]
- cmp r1, 0
- beq GcMbIntrHandler_SendCounter2
- str r1, [r3, OFFSET_REG_JOY_TRANS - 0x120]
- adr r2, GcMbIntrHandler_CheckKeyCDerivationSent
- b GameCubeMultiBoot_SetInterruptHandler
-
- .align 2, 0
-
-GcMbIntrHandler_CheckKeyCDerivationSent: @ 81DCDB8
- lsls r1, 31
- bcc GcMbIntrHandler_StopIfSendFailed @ branch if send failed
- bmi GameCubeMultiBoot_CheckBootKeyResponse @ branch if receive is complete
- adr r2, GcMbIntrHandler_CheckBootKeyResponse
- b GameCubeMultiBoot_SetInterruptHandler
-
- .align 2, 0
-
-GcMbIntrHandler_CheckBootKeyResponse: @ 81DCDC4
- lsrs r1, 1 @ is receive complete?
- bcc GcMbIntrHandler_StopIfSendFailed @ branch if not
-
-GameCubeMultiBoot_CheckBootKeyResponse:
- ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
- @ make sure received boot key contains expected magic number, stop if not
- lsrs r2, r1, 24
- cmp r2, GCMB_MAGIC_BOOTKEY
- bne GcMbIntrHandler_StopIfNotEqual
- @ save received bootkey to be checked in GameCubeMultiBoot_Main()
- strh r1, [r0, GCMB_STRUCT_BOOT_KEY]
- @ stop if anything more gets sent
- adr r2, GcMbIntrHandler_StopUnconditionally
- b GameCubeMultiBoot_SetInterruptHandler
-
- .align 2, 0
-
-GcMbIntrHandler_StopUnconditionally: @ 81DCDD8
- b GcMbIntrHandler_Stop
-
- thumb_func_end GameCubeMultiBoot_HandleSerialInterrupt
-
- non_word_aligned_thumb_func_start GameCubeMultiBoot_Quit
-@ void GameCubeMultiBoot_Quit()@
-GameCubeMultiBoot_Quit: @ 81DCDDA
- ldr r3, pool_InterruptRegs
-
-@ Save IME register.
- ldrh r2, [r3, OFFSET_REG_IME - 0x200]
-
-@ Disable interrupts.
- movs r1, 0
- strh r1, [r3, OFFSET_REG_IME - 0x200]
-
- ldr r3, pool_SerialRegs
-
-@ Acknowledge all JOYCNT flags.
- movs r0, 0x7
- strh r0, [r3, OFFSET_REG_JOYCNT - 0x120]
-
-@ Turn off JOY Bus mode.
- lsls r0, r3, 10
- strh r0, [r3, OFFSET_REG_RCNT - 0x120] @ store 0x8000
-
- ldr r3, pool_InterruptRegs
-
-@ Acknowledge serial interrupt.
- movs r0, INTR_FLAG_SERIAL
- strh r0, [r3, OFFSET_REG_IF - 0x200]
-
-@ Disable serial interrupt.
- ldrh r1, [r3, OFFSET_REG_IE - 0x200]
- bics r1, r0
- strh r1, [r3, OFFSET_REG_IE - 0x200]
-
-@ Restore IME register.
- strh r2, [r3, OFFSET_REG_IME - 0x200]
-
- bx lr
- thumb_func_end GameCubeMultiBoot_Quit
-
- .align 2, 0
-
-GameCubeMultiBoot_MaximumImageSizeUInt32s: .4byte 0x00004000
-
-pool_InterruptRegs: .4byte REG_BASE + 0x200
-
-pool_SerialRegs: .4byte REG_BASE + 0x120
-
-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/m4a_1.s b/asm/m4a_1.s
deleted file mode 100644
index 849cf5c2d..000000000
--- a/asm/m4a_1.s
+++ /dev/null
@@ -1,1911 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/gba_constants.inc"
- .include "constants/m4a_constants.inc"
-
- .syntax unified
-
- .lcomm gUnknown_030007B8, 0x770
-
- .text
-
- thumb_func_start umul3232H32
-umul3232H32:
- adr r2, __umul3232H32
- bx r2
- .arm
-__umul3232H32:
- umull r2, r3, r0, r1
- add r0, r3, 0
- bx lr
- thumb_func_end umul3232H32
-
- thumb_func_start SoundMain
-SoundMain:
- ldr r0, lt_SOUND_INFO_PTR
- ldr r0, [r0]
- ldr r2, lt_ID_NUMBER
- ldr r3, [r0, o_SoundInfo_ident]
- cmp r2, r3
- beq SoundMain_1
- bx lr @ Exit the function if ident doesn't match ID_NUMBER.
-SoundMain_1:
- adds r3, 1
- str r3, [r0, o_SoundInfo_ident]
- push {r4-r7,lr}
- mov r1, r8
- mov r2, r9
- mov r3, r10
- mov r4, r11
- push {r0-r4}
- sub sp, 0x18
- ldrb r1, [r0, o_SoundInfo_maxLines]
- cmp r1, 0 @ if maxLines is 0, there is no maximum
- beq SoundMain_3
- ldr r2, lt_REG_VCOUNT
- ldrb r2, [r2]
- cmp r2, VCOUNT_VBLANK
- bhs SoundMain_2
- adds r2, TOTAL_SCANLINES
-SoundMain_2:
- adds r1, r2
-SoundMain_3:
- str r1, [sp, 0x14]
- ldr r3, [r0, o_SoundInfo_func]
- cmp r3, 0
- beq SoundMain_4
- ldr r0, [r0, o_SoundInfo_intp]
- bl _081DD25E
- ldr r0, [sp, 0x18]
-SoundMain_4:
- ldr r3, [r0, o_SoundInfo_CgbSound]
- bl _081DD25E
- ldr r0, [sp, 0x18]
- ldr r3, [r0, o_SoundInfo_pcmSamplesPerVBlank]
- mov r8, r3
- ldr r5, lt_o_SoundInfo_pcmBuffer
- adds r5, r0
- ldrb r4, [r0, o_SoundInfo_pcmDmaCounter]
- subs r7, r4, 1
- bls SoundMain_5
- ldrb r1, [r0, o_SoundInfo_pcmDmaPeriod]
- subs r1, r7
- mov r2, r8
- muls r2, r1
- adds r5, r2
-SoundMain_5:
- str r5, [sp, 0x8]
- ldr r6, lt_PCM_DMA_BUF_SIZE
- ldr r3, lt_SoundMainRAM_Buffer
- bx r3
-
- .align 2, 0
-lt_SOUND_INFO_PTR: .word SOUND_INFO_PTR
-lt_ID_NUMBER: .word ID_NUMBER
-lt_SoundMainRAM_Buffer: .word SoundMainRAM_Buffer + 1
-lt_REG_VCOUNT: .word REG_VCOUNT
-lt_o_SoundInfo_pcmBuffer: .word o_SoundInfo_pcmBuffer
-lt_PCM_DMA_BUF_SIZE: .word PCM_DMA_BUF_SIZE
- thumb_func_end SoundMain
-
- thumb_func_start SoundMainRAM
-SoundMainRAM:
- ldrb r3, [r0, o_SoundInfo_reverb]
- cmp r3, 0
- beq SoundMainRAM_NoReverb
- adr r1, SoundMainRAM_Reverb
- bx r1
- .arm
-SoundMainRAM_Reverb:
- cmp r4, 0x2
- addeq r7, r0, o_SoundInfo_pcmBuffer
- addne r7, r5, r8
- mov r4, r8
-_081DCEC4:
- ldrsb r0, [r5, r6]
- ldrsb r1, [r5]
- add r0, r0, r1
- ldrsb r1, [r7, r6]
- add r0, r0, r1
- ldrsb r1, [r7], 0x1
- add r0, r0, r1
- mul r1, r0, r3
- mov r0, r1, asr 9
- tst r0, 0x80
- addne r0, r0, 0x1
- strb r0, [r5, r6]
- strb r0, [r5], 0x1
- subs r4, r4, 0x1
- bgt _081DCEC4
- adr r0, _081DCF36 + 1 @ plus 1 because THUMB
- bx r0
- .thumb
-SoundMainRAM_NoReverb:
- movs r0, 0
- mov r1, r8
- adds r6, r5
- lsrs r1, 3
- bcc SoundMainRAM_NoReverb_Ok
- stm r5!, {r0}
- stm r6!, {r0}
-SoundMainRAM_NoReverb_Ok:
- lsrs r1, 1
- bcc SoundMainRAM_NoReverb_Loop
- stm r5!, {r0}
- stm r6!, {r0}
- stm r5!, {r0}
- stm r6!, {r0}
-SoundMainRAM_NoReverb_Loop:
- stm r5!, {r0}
- stm r6!, {r0}
- stm r5!, {r0}
- stm r6!, {r0}
- stm r5!, {r0}
- stm r6!, {r0}
- stm r5!, {r0}
- stm r6!, {r0}
- subs r1, 1
- bgt SoundMainRAM_NoReverb_Loop
-_081DCF36:
- ldr r4, [sp, 0x18]
- ldr r0, [r4, o_SoundInfo_divFreq]
- mov r12, r0
- ldrb r0, [r4, o_SoundInfo_maxChans]
- adds r4, o_SoundInfo_chans
-
-SoundMainRAM_ChanLoop:
- str r0, [sp, 0x4]
- ldr r3, [r4, o_SoundChannel_wav]
- ldr r0, [sp, 0x14]
- cmp r0, 0
- beq _081DCF60
- ldr r1, =REG_VCOUNT
- ldrb r1, [r1]
- cmp r1, VCOUNT_VBLANK
- bhs _081DCF54
- adds r1, TOTAL_SCANLINES
-_081DCF54:
- cmp r1, r0
- blo _081DCF60
- b _081DD24A
-
- .pool
-
-_081DCF60:
- ldrb r6, [r4, o_SoundChannel_status]
- movs r0, 0xC7
- tst r0, r6
- bne _081DCF6A
- b _081DD240
-_081DCF6A:
- movs r0, 0x80
- tst r0, r6
- beq _081DCFA0
- movs r0, 0x40
- tst r0, r6
- bne _081DCFB0
- movs r6, 0x3
- strb r6, [r4, o_SoundChannel_status]
- adds r0, r3, 0
- adds r0, 0x10
- ldr r1, [r4, o_SoundChannel_ct]
- adds r0, r1
- str r0, [r4, o_SoundChannel_cp]
- ldr r0, [r3, 0xC]
- subs r0, r1
- str r0, [r4, o_SoundChannel_ct]
- movs r5, 0
- strb r5, [r4, o_SoundChannel_ev]
- str r5, [r4, o_SoundChannel_fw]
- ldrb r2, [r3, 0x3]
- movs r0, 0xC0
- tst r0, r2
- beq _081DCFF8
- movs r0, 0x10
- orrs r6, r0
- strb r6, [r4, o_SoundChannel_status]
- b _081DCFF8
-_081DCFA0:
- ldrb r5, [r4, o_SoundChannel_ev]
- movs r0, 0x4
- tst r0, r6
- beq _081DCFB6
- ldrb r0, [r4, o_SoundChannel_iel]
- subs r0, 1
- strb r0, [r4, o_SoundChannel_iel]
- bhi _081DD006
-_081DCFB0:
- movs r0, 0
- strb r0, [r4, o_SoundChannel_status]
- b _081DD240
-_081DCFB6:
- movs r0, 0x40
- tst r0, r6
- beq _081DCFD6
- ldrb r0, [r4, o_SoundChannel_release]
- muls r5, r0
- lsrs r5, 8
- ldrb r0, [r4, o_SoundChannel_iev]
- cmp r5, r0
- bhi _081DD006
-_081DCFC8:
- ldrb r5, [r4, o_SoundChannel_iev]
- cmp r5, 0
- beq _081DCFB0
- movs r0, 0x4
- orrs r6, r0
- strb r6, [r4, o_SoundChannel_status]
- b _081DD006
-_081DCFD6:
- movs r2, 0x3
- ands r2, r6
- cmp r2, 0x2
- bne _081DCFF4
- ldrb r0, [r4, o_SoundChannel_decay]
- muls r5, r0
- lsrs r5, 8
- ldrb r0, [r4, o_SoundChannel_sustain]
- cmp r5, r0
- bhi _081DD006
- adds r5, r0, 0
- beq _081DCFC8
- subs r6, 0x1
- strb r6, [r4, o_SoundChannel_status]
- b _081DD006
-_081DCFF4:
- cmp r2, 0x3
- bne _081DD006
-_081DCFF8:
- ldrb r0, [r4, o_SoundChannel_attack]
- adds r5, r0
- cmp r5, 0xFF
- bcc _081DD006
- movs r5, 0xFF
- subs r6, 0x1
- strb r6, [r4, o_SoundChannel_status]
-_081DD006:
- strb r5, [r4, o_SoundChannel_ev]
- ldr r0, [sp, 0x18]
- ldrb r0, [r0, o_SoundChannel_release]
- adds r0, 0x1
- muls r0, r5
- lsrs r5, r0, 4
- ldrb r0, [r4, o_SoundChannel_rightVolume]
- muls r0, r5
- lsrs r0, 8
- strb r0, [r4, o_SoundChannel_er]
- ldrb r0, [r4, o_SoundChannel_leftVolume]
- muls r0, r5
- lsrs r0, 8
- strb r0, [r4, o_SoundChannel_el]
- movs r0, 0x10
- ands r0, r6
- str r0, [sp, 0x10]
- beq _081DD03A
- adds r0, r3, 0
- adds r0, 0x10
- ldr r1, [r3, 0x8]
- adds r0, r1
- str r0, [sp, 0xC]
- ldr r0, [r3, 0xC]
- subs r0, r1
- str r0, [sp, 0x10]
-_081DD03A:
- ldr r5, [sp, 0x8]
- ldr r2, [r4, o_SoundChannel_ct]
- ldr r3, [r4, o_SoundChannel_cp]
- adr r0, _081DD044
- bx r0
- .arm
-_081DD044:
- str r8, [sp]
- ldr r9, [r4, o_SoundChannel_fw]
- ldrb r10, [r4, o_SoundChannel_er]
- ldrb r11, [r4, o_SoundChannel_el]
- ldrb r0, [r4, o_SoundChannel_type]
- tst r0, 0x30
- beq _081DD068
- bl sub_81DD264
- b _081DD228
-_081DD068:
- mov r10, r10, lsl 16
- mov r11, r11, lsl 16
- ldrb r0, [r4, o_SoundChannel_type]
- tst r0, 0x8
- beq _081DD19C
-_081DD07C:
- cmp r2, 0x4
- ble _081DD0EC
- subs r2, r2, r8
- movgt r9, 0
- bgt _081DD0A8
- mov r9, r8
- add r2, r2, r8
- sub r8, r2, 0x4
- sub r9, r9, r8
- ands r2, r2, 0x3
- moveq r2, 0x4
-_081DD0A8:
- ldr r6, [r5]
- ldr r7, [r5, 0x630]
-_081DD0B0:
- ldrsb r0, [r3], 0x1
- mul r1, r10, r0
- bic r1, r1, 0xFF0000
- add r6, r1, r6, ror 8
- mul r1, r11, r0
- bic r1, r1, 0xFF0000
- add r7, r1, r7, ror 8
- adds r5, r5, 0x40000000
- bcc _081DD0B0
- str r7, [r5, 0x630]
- str r6, [r5], 0x4
- subs r8, r8, 0x4
- bgt _081DD0A8
- adds r8, r8, r9
- beq _081DD22C
-_081DD0EC:
- ldr r6, [r5]
- ldr r7, [r5, 0x630]
-_081DD0F4:
- ldrsb r0, [r3], 0x1
- mul r1, r10, r0
- bic r1, r1, 0xFF0000
- add r6, r1, r6, ror 8
- mul r1, r11, r0
- bic r1, r1, 0xFF0000
- add r7, r1, r7, ror 8
- subs r2, r2, 0x1
- beq _081DD164
-_081DD118:
- adds r5, r5, 0x40000000
- bcc _081DD0F4
- str r7, [r5, 0x630]
- str r6, [r5], 0x4
- subs r8, r8, 0x4
- bgt _081DD07C
- b _081DD22C
-_081DD134:
- ldr r0, [sp, 0x18]
- cmp r0, 0
- beq _081DD158
- ldr r3, [sp, 0x14]
- rsb lr, r2, 0
-_081DD148:
- adds r2, r0, r2
- bgt _081DD1FC
- sub lr, lr, r0
- b _081DD148
-_081DD158:
- pop {r4,r12}
- mov r2, 0
- b _081DD174
-_081DD164:
- ldr r2, [sp, 0x10]
- cmp r2, 0
- ldrne r3, [sp, 0xC]
- bne _081DD118
-_081DD174:
- strb r2, [r4, o_SoundChannel_status]
- mov r0, r5, lsr 30
- bic r5, r5, 0xC0000000
- rsb r0, r0, 0x3
- mov r0, r0, lsl 3
- mov r6, r6, ror r0
- mov r7, r7, ror r0
- str r7, [r5, 0x630]
- str r6, [r5], 0x4
- b _081DD234
-_081DD19C:
- push {r4,r12}
- ldr r1, [r4, o_SoundChannel_freq]
- mul r4, r12, r1
- ldrsb r0, [r3]
- ldrsb r1, [r3, 0x1]!
- sub r1, r1, r0
-_081DD1B4:
- ldr r6, [r5]
- ldr r7, [r5, 0x630]
-_081DD1BC:
- mul lr, r9, r1
- add lr, r0, lr, asr 23
- mul r12, r10, lr
- bic r12, r12, 0xFF0000
- add r6, r12, r6, ror 8
- mul r12, r11, lr
- bic r12, r12, 0xFF0000
- add r7, r12, r7, ror 8
- add r9, r9, r4
- movs lr, r9, lsr 23
- beq _081DD208
- bic r9, r9, 0x3F800000
- subs r2, r2, lr
- ble _081DD134
- subs lr, lr, 0x1
- addeq r0, r0, r1
-_081DD1FC:
- ldrsbne r0, [r3, lr]!
- ldrsb r1, [r3, 0x1]!
- sub r1, r1, r0
-_081DD208:
- adds r5, r5, 0x40000000
- bcc _081DD1BC
- str r7, [r5, 0x630]
- str r6, [r5], 0x4
- subs r8, r8, 0x4
- bgt _081DD1B4
- sub r3, r3, 0x1
- pop {r4,r12}
-_081DD228:
- str r9, [r4, o_SoundChannel_fw]
-_081DD22C:
- str r2, [r4, o_SoundChannel_ct]
- str r3, [r4, o_SoundChannel_cp]
-_081DD234:
- ldr r8, [sp]
- add r0, pc, 0x1
- bx r0
- .thumb
-_081DD240:
- ldr r0, [sp, 0x4]
- subs r0, 1
- ble _081DD24A
- adds r4, SoundChannel_size
- b SoundMainRAM_ChanLoop
-_081DD24A:
- ldr r0, [sp, 0x18]
- ldr r3, =ID_NUMBER
- str r3, [r0]
- add sp, 0x1C
- pop {r0-r7}
- mov r8, r0
- mov r9, r1
- mov r10, r2
- mov r11, r3
- pop {r3}
-_081DD25E:
- bx r3
- .pool
- thumb_func_end SoundMainRAM
-
- arm_func_start sub_81DD264
-sub_81DD264:
- ldr r6, [r4, o_SoundChannel_wav]
- ldrb r0, [r4, o_SoundChannel_status]
- tst r0, 0x20
- bne _081DD2B4
- orr r0, r0, 0x20
- strb r0, [r4, o_SoundChannel_status]
- ldrb r0, [r4, o_SoundChannel_type]
- tst r0, 0x10
- beq _081DD29C
- ldr r1, [r6, 0xC]
- add r1, r1, r6, lsl 1
- add r1, r1, 0x20
- sub r3, r1, r3
- str r3, [r4, o_SoundChannel_cp]
-_081DD29C:
- ldrh r0, [r6]
- cmp r0, 0
- beq _081DD2B4
- sub r3, r3, r6
- sub r3, r3, 0x10
- str r3, [r4, o_SoundChannel_cp]
-_081DD2B4:
- push {r8,r12,lr}
- mov r10, r10, lsl 16
- mov r11, r11, lsl 16
- ldr r1, [r4, o_SoundChannel_freq]
- ldrb r0, [r4, o_SoundChannel_type]
- tst r0, 0x8
- movne r8, 0x800000
- muleq r8, r12, r1
- ldrh r0, [r6]
- cmp r0, 0
- beq _081DD468
- mov r0, 0xFF000000
- str r0, [r4, o_SoundChannel_xpi]
- ldrb r0, [r4, o_SoundChannel_type]
- tst r0, 0x10
- bne _081DD3C0
- bl sub_81DD520
- mov r0, r1
- add r3, r3, 0x1
- bl sub_81DD520
- sub r1, r1, r0
-_081DD308:
- ldr r6, [r5]
- ldr r7, [r5, 0x630]
-_081DD310:
- mul lr, r9, r1
- add lr, r0, lr, asr 23
- mul r12, r10, lr
- bic r12, r12, 0xFF0000
- add r6, r12, r6, ror 8
- mul r12, r11, lr
- bic r12, r12, 0xFF0000
- add r7, r12, r7, ror 8
- add r9, r9, r8
- movs lr, r9, lsr 23
- beq _081DD370
- bic r9, r9, 0x3F800000
- subs r2, r2, lr
- ble _081DD398
- subs lr, lr, 0x1
- bne _081DD358
- add r0, r0, r1
- b _081DD364
-_081DD358:
- add r3, r3, lr
- bl sub_81DD520
- mov r0, r1
-_081DD364:
- add r3, r3, 0x1
- bl sub_81DD520
- sub r1, r1, r0
-_081DD370:
- adds r5, r5, 0x40000000
- bcc _081DD310
- str r7, [r5, 0x630]
- str r6, [r5], 0x4
- ldr r6, [sp]
- subs r6, r6, 0x4
- str r6, [sp]
- bgt _081DD308
- sub r3, r3, 0x1
- b _081DD4F0
-_081DD398:
- ldr r0, [sp, 0x1C]
- cmp r0, 0
- beq _081DD4F4
- ldr r3, [r4, o_SoundChannel_wav]
- ldr r3, [r3, 0x8]
- rsb lr, r2, 0
-_081DD3B0:
- adds r2, r2, r0
- bgt _081DD358
- sub lr, lr, r0
- b _081DD3B0
-_081DD3C0:
- sub r3, r3, 0x1
- bl sub_81DD520
- mov r0, r1
- sub r3, r3, 0x1
- bl sub_81DD520
- sub r1, r1, r0
-_081DD3D8:
- ldr r6, [r5]
- ldr r7, [r5, 0x630]
-_081DD3E0:
- mul lr, r9, r1
- add lr, r0, lr, asr 23
- mul r12, r10, lr
- bic r12, r12, 0xFF0000
- add r6, r12, r6, ror 8
- mul r12, r11, lr
- bic r12, r12, 0xFF0000
- add r7, r12, r7, ror 8
- add r9, r9, r8
- movs lr, r9, lsr 23
- beq _081DD440
- bic r9, r9, 0x3F800000
- subs r2, r2, lr
- ble _081DD4F4
- subs lr, lr, 0x1
- bne _081DD428
- add r0, r0, r1
- b _081DD434
-_081DD428:
- sub r3, r3, lr
- bl sub_81DD520
- mov r0, r1
-_081DD434:
- sub r3, r3, 0x1
- bl sub_81DD520
- sub r1, r1, r0
-_081DD440:
- adds r5, r5, 0x40000000
- bcc _081DD3E0
- str r7, [r5, 0x630]
- str r6, [r5], 0x4
- ldr r6, [sp]
- subs r6, r6, 0x4
- str r6, [sp]
- bgt _081DD3D8
- add r3, r3, 0x2
- b _081DD4F0
-_081DD468:
- ldrb r0, [r4, o_SoundChannel_type]
- tst r0, 0x10
- beq _081DD4F0
- ldrsb r0, [r3, -0x1]!
- ldrsb r1, [r3, -0x1]
- sub r1, r1, r0
-_081DD480:
- ldr r6, [r5]
- ldr r7, [r5, 0x630]
-_081DD488:
- mul lr, r9, r1
- add lr, r0, lr, asr 23
- mul r12, r10, lr
- bic r12, r12, 0xFF0000
- add r6, r12, r6, ror 8
- mul r12, r11, lr
- bic r12, r12, 0xFF0000
- add r7, r12, r7, ror 8
- add r9, r9, r8
- movs lr, r9, lsr 23
- beq _081DD4CC
- bic r9, r9, 0x3F800000
- subs r2, r2, lr
- ble _081DD4F4
- ldrsb r0, [r3, -lr]!
- ldrsb r1, [r3, -0x1]
- sub r1, r1, r0
-_081DD4CC:
- adds r5, r5, 0x40000000
- bcc _081DD488
- str r7, [r5, 0x630]
- str r6, [r5], 0x4
- ldr r6, [sp]
- subs r6, r6, 0x4
- str r6, [sp]
- bgt _081DD480
- add r3, r3, 0x1
-_081DD4F0:
- pop {r8,r12,pc}
-_081DD4F4:
- mov r2, 0
- strb r2, [r4, o_SoundChannel_status]
- mov r0, r5, lsr 30
- bic r5, r5, 0xC0000000
- rsb r0, r0, 0x3
- mov r0, r0, lsl 3
- mov r6, r6, ror r0
- mov r7, r7, ror r0
- str r7, [r5, 0x630]
- str r6, [r5], 0x4
- pop {r8,r12,pc}
- arm_func_end sub_81DD264
-
- arm_func_start sub_81DD520
-sub_81DD520:
- push {r0,r2,r5-r7,lr}
- mov r0, r3, lsr 6
- ldr r1, [r4, o_SoundChannel_xpi]
- cmp r0, r1
- beq _081DD594
- str r0, [r4, o_SoundChannel_xpi]
- mov r1, 0x21
- mul r2, r1, r0
- ldr r1, [r4, o_SoundChannel_wav]
- add r2, r2, r1
- add r2, r2, 0x10
- ldr r5, =gUnknown_030007B8
- ldr r6, =gDeltaEncodingTable
- mov r7, 0x40
- ldrb lr, [r2], 1
- strb lr, [r5], 1
- ldrb r1, [r2], 1
- b _081DD57C
-_081DD568:
- ldrb r1, [r2], 1
- mov r0, r1, lsr 4
- ldrsb r0, [r6, r0]
- add lr, lr, r0
- strb lr, [r5], 1
-_081DD57C:
- and r0, r1, 0xF
- ldrsb r0, [r6, r0]
- add lr, lr, r0
- strb lr, [r5], 1
- subs r7, r7, 2
- bgt _081DD568
-_081DD594:
- ldr r5, =gUnknown_030007B8
- and r0, r3, 0x3F
- ldrsb r1, [r5, r0]
- pop {r0,r2,r5-r7,pc}
- .pool
- arm_func_end sub_81DD520
-
- thumb_func_start SoundMainBTM
-SoundMainBTM:
- mov r12, r4
- movs r1, 0
- movs r2, 0
- movs r3, 0
- movs r4, 0
- stm r0!, {r1-r4}
- stm r0!, {r1-r4}
- stm r0!, {r1-r4}
- stm r0!, {r1-r4}
- mov r4, r12
- bx lr
- thumb_func_end SoundMainBTM
-
- thumb_func_start RealClearChain
-RealClearChain:
- ldr r3, [r0, 0x2C]
- cmp r3, 0
- beq _081DD5E2
- ldr r1, [r0, 0x34]
- ldr r2, [r0, 0x30]
- cmp r2, 0
- beq _081DD5D6
- str r1, [r2, 0x34]
- b _081DD5D8
-_081DD5D6:
- str r1, [r3, 0x20]
-_081DD5D8:
- cmp r1, 0
- beq _081DD5DE
- str r2, [r1, 0x30]
-_081DD5DE:
- movs r1, 0
- str r1, [r0, 0x2C]
-_081DD5E2:
- bx lr
- thumb_func_end RealClearChain
-
- thumb_func_start ply_fine
-ply_fine:
- push {r4,r5,lr}
- adds r5, r1, 0
- ldr r4, [r5, o_MusicPlayerTrack_chan]
- cmp r4, 0
- beq ply_fine_done
-ply_fine_loop:
- ldrb r1, [r4]
- movs r0, 0xC7
- tst r0, r1
- beq ply_fine_ok
- movs r0, 0x40
- orrs r1, r0
- strb r1, [r4]
-ply_fine_ok:
- adds r0, r4, 0
- bl RealClearChain
- ldr r4, [r4, 0x34]
- cmp r4, 0
- bne ply_fine_loop
-ply_fine_done:
- movs r0, 0
- strb r0, [r5]
- pop {r4,r5}
- pop {r0}
- bx r0
- thumb_func_end ply_fine
-
- thumb_func_start MPlayJumpTableCopy
-MPlayJumpTableCopy:
- mov r12, lr
- movs r1, 0x24
- ldr r2, lt_MPlayJumpTableTemplate
-MPlayJumpTableCopy_Loop:
- ldr r3, [r2]
- bl chk_adr_r2
- stm r0!, {r3}
- adds r2, 0x4
- subs r1, 0x1
- bgt MPlayJumpTableCopy_Loop
- bx r12
- thumb_func_end MPlayJumpTableCopy
-
- .align 2, 0
- .thumb_func
-ldrb_r3_r2:
- ldrb r3, [r2]
-
-@ This attempts to protect against reading anything from the BIOS ROM
-@ besides the jump table template.
-@ It assumes that the jump table template is located at the end of the ROM.
- .thumb_func
-chk_adr_r2:
- push {r0}
- lsrs r0, r2, 25
- bne chk_adr_r2_done @ if adr >= 0x2000000 (i.e. not in BIOS ROM), accept it
- ldr r0, lt_MPlayJumpTableTemplate
- cmp r2, r0
- blo chk_adr_r2_reject @ if adr < gMPlayJumpTableTemplate, reject it
- lsrs r0, r2, 14
- beq chk_adr_r2_done @ if adr < 0x40000 (i.e. in BIOS ROM), accept it
-chk_adr_r2_reject:
- movs r3, 0
-chk_adr_r2_done:
- pop {r0}
- bx lr
-
- .align 2, 0
-lt_MPlayJumpTableTemplate: .word gMPlayJumpTableTemplate
-
- thumb_func_start ld_r3_tp_adr_i
-ld_r3_tp_adr_i:
- ldr r2, [r1, 0x40]
-_081DD64A:
- adds r3, r2, 0x1
- str r3, [r1, 0x40]
- ldrb r3, [r2]
- b chk_adr_r2
- thumb_func_end ld_r3_tp_adr_i
-
- thumb_func_start ply_goto
-ply_goto:
- push {lr}
-ply_goto_1:
- ldr r2, [r1, o_MusicPlayerTrack_cmdPtr]
- ldrb r0, [r2, 0x3]
- lsls r0, 8
- ldrb r3, [r2, 0x2]
- orrs r0, r3
- lsls r0, 8
- ldrb r3, [r2, 0x1]
- orrs r0, r3
- lsls r0, 8
- bl ldrb_r3_r2
- orrs r0, r3
- str r0, [r1, o_MusicPlayerTrack_cmdPtr]
- pop {r0}
- bx r0
- thumb_func_end ply_goto
-
- thumb_func_start ply_patt
-ply_patt:
- ldrb r2, [r1, o_MusicPlayerTrack_patternLevel]
- cmp r2, 3
- bhs ply_patt_done
- lsls r2, 2
- adds r3, r1, r2
- ldr r2, [r1, o_MusicPlayerTrack_cmdPtr]
- adds r2, 0x4
- str r2, [r3, o_MusicPlayerTrack_patternStack]
- ldrb r2, [r1, o_MusicPlayerTrack_patternLevel]
- adds r2, 1
- strb r2, [r1, o_MusicPlayerTrack_patternLevel]
- b ply_goto
-ply_patt_done:
- b ply_fine
- thumb_func_end ply_patt
-
- thumb_func_start ply_pend
-ply_pend:
- ldrb r2, [r1, o_MusicPlayerTrack_patternLevel]
- cmp r2, 0
- beq ply_pend_done
- subs r2, 1
- strb r2, [r1, o_MusicPlayerTrack_patternLevel]
- lsls r2, 2
- adds r3, r1, r2
- ldr r2, [r3, o_MusicPlayerTrack_patternStack]
- str r2, [r1, o_MusicPlayerTrack_cmdPtr]
-ply_pend_done:
- bx lr
- thumb_func_end ply_pend
-
- thumb_func_start ply_rept
-ply_rept:
- push {lr}
- ldr r2, [r1, o_MusicPlayerTrack_cmdPtr]
- ldrb r3, [r2]
- cmp r3, 0
- bne ply_rept_1
- adds r2, 1
- str r2, [r1, o_MusicPlayerTrack_cmdPtr]
- b ply_goto_1
-ply_rept_1:
- ldrb r3, [r1, o_MusicPlayerTrack_repN]
- adds r3, 1
- strb r3, [r1, o_MusicPlayerTrack_repN]
- mov r12, r3
- bl ld_r3_tp_adr_i
- cmp r12, r3
- bhs ply_rept_2
- b ply_goto_1
-ply_rept_2:
- movs r3, 0
- strb r3, [r1, o_MusicPlayerTrack_repN]
- adds r2, 5
- str r2, [r1, o_MusicPlayerTrack_cmdPtr]
- pop {r0}
- bx r0
- thumb_func_end ply_rept
-
- thumb_func_start ply_prio
-ply_prio:
- mov r12, lr
- bl ld_r3_tp_adr_i
- strb r3, [r1, o_MusicPlayerTrack_priority]
- bx r12
- thumb_func_end ply_prio
-
- thumb_func_start ply_tempo
-ply_tempo:
- mov r12, lr
- bl ld_r3_tp_adr_i
- lsls r3, 1
- strh r3, [r0, o_MusicPlayerInfo_tempoD]
- ldrh r2, [r0, o_MusicPlayerInfo_tempoU]
- muls r3, r2
- lsrs r3, 8
- strh r3, [r0, o_MusicPlayerInfo_tempoI]
- bx r12
- thumb_func_end ply_tempo
-
- thumb_func_start ply_keysh
-ply_keysh:
- mov r12, lr
- bl ld_r3_tp_adr_i
- strb r3, [r1, o_MusicPlayerTrack_keyShift]
- ldrb r3, [r1, o_MusicPlayerTrack_flags]
- movs r2, 0xC
- orrs r3, r2
- strb r3, [r1, o_MusicPlayerTrack_flags]
- bx r12
- thumb_func_end ply_keysh
-
- thumb_func_start ply_voice
-ply_voice:
- mov r12, lr
- ldr r2, [r1, o_MusicPlayerTrack_cmdPtr]
- ldrb r3, [r2]
- adds r2, 1
- str r2, [r1, o_MusicPlayerTrack_cmdPtr]
- lsls r2, r3, 1
- adds r2, r3
- lsls r2, 2
- ldr r3, [r0, o_MusicPlayerInfo_tone]
- adds r2, r3
- ldr r3, [r2]
- bl chk_adr_r2
- str r3, [r1, o_MusicPlayerTrack_ToneData_type]
- ldr r3, [r2, 0x4]
- bl chk_adr_r2
- str r3, [r1, o_MusicPlayerTrack_ToneData_wav]
- ldr r3, [r2, 0x8]
- bl chk_adr_r2
- str r3, [r1, o_MusicPlayerTrack_ToneData_attack]
- bx r12
- thumb_func_end ply_voice
-
- thumb_func_start ply_vol
-ply_vol:
- mov r12, lr
- bl ld_r3_tp_adr_i
- strb r3, [r1, o_MusicPlayerTrack_vol]
- ldrb r3, [r1, o_MusicPlayerTrack_flags]
- movs r2, 0x3
- orrs r3, r2
- strb r3, [r1, o_MusicPlayerTrack_flags]
- bx r12
- thumb_func_end ply_vol
-
- thumb_func_start ply_pan
-ply_pan:
- mov r12, lr
- bl ld_r3_tp_adr_i
- subs r3, 0x40
- strb r3, [r1, o_MusicPlayerTrack_pan]
- ldrb r3, [r1, o_MusicPlayerTrack_flags]
- movs r2, 0x3
- orrs r3, r2
- strb r3, [r1, o_MusicPlayerTrack_flags]
- bx r12
- thumb_func_end ply_pan
-
- thumb_func_start ply_bend
-ply_bend:
- mov r12, lr
- bl ld_r3_tp_adr_i
- subs r3, 0x40
- strb r3, [r1, o_MusicPlayerTrack_bend]
- ldrb r3, [r1, o_MusicPlayerTrack_flags]
- movs r2, 0xC
- orrs r3, r2
- strb r3, [r1, o_MusicPlayerTrack_flags]
- bx r12
- thumb_func_end ply_bend
-
- thumb_func_start ply_bendr
-ply_bendr:
- mov r12, lr
- bl ld_r3_tp_adr_i
- strb r3, [r1, o_MusicPlayerTrack_bendRange]
- ldrb r3, [r1, o_MusicPlayerTrack_flags]
- movs r2, 0xC
- orrs r3, r2
- strb r3, [r1, o_MusicPlayerTrack_flags]
- bx r12
- thumb_func_end ply_bendr
-
- thumb_func_start ply_lfodl
-ply_lfodl:
- mov r12, lr
- bl ld_r3_tp_adr_i
- strb r3, [r1, o_MusicPlayerTrack_lfoDelay]
- bx r12
- thumb_func_end ply_lfodl
-
- thumb_func_start ply_modt
-ply_modt:
- mov r12, lr
- bl ld_r3_tp_adr_i
- ldrb r0, [r1, o_MusicPlayerTrack_modT]
- cmp r0, r3
- beq _081DD7AA
- strb r3, [r1, o_MusicPlayerTrack_modT]
- ldrb r3, [r1, o_MusicPlayerTrack_flags]
- movs r2, 0xF
- orrs r3, r2
- strb r3, [r1, o_MusicPlayerTrack_flags]
-_081DD7AA:
- bx r12
- thumb_func_end ply_modt
-
- thumb_func_start ply_tune
-ply_tune:
- mov r12, lr
- bl ld_r3_tp_adr_i
- subs r3, 0x40
- strb r3, [r1, o_MusicPlayerTrack_tune]
- ldrb r3, [r1, o_MusicPlayerTrack_flags]
- movs r2, 0xC
- orrs r3, r2
- strb r3, [r1, o_MusicPlayerTrack_flags]
- bx r12
- thumb_func_end ply_tune
-
- thumb_func_start ply_port
-ply_port:
- mov r12, lr
- ldr r2, [r1, o_MusicPlayerTrack_cmdPtr]
- ldrb r3, [r2]
- adds r2, 1
- ldr r0, =REG_SOUND1CNT_L @ sound register base address
- adds r0, r3
- bl _081DD64A
- strb r3, [r0]
- bx r12
- .pool
- thumb_func_end ply_port
-
- thumb_func_start m4aSoundVSync
-m4aSoundVSync:
- ldr r0, lt2_SOUND_INFO_PTR
- ldr r0, [r0]
-
- @ Exit the function if ident is not ID_NUMBER or ID_NUMBER+1.
- ldr r2, lt2_ID_NUMBER
- ldr r3, [r0, o_SoundInfo_ident]
- subs r3, r2
- cmp r3, 1
- bhi m4aSoundVSync_Done
-
- @ Decrement the PCM DMA counter. If it reaches 0, we need to do a DMA.
- ldrb r1, [r0, o_SoundInfo_pcmDmaCounter]
- subs r1, 1
- strb r1, [r0, o_SoundInfo_pcmDmaCounter]
- bgt m4aSoundVSync_Done
-
- @ Reload the PCM DMA counter.
- ldrb r1, [r0, o_SoundInfo_pcmDmaPeriod]
- strb r1, [r0, o_SoundInfo_pcmDmaCounter]
-
- ldr r2, =REG_DMA1
-
- ldr r1, [r2, 0x8] @ DMA1CNT
- lsls r1, 7
- bcc m4aSoundVSync_SkipDMA1 @ branch if repeat bit isn't set
-
- ldr r1, =((DMA_ENABLE | DMA_START_NOW | DMA_32BIT | DMA_SRC_INC | DMA_DEST_FIXED) << 16) | 4
- str r1, [r2, 0x8] @ DMA1CNT
-
-m4aSoundVSync_SkipDMA1:
- ldr r1, [r2, 0xC + 0x8] @ DMA2CNT
- lsls r1, 7
- bcc m4aSoundVSync_SkipDMA2 @ branch if repeat bit isn't set
-
- ldr r1, =((DMA_ENABLE | DMA_START_NOW | DMA_32BIT | DMA_SRC_INC | DMA_DEST_FIXED) << 16) | 4
- str r1, [r2, 0xC + 0x8] @ DMA2CNT
-
-m4aSoundVSync_SkipDMA2:
-
- @ turn off DMA1/DMA2
- movs r1, DMA_32BIT >> 8
- lsls r1, 8
- strh r1, [r2, 0xA] @ DMA1CNT_H
- strh r1, [r2, 0xC + 0xA] @ DMA2CNT_H
-
- @ turn on DMA1/DMA2 direct-sound FIFO mode
- movs r1, (DMA_ENABLE | DMA_START_SPECIAL | DMA_32BIT | DMA_REPEAT) >> 8
- lsls r1, 8 @ LSB is 0, so DMA_SRC_INC is used (destination is always fixed in FIFO mode)
- strh r1, [r2, 0xA] @ DMA1CNT_H
- strh r1, [r2, 0xC + 0xA] @ DMA2CNT_H
-
-m4aSoundVSync_Done:
- bx lr
-
- .pool
- thumb_func_end m4aSoundVSync
-
- thumb_func_start MPlayMain
-MPlayMain:
- ldr r2, lt2_ID_NUMBER
- ldr r3, [r0, o_MusicPlayerInfo_ident]
- cmp r2, r3
- beq _081DD82E
- bx lr
-_081DD82E:
- adds r3, 0x1
- str r3, [r0, o_MusicPlayerInfo_ident]
- push {r0,lr}
- ldr r3, [r0, o_MusicPlayerInfo_func]
- cmp r3, 0
- beq _081DD840
- ldr r0, [r0, o_MusicPlayerInfo_intp]
- bl call_r3
-_081DD840:
- pop {r0}
- push {r4-r7}
- mov r4, r8
- mov r5, r9
- mov r6, r10
- mov r7, r11
- push {r4-r7}
- adds r7, r0, 0
- ldr r0, [r7, o_MusicPlayerInfo_status]
- cmp r0, 0
- bge _081DD858
- b _081DDA6C
-_081DD858:
- ldr r0, lt2_SOUND_INFO_PTR
- ldr r0, [r0]
- mov r8, r0
- adds r0, r7, 0
- bl FadeOutBody
- ldr r0, [r7, o_MusicPlayerInfo_status]
- cmp r0, 0
- bge _081DD86C
- b _081DDA6C
-_081DD86C:
- ldrh r0, [r7, o_MusicPlayerInfo_tempoC]
- ldrh r1, [r7, o_MusicPlayerInfo_tempoI]
- adds r0, r1
- b _081DD9BC
-_081DD874:
- ldrb r6, [r7, o_MusicPlayerInfo_trackCount]
- ldr r5, [r7, o_MusicPlayerInfo_tracks]
- movs r3, 0x1
- movs r4, 0
-_081DD87C:
- ldrb r0, [r5]
- movs r1, 0x80
- tst r1, r0
- bne _081DD886
- b _081DD998
-_081DD886:
- mov r10, r3
- orrs r4, r3
- mov r11, r4
- ldr r4, [r5, o_MusicPlayerTrack_chan]
- cmp r4, 0
- beq _081DD8BA
-_081DD892:
- ldrb r1, [r4]
- movs r0, 0xC7
- tst r0, r1
- beq _081DD8AE
- ldrb r0, [r4, 0x10]
- cmp r0, 0
- beq _081DD8B4
- subs r0, 0x1
- strb r0, [r4, 0x10]
- bne _081DD8B4
- movs r0, 0x40
- orrs r1, r0
- strb r1, [r4]
- b _081DD8B4
-_081DD8AE:
- adds r0, r4, 0
- bl ClearChain
-_081DD8B4:
- ldr r4, [r4, 0x34]
- cmp r4, 0
- bne _081DD892
-_081DD8BA:
- ldrb r3, [r5, o_MusicPlayerTrack_flags]
- movs r0, 0x40
- tst r0, r3
- beq _081DD938
- adds r0, r5, 0
- bl Clear64byte
- movs r0, 0x80
- strb r0, [r5]
- movs r0, 0x2
- strb r0, [r5, o_MusicPlayerTrack_bendRange]
- movs r0, 0x40
- strb r0, [r5, o_MusicPlayerTrack_volX]
- movs r0, 0x16
- strb r0, [r5, o_MusicPlayerTrack_lfoSpeed]
- movs r0, 0x1
- adds r1, r5, 0x6
- strb r0, [r1, o_MusicPlayerTrack_ToneData_type - 0x6]
- b _081DD938
-_081DD8E0:
- ldr r2, [r5, o_MusicPlayerTrack_cmdPtr]
- ldrb r1, [r2]
- cmp r1, 0x80
- bhs _081DD8EC
- ldrb r1, [r5, o_MusicPlayerTrack_runningStatus]
- b _081DD8F6
-_081DD8EC:
- adds r2, 0x1
- str r2, [r5, o_MusicPlayerTrack_cmdPtr]
- cmp r1, 0xBD
- bcc _081DD8F6
- strb r1, [r5, o_MusicPlayerTrack_runningStatus]
-_081DD8F6:
- cmp r1, 0xCF
- bcc _081DD90C
- mov r0, r8
- ldr r3, [r0, o_SoundInfo_plynote]
- adds r0, r1, 0
- subs r0, 0xCF
- adds r1, r7, 0
- adds r2, r5, 0
- bl call_r3
- b _081DD938
-_081DD90C:
- cmp r1, 0xB0
- bls _081DD92E
- adds r0, r1, 0
- subs r0, 0xB1
- strb r0, [r7, o_MusicPlayerInfo_cmd]
- mov r3, r8
- ldr r3, [r3, o_SoundInfo_MPlayJumpTable]
- lsls r0, 2
- ldr r3, [r3, r0]
- adds r0, r7, 0
- adds r1, r5, 0
- bl call_r3
- ldrb r0, [r5, o_MusicPlayerTrack_flags]
- cmp r0, 0
- beq _081DD994
- b _081DD938
-_081DD92E:
- ldr r0, lt_gClockTable
- subs r1, 0x80
- adds r1, r0
- ldrb r0, [r1]
- strb r0, [r5, o_MusicPlayerTrack_wait]
-_081DD938:
- ldrb r0, [r5, o_MusicPlayerTrack_wait]
- cmp r0, 0
- beq _081DD8E0
- subs r0, 0x1
- strb r0, [r5, o_MusicPlayerTrack_wait]
- ldrb r1, [r5, o_MusicPlayerTrack_lfoSpeed]
- cmp r1, 0
- beq _081DD994
- ldrb r0, [r5, o_MusicPlayerTrack_mod]
- cmp r0, 0
- beq _081DD994
- ldrb r0, [r5, o_MusicPlayerTrack_lfoDelayC]
- cmp r0, 0
- beq _081DD95A
- subs r0, 0x1
- strb r0, [r5, o_MusicPlayerTrack_lfoDelayC]
- b _081DD994
-_081DD95A:
- ldrb r0, [r5, o_MusicPlayerTrack_lfoSpeedC]
- adds r0, r1
- strb r0, [r5, o_MusicPlayerTrack_lfoSpeedC]
- adds r1, r0, 0
- subs r0, 0x40
- lsls r0, 24
- bpl _081DD96E
- lsls r2, r1, 24
- asrs r2, 24
- b _081DD972
-_081DD96E:
- movs r0, 0x80
- subs r2, r0, r1
-_081DD972:
- ldrb r0, [r5, o_MusicPlayerTrack_mod]
- muls r0, r2
- asrs r2, r0, 6
- ldrb r0, [r5, o_MusicPlayerTrack_modM]
- eors r0, r2
- lsls r0, 24
- beq _081DD994
- strb r2, [r5, o_MusicPlayerTrack_modM]
- ldrb r0, [r5]
- ldrb r1, [r5, o_MusicPlayerTrack_modT]
- cmp r1, 0
- bne _081DD98E
- movs r1, 0xC
- b _081DD990
-_081DD98E:
- movs r1, 0x3
-_081DD990:
- orrs r0, r1
- strb r0, [r5, o_MusicPlayerTrack_flags]
-_081DD994:
- mov r3, r10
- mov r4, r11
-_081DD998:
- subs r6, 0x1
- ble _081DD9A4
- movs r0, 0x50
- adds r5, r0
- lsls r3, 1
- b _081DD87C
-_081DD9A4:
- ldr r0, [r7, o_MusicPlayerInfo_clock]
- adds r0, 0x1
- str r0, [r7, o_MusicPlayerInfo_clock]
- cmp r4, 0
- bne _081DD9B6
- movs r0, 0x80
- lsls r0, 24
- str r0, [r7, o_MusicPlayerInfo_status]
- b _081DDA6C
-_081DD9B6:
- str r4, [r7, o_MusicPlayerInfo_status]
- ldrh r0, [r7, o_MusicPlayerInfo_tempoC]
- subs r0, 0x96
-_081DD9BC:
- strh r0, [r7, o_MusicPlayerInfo_tempoC]
- cmp r0, 0x96
- bcc _081DD9C4
- b _081DD874
-_081DD9C4:
- ldrb r2, [r7, o_MusicPlayerInfo_trackCount]
- ldr r5, [r7, o_MusicPlayerInfo_tracks]
-_081DD9C8:
- ldrb r0, [r5, o_MusicPlayerTrack_flags]
- movs r1, 0x80
- tst r1, r0
- beq _081DDA62
- movs r1, 0xF
- tst r1, r0
- beq _081DDA62
- mov r9, r2
- adds r0, r7, 0
- adds r1, r5, 0
- bl TrkVolPitSet
- ldr r4, [r5, o_MusicPlayerTrack_chan]
- cmp r4, 0
- beq _081DDA58
-_081DD9E6:
- ldrb r1, [r4, o_SoundChannel_status]
- movs r0, 0xC7
- tst r0, r1
- bne _081DD9F6
- adds r0, r4, 0
- bl ClearChain
- b _081DDA52
-_081DD9F6:
- ldrb r0, [r4, o_SoundChannel_type]
- movs r6, 0x7
- ands r6, r0
- ldrb r3, [r5, o_MusicPlayerTrack_flags]
- movs r0, 0x3
- tst r0, r3
- beq _081DDA14
- bl ChnVolSetAsm
- cmp r6, 0
- beq _081DDA14
- ldrb r0, [r4, o_CgbChannel_mo]
- movs r1, 0x1
- orrs r0, r1
- strb r0, [r4, o_CgbChannel_mo]
-_081DDA14:
- ldrb r3, [r5, o_MusicPlayerTrack_flags]
- movs r0, 0xC
- tst r0, r3
- beq _081DDA52
- ldrb r1, [r4, o_SoundChannel_ky]
- movs r0, 0x8
- ldrsb r0, [r5, r0]
- adds r2, r1, r0
- bpl _081DDA28
- movs r2, 0
-_081DDA28:
- cmp r6, 0
- beq _081DDA46
- mov r0, r8
- ldr r3, [r0, o_SoundInfo_MidiKeyToCgbFreq]
- adds r1, r2, 0
- ldrb r2, [r5, o_MusicPlayerTrack_pitM]
- adds r0, r6, 0
- bl call_r3
- str r0, [r4, o_CgbChannel_fr]
- ldrb r0, [r4, o_CgbChannel_mo]
- movs r1, 0x2
- orrs r0, r1
- strb r0, [r4, o_CgbChannel_mo]
- b _081DDA52
-_081DDA46:
- adds r1, r2, 0
- ldrb r2, [r5, o_MusicPlayerTrack_pitM]
- ldr r0, [r4, o_SoundChannel_wav]
- bl MidiKeyToFreq
- str r0, [r4, o_SoundChannel_freq]
-_081DDA52:
- ldr r4, [r4, o_SoundChannel_np]
- cmp r4, 0
- bne _081DD9E6
-_081DDA58:
- ldrb r0, [r5, o_MusicPlayerTrack_flags]
- movs r1, 0xF0
- ands r0, r1
- strb r0, [r5, o_MusicPlayerTrack_flags]
- mov r2, r9
-_081DDA62:
- subs r2, 0x1
- ble _081DDA6C
- movs r0, 0x50
- adds r5, r0
- bgt _081DD9C8
-_081DDA6C:
- ldr r0, lt2_ID_NUMBER
- str r0, [r7, o_MusicPlayerInfo_ident]
- pop {r0-r7}
- mov r8, r0
- mov r9, r1
- mov r10, r2
- mov r11, r3
- pop {r3}
-
-call_r3:
- bx r3
-
- .align 2, 0
-lt_gClockTable: .word gClockTable
-lt2_SOUND_INFO_PTR: .word SOUND_INFO_PTR
-lt2_ID_NUMBER: .word ID_NUMBER
- thumb_func_end MPlayMain
-
- thumb_func_start TrackStop
-TrackStop:
- push {r4-r6,lr}
- adds r5, r1, 0
- ldrb r1, [r5, o_MusicPlayerTrack_flags]
- movs r0, 0x80
- tst r0, r1
- beq TrackStop_Done
- ldr r4, [r5, o_MusicPlayerTrack_chan]
- cmp r4, 0
- beq TrackStop_3
- movs r6, 0
-TrackStop_Loop:
- ldrb r0, [r4, o_SoundChannel_status]
- cmp r0, 0
- beq TrackStop_2
- ldrb r0, [r4, o_SoundChannel_type]
- movs r3, 0x7
- ands r0, r3
- beq TrackStop_1
- ldr r3, =SOUND_INFO_PTR
- ldr r3, [r3]
- ldr r3, [r3, o_SoundInfo_CgbOscOff]
- bl call_r3
-TrackStop_1:
- strb r6, [r4, o_SoundChannel_status]
-TrackStop_2:
- str r6, [r4, o_SoundChannel_track]
- ldr r4, [r4, o_SoundChannel_np]
- cmp r4, 0
- bne TrackStop_Loop
-TrackStop_3:
- str r4, [r5, o_MusicPlayerTrack_chan]
-TrackStop_Done:
- pop {r4-r6}
- pop {r0}
- bx r0
- .pool
- thumb_func_end TrackStop
-
- thumb_func_start ChnVolSetAsm
-ChnVolSetAsm:
- ldrb r1, [r4, 0x12]
- movs r0, 0x14
- ldrsb r2, [r4, r0]
- movs r3, 0x80
- adds r3, r2
- muls r3, r1
- ldrb r0, [r5, 0x10]
- muls r0, r3
- asrs r0, 14
- cmp r0, 0xFF
- bls _081DDAE8
- movs r0, 0xFF
-_081DDAE8:
- strb r0, [r4, 0x2]
- movs r3, 0x7F
- subs r3, r2
- muls r3, r1
- ldrb r0, [r5, 0x11]
- muls r0, r3
- asrs r0, 14
- cmp r0, 0xFF
- bls _081DDAFC
- movs r0, 0xFF
-_081DDAFC:
- strb r0, [r4, 0x3]
- bx lr
- thumb_func_end ChnVolSetAsm
-
- thumb_func_start ply_note
-ply_note:
- push {r4-r7,lr}
- mov r4, r8
- mov r5, r9
- mov r6, r10
- mov r7, r11
- push {r4-r7}
- sub sp, 0x18
- str r1, [sp]
- adds r5, r2, 0
- ldr r1, =SOUND_INFO_PTR
- ldr r1, [r1]
- str r1, [sp, 0x4]
- ldr r1, =gClockTable
- adds r0, r1
- ldrb r0, [r0]
- strb r0, [r5, o_MusicPlayerTrack_gateTime]
- ldr r3, [r5, o_MusicPlayerTrack_cmdPtr]
- ldrb r0, [r3]
- cmp r0, 0x80
- bhs _081DDB46
- strb r0, [r5, o_MusicPlayerTrack_key]
- adds r3, 0x1
- ldrb r0, [r3]
- cmp r0, 0x80
- bhs _081DDB44
- strb r0, [r5, o_MusicPlayerTrack_velocity]
- adds r3, 0x1
- ldrb r0, [r3]
- cmp r0, 0x80
- bhs _081DDB44
- ldrb r1, [r5, o_MusicPlayerTrack_gateTime]
- adds r1, r0
- strb r1, [r5, o_MusicPlayerTrack_gateTime]
- adds r3, 0x1
-_081DDB44:
- str r3, [r5, o_MusicPlayerTrack_cmdPtr]
-_081DDB46:
- movs r0, 0
- str r0, [sp, 0x14]
- adds r4, r5, 0
- adds r4, o_MusicPlayerTrack_ToneData_type
- ldrb r2, [r4]
- movs r0, TONEDATA_TYPE_RHY | TONEDATA_TYPE_SPL
- tst r0, r2
- beq _081DDB98
- ldrb r3, [r5, o_MusicPlayerTrack_key]
- movs r0, TONEDATA_TYPE_SPL
- tst r0, r2
- beq _081DDB66
- ldr r1, [r5, o_MusicPlayerTrack_ToneData_keySplitTable]
- adds r1, r3
- ldrb r0, [r1]
- b _081DDB68
-_081DDB66:
- adds r0, r3, 0
-_081DDB68:
- lsls r1, r0, 1
- adds r1, r0
- lsls r1, 2
- ldr r0, [r5, o_MusicPlayerTrack_ToneData_wav]
- adds r1, r0
- mov r9, r1
- mov r6, r9
- ldrb r1, [r6]
- movs r0, 0xC0
- tst r0, r1
- beq _081DDB80
- b _081DDCEA
-_081DDB80:
- movs r0, 0x80
- tst r0, r2
- beq _081DDB9C
- ldrb r1, [r6, 0x3]
- movs r0, 0x80
- tst r0, r1
- beq _081DDB94
- subs r1, 0xC0
- lsls r1, 1
- str r1, [sp, 0x14]
-_081DDB94:
- ldrb r3, [r6, 0x1]
- b _081DDB9C
-_081DDB98:
- mov r9, r4
- ldrb r3, [r5, 0x5]
-_081DDB9C:
- str r3, [sp, 0x8]
- ldr r6, [sp]
- ldrb r1, [r6, 0x9]
- ldrb r0, [r5, 0x1D]
- adds r0, r1
- cmp r0, 0xFF
- bls _081DDBAC
- movs r0, 0xFF
-_081DDBAC:
- str r0, [sp, 0x10]
- mov r6, r9
- ldrb r0, [r6]
- movs r6, 0x7
- ands r6, r0
- str r6, [sp, 0xC]
- beq _081DDBEC
- ldr r0, [sp, 0x4]
- ldr r4, [r0, 0x1C]
- cmp r4, 0
- bne _081DDBC4
- b _081DDCEA
-_081DDBC4:
- subs r6, 0x1
- lsls r0, r6, 6
- adds r4, r0
- ldrb r1, [r4]
- movs r0, 0xC7
- tst r0, r1
- beq _081DDC40
- movs r0, 0x40
- tst r0, r1
- bne _081DDC40
- ldrb r1, [r4, 0x13]
- ldr r0, [sp, 0x10]
- cmp r1, r0
- bcc _081DDC40
- beq _081DDBE4
- b _081DDCEA
-_081DDBE4:
- ldr r0, [r4, 0x2C]
- cmp r0, r5
- bcs _081DDC40
- b _081DDCEA
-_081DDBEC:
- ldr r6, [sp, 0x10]
- adds r7, r5, 0
- movs r2, 0
- mov r8, r2
- ldr r4, [sp, 0x4]
- ldrb r3, [r4, 0x6]
- adds r4, 0x50
-_081DDBFA:
- ldrb r1, [r4]
- movs r0, 0xC7
- tst r0, r1
- beq _081DDC40
- movs r0, 0x40
- tst r0, r1
- beq _081DDC14
- cmp r2, 0
- bne _081DDC18
- adds r2, 0x1
- ldrb r6, [r4, 0x13]
- ldr r7, [r4, 0x2C]
- b _081DDC32
-_081DDC14:
- cmp r2, 0
- bne _081DDC34
-_081DDC18:
- ldrb r0, [r4, 0x13]
- cmp r0, r6
- bcs _081DDC24
- adds r6, r0, 0
- ldr r7, [r4, 0x2C]
- b _081DDC32
-_081DDC24:
- bhi _081DDC34
- ldr r0, [r4, 0x2C]
- cmp r0, r7
- bls _081DDC30
- adds r7, r0, 0
- b _081DDC32
-_081DDC30:
- bcc _081DDC34
-_081DDC32:
- mov r8, r4
-_081DDC34:
- adds r4, 0x40
- subs r3, 0x1
- bgt _081DDBFA
- mov r4, r8
- cmp r4, 0
- beq _081DDCEA
-_081DDC40:
- adds r0, r4, 0
- bl ClearChain
- movs r1, 0
- str r1, [r4, 0x30]
- ldr r3, [r5, 0x20]
- str r3, [r4, 0x34]
- cmp r3, 0
- beq _081DDC54
- str r4, [r3, 0x30]
-_081DDC54:
- str r4, [r5, 0x20]
- str r5, [r4, 0x2C]
- ldrb r0, [r5, 0x1B]
- strb r0, [r5, 0x1C]
- cmp r0, r1
- beq _081DDC66
- adds r1, r5, 0
- bl clear_modM
-_081DDC66:
- ldr r0, [sp]
- adds r1, r5, 0
- bl TrkVolPitSet
- ldr r0, [r5, 0x4]
- str r0, [r4, 0x10]
- ldr r0, [sp, 0x10]
- strb r0, [r4, 0x13]
- ldr r0, [sp, 0x8]
- strb r0, [r4, 0x8]
- ldr r0, [sp, 0x14]
- strb r0, [r4, 0x14]
- mov r6, r9
- ldrb r0, [r6]
- strb r0, [r4, 0x1]
- ldr r7, [r6, 0x4]
- str r7, [r4, 0x24]
- ldr r0, [r6, 0x8]
- str r0, [r4, 0x4]
- ldrh r0, [r5, 0x1E]
- strh r0, [r4, 0xC]
- bl ChnVolSetAsm
- ldrb r1, [r4, 0x8]
- movs r0, 0x8
- ldrsb r0, [r5, r0]
- adds r3, r1, r0
- bpl _081DDCA0
- movs r3, 0
-_081DDCA0:
- ldr r6, [sp, 0xC]
- cmp r6, 0
- beq _081DDCCE
- mov r6, r9
- ldrb r0, [r6, 0x2]
- strb r0, [r4, 0x1E]
- ldrb r1, [r6, 0x3]
- movs r0, 0x80
- tst r0, r1
- bne _081DDCBA
- movs r0, 0x70
- tst r0, r1
- bne _081DDCBC
-_081DDCBA:
- movs r1, 0x8
-_081DDCBC:
- strb r1, [r4, 0x1F]
- ldrb r2, [r5, 0x9]
- adds r1, r3, 0
- ldr r0, [sp, 0xC]
- ldr r3, [sp, 0x4]
- ldr r3, [r3, 0x30]
- bl call_r3
- b _081DDCDC
-_081DDCCE:
- ldr r0, [r5, o_MusicPlayerTrack_unk_3C]
- str r0, [r4, 0x18]
- ldrb r2, [r5, 0x9]
- adds r1, r3, 0
- adds r0, r7, 0
- bl MidiKeyToFreq
-_081DDCDC:
- str r0, [r4, 0x20]
- movs r0, 0x80
- strb r0, [r4]
- ldrb r1, [r5]
- movs r0, 0xF0
- ands r0, r1
- strb r0, [r5]
-_081DDCEA:
- add sp, 0x18
- pop {r0-r7}
- mov r8, r0
- mov r9, r1
- mov r10, r2
- mov r11, r3
- pop {r0}
- bx r0
- .pool
- thumb_func_end ply_note
-
- thumb_func_start ply_endtie
-ply_endtie:
- push {r4,r5}
- ldr r2, [r1, o_MusicPlayerTrack_cmdPtr]
- ldrb r3, [r2]
- cmp r3, 0x80
- bhs _081DDD16
- strb r3, [r1, o_MusicPlayerTrack_key]
- adds r2, 0x1
- str r2, [r1, o_MusicPlayerTrack_cmdPtr]
- b _081DDD18
-_081DDD16:
- ldrb r3, [r1, o_MusicPlayerTrack_key]
-_081DDD18:
- ldr r1, [r1, o_MusicPlayerTrack_chan]
- cmp r1, 0
- beq _081DDD40
- movs r4, 0x83
- movs r5, 0x40
-_081DDD22:
- ldrb r2, [r1, o_SoundChannel_status]
- tst r2, r4
- beq _081DDD3A
- tst r2, r5
- bne _081DDD3A
- ldrb r0, [r1, o_SoundChannel_mk]
- cmp r0, r3
- bne _081DDD3A
- movs r0, 0x40
- orrs r2, r0
- strb r2, [r1, o_SoundChannel_status]
- b _081DDD40
-_081DDD3A:
- ldr r1, [r1, o_SoundChannel_np]
- cmp r1, 0
- bne _081DDD22
-_081DDD40:
- pop {r4,r5}
- bx lr
- thumb_func_end ply_endtie
-
- thumb_func_start clear_modM
-clear_modM:
- movs r2, 0
- strb r2, [r1, o_MusicPlayerTrack_modM]
- strb r2, [r1, o_MusicPlayerTrack_lfoSpeedC]
- ldrb r2, [r1, o_MusicPlayerTrack_modT]
- cmp r2, 0
- bne _081DDD54
- movs r2, 0xC
- b _081DDD56
-_081DDD54:
- movs r2, 0x3
-_081DDD56:
- ldrb r3, [r1, o_MusicPlayerTrack_flags]
- orrs r3, r2
- strb r3, [r1, o_MusicPlayerTrack_flags]
- bx lr
- thumb_func_end clear_modM
-
- thumb_func_start ld_r3_tp_adr_i
-ld_r3_tp_adr_i_unchecked:
- ldr r2, [r1, o_MusicPlayerTrack_cmdPtr]
- adds r3, r2, 1
- str r3, [r1, o_MusicPlayerTrack_cmdPtr]
- ldrb r3, [r2]
- bx lr
- thumb_func_end ld_r3_tp_adr_i
-
- thumb_func_start ply_lfos
-ply_lfos:
- mov r12, lr
- bl ld_r3_tp_adr_i_unchecked
- strb r3, [r1, o_MusicPlayerTrack_lfoSpeed]
- cmp r3, 0
- bne _081DDD7C
- bl clear_modM
-_081DDD7C:
- bx r12
- thumb_func_end ply_lfos
-
- thumb_func_start ply_mod
-ply_mod:
- mov r12, lr
- bl ld_r3_tp_adr_i_unchecked
- strb r3, [r1, o_MusicPlayerTrack_mod]
- cmp r3, 0
- bne _081DDD90
- bl clear_modM
-_081DDD90:
- bx r12
- thumb_func_end ply_mod
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/asm/m4a_3.s b/asm/m4a_3.s
index a842ae925..82b6a2467 100644
--- a/asm/m4a_3.s
+++ b/asm/m4a_3.s
@@ -1,4 +1,4 @@
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.include "constants/gba_constants.inc"
.include "constants/m4a_constants.inc"
diff --git a/asm/macros.inc b/asm/macros.inc
deleted file mode 100644
index 6d8657892..000000000
--- a/asm/macros.inc
+++ /dev/null
@@ -1,149 +0,0 @@
- .include "asm/macros/asm.inc"
- .include "asm/macros/function.inc"
- .include "asm/macros/movement.inc"
- .include "asm/macros/pokemon_data.inc"
- .include "asm/macros/ec.inc"
- .include "asm/macros/map.inc"
-
- .macro region_map_location x, y, width, height, name
- .byte \x
- .byte \y
- .byte \width
- .byte \height
- .4byte gMapName_\name
- .endm
-
- .macro obj_tiles address, uncompressed_size, tag
- .4byte \address
- .2byte \uncompressed_size
- .2byte \tag
- .endm
-
- .macro null_obj_tiles
- obj_tiles 0, 0, 0
- .endm
-
- .macro obj_pal address, tag
- .4byte \address
- .2byte \tag
- .2byte 0 @ padding
- .endm
-
- .macro null_obj_pal
- obj_pal 0, 0
- .endm
-
- .macro paired_pals tag, address
- .2byte \tag
- .2byte 0 @ padding
- .4byte \address
- .endm
-
-@ For object animation frames.
- .macro obj_frame_tiles address, uncompressed_size
- .4byte \address
- .2byte \uncompressed_size
- .2byte 0 @ padding
- .endm
-
- .macro spr_template tile_tag, pal_tag, oam, anims, images, affine_anims, callback
- .2byte \tile_tag
- .2byte \pal_tag
- .4byte \oam
- .4byte \anims
- .4byte \images
- .4byte \affine_anims
- .4byte \callback
- .endm
-
-@ Berry trees have a table defining the palette slot used for each of their 5
-@ stages. However, the first 2 stages always use the same slots regardless of
-@ the type of tree and the slots of the last 3 stages always equal each other.
- .macro berry_tree_palette_slot_table slot
- .byte 3, 4, \slot, \slot, \slot
- .endm
-
- .macro subsprite x, y, priority, tile_num_offset, size
- .2byte \x
- .2byte \y
- .2byte ((\priority) << 14) | ((\tile_num_offset) << 4) | SPRITE_SIZE_\size
- .2byte 0 @ padding
- .endm
-
- .macro obj_image_anim_frame pic_id, duration, flags = 0
- .2byte \pic_id
- .byte (\flags) | (\duration)
- .byte 0 @ padding
- .endm
-
- .macro obj_image_anim_loop count
- .2byte 0xfffd
- .byte \count
- .byte 0 @ padding
- .endm
-
- .macro obj_image_anim_jump target_index
- .2byte 0xfffe
- .byte \target_index
- .byte 0 @ padding
- .endm
-
- .macro obj_image_anim_end
- .2byte 0xffff
- .2byte 0 @ padding
- .endm
-
- .macro obj_rot_scal_anim_frame delta_x_scale, delta_y_scale, delta_angle, duration
- .2byte \delta_x_scale
- .2byte \delta_y_scale
- .byte \delta_angle
- .byte \duration
- .2byte 0 @ padding
- .endm
-
- .macro obj_rot_scal_anim_loop count
- .2byte 0x7ffd
- .2byte \count
- .4byte 0 @ padding
- .endm
-
- .macro obj_rot_scal_anim_jump target_index
- .2byte 0x7ffe
- .2byte \target_index
- .4byte 0 @ padding
- .endm
-
- .macro obj_rot_scal_anim_end unknown=0
- .2byte 0x7fff
- .2byte \unknown
- .fill 4 @ padding
- .endm
-
- .macro credits_entry number, text
- .4byte \number
- .4byte \text
- .endm
-
- .macro door_anim_frame unknown, offset
- .byte \unknown
- .byte 0 @ padding
- .2byte \offset
- .endm
-
- .macro door_anim_gfx metatile_num, unknown, tile_addr, palette_addr
- .2byte \metatile_num
- .2byte \unknown
- .4byte \tile_addr
- .4byte \palette_addr
- .endm
-
- .macro trainer_eye_trainer opp_1, opp_2, opp_3, opp_4, opp_5, map_name
- .2byte OPPONENT_\opp_1
- .2byte OPPONENT_\opp_2
- .2byte OPPONENT_\opp_3
- .2byte OPPONENT_\opp_4
- .2byte OPPONENT_\opp_5
- .2byte GROUP_\map_name
- .2byte MAP_\map_name
- .space 2
- .endm
diff --git a/asm/macros/asm.inc b/asm/macros/asm.inc
deleted file mode 100644
index 26b2707ca..000000000
--- a/asm/macros/asm.inc
+++ /dev/null
@@ -1,17 +0,0 @@
- .ifndef GUARD_ASM_MACROS_ASM_INC
- .set GUARD_ASM_MACROS_ASM_INC, 1
-
- .macro inc x
- .set \x, \x + 1
- .endm
-
- .macro enum_start x=0
- .set __enum__, \x
- .endm
-
- .macro enum constant
- .equiv \constant, __enum__
- inc __enum__
- .endm
-
- .endif @ GUARD_ASM_MACROS_ASM_INC
diff --git a/asm/macros/battle_ai_script.inc b/asm/macros/battle_ai_script.inc
deleted file mode 100644
index 679e30340..000000000
--- a/asm/macros/battle_ai_script.inc
+++ /dev/null
@@ -1,554 +0,0 @@
- .macro if_random_less_than percent, address
- .byte 0x00
- .byte \percent
- .4byte \address
- .endm
-
- @ unused
- .macro if_random_greater_than percent, address
- .byte 0x01
- .byte \percent
- .4byte \address
- .endm
-
- @ unused
- .macro if_random_equal address
- .byte 0x02
- .4byte \address
- .endm
-
- @ unused
- .macro if_random_not_equal address
- .byte 0x03
- .4byte \address
- .endm
-
- .macro score score
- .byte 0x04
- .byte \score
- .endm
-
- .macro if_hp_less_than target, percent, address
- .byte 0x05
- .byte \target
- .byte \percent
- .4byte \address
- .endm
-
- .macro if_hp_more_than target, percent, address
- .byte 0x06
- .byte \target
- .byte \percent
- .4byte \address
- .endm
-
- .macro if_hp_equal target, percent, address
- .byte 0x07
- .byte \target
- .byte \percent
- .4byte \address
- .endm
-
- .macro if_hp_not_equal target, percent, address
- .byte 0x08
- .byte \target
- .byte \percent
- .4byte \address
- .endm
-
- .macro if_status target, status, address
- .byte 0x09
- .byte \target
- .4byte \status
- .4byte \address
- .endm
-
- .macro if_not_status target, status, address
- .byte 0x0a
- .byte \target
- .4byte \status
- .4byte \address
- .endm
-
- .macro if_status2 target, status, address
- .byte 0x0b
- .byte \target
- .4byte \status
- .4byte \address
- .endm
-
- .macro if_not_status2 target, status, address
- .byte 0x0c
- .byte \target
- .4byte \status
- .4byte \address
- .endm
-
- .macro if_status3 target, status, address
- .byte 0x0d
- .byte \target
- .4byte \status
- .4byte \address
- .endm
-
- .macro if_not_status3 target, status, address
- .byte 0x0e
- .byte \target
- .4byte \status
- .4byte \address
- .endm
-
- .macro if_status4 target, status, address
- .byte 0x0f
- .byte \target
- .4byte \status
- .4byte \address
- .endm
-
- .macro if_not_status4 target, status, address
- .byte 0x10
- .byte \target
- .4byte \status
- .4byte \address
- .endm
-
- .macro if_less_than value, address
- .byte 0x11
- .byte \value
- .4byte \address
- .endm
-
- .macro if_more_than value, address
- .byte 0x12
- .byte \value
- .4byte \address
- .endm
-
- .macro if_equal value, address
- .byte 0x13
- .byte \value
- .4byte \address
- .endm
-
- .macro if_not_equal value, address
- .byte 0x14
- .byte \value
- .4byte \address
- .endm
-
- .macro if_less_than_32 value, address
- .byte 0x15
- .4byte \value
- .4byte \address
- .endm
-
- .macro if_more_than_32 value, address
- .byte 0x16
- .4byte \value
- .4byte \address
- .endm
-
- .macro if_equal_32 value, address
- .byte 0x17
- .4byte \value
- .4byte \address
- .endm
-
- .macro if_not_equal_32 value, address
- .byte 0x18
- .4byte \value
- .4byte \address
- .endm
-
- .macro if_move move, address
- .byte 0x19
- .2byte \move
- .4byte \address
- .endm
-
- .macro if_not_move move, address
- .byte 0x1a
- .2byte \move
- .4byte \address
- .endm
-
- .macro if_in_bytes list, address
- .byte 0x1b
- .4byte \list
- .4byte \address
- .endm
-
- .macro if_not_in_bytes list, address
- .byte 0x1c
- .4byte \list
- .4byte \address
- .endm
-
- .macro if_in_words list, address
- .byte 0x1d
- .4byte \list
- .4byte \address
- .endm
-
- .macro if_not_in_words list, address
- .byte 0x1e
- .4byte \list
- .4byte \address
- .endm
-
- .macro if_user_can_damage address
- .byte 0x1f
- .4byte \address
- .endm
-
- .macro if_user_cant_damage address
- .byte 0x20
- .4byte \address
- .endm
-
- .macro get_turn_count
- .byte 0x21
- .endm
-
- .macro get_type byte
- .byte 0x22
- .byte \byte
- .endm
-
- @ unused
- .macro get_move_power
- .byte 0x23
- .endm
-
- .macro is_most_powerful_move
- .byte 0x24
- .endm
-
- .macro get_move target
- .byte 0x25
- .byte \target
- .endm
-
- .macro if_arg_equal type, address
- .byte 0x26
- .byte \type
- .4byte \address
- .endm
-
- @ unused
- .macro if_arg_not_equal type, address
- .byte 0x27
- .byte \type
- .4byte \address
- .endm
-
- .macro if_would_go_first target, address
- .byte 0x28
- .byte \target
- .4byte \address
- .endm
-
- .macro if_would_not_go_first target, address
- .byte 0x29
- .byte \target
- .4byte \address
- .endm
-
- @ nullsub
- .macro ai_2a
- .byte 0x2a
- .endm
-
- @ nullsub
- .macro ai_2b
- .byte 0x2b
- .endm
-
- .macro count_alive_pokemon target
- .byte 0x2c
- .byte \target
- .endm
-
- @ unused
- .macro get_considered_move
- .byte 0x2d
- .endm
-
- .macro get_effect
- .byte 0x2e
- .endm
-
- .macro get_ability target
- .byte 0x2f
- .byte \target
- .endm
-
- @ unused
- .macro get_highest_possible_damage
- .byte 0x30
- .endm
-
- .macro if_damage_bonus value, address
- .byte 0x31
- .byte \value
- .4byte \address
- .endm
-
- @ nullsub
- .macro ai_32
- .byte 0x32
- .endm
-
- @ nullsub
- .macro ai_33
- .byte 0x33
- .endm
-
- .macro if_status_in_party target, status, address
- .byte 0x34
- .byte \target
- .4byte \status
- .4byte \address
- .endm
-
- @ bugged
- .macro if_status_not_in_party target, status, address
- .byte 0x35
- .byte \target
- .4byte \status
- .4byte \address
- .endm
-
- .macro get_weather
- .byte 0x36
- .endm
-
- .macro if_effect byte, address
- .byte 0x37
- .byte \byte
- .4byte \address
- .endm
-
- .macro if_not_effect byte, address
- .byte 0x38
- .byte \byte
- .4byte \address
- .endm
-
- .macro if_stat_level_less_than target, stat, level, address
- .byte 0x39
- .byte \target
- .byte \stat
- .byte \level
- .4byte \address
- .endm
-
- .macro if_stat_level_more_than target, stat, level, address
- .byte 0x3a
- .byte \target
- .byte \stat
- .byte \level
- .4byte \address
- .endm
-
- .macro if_stat_level_equal target, stat, level, address
- .byte 0x3b
- .byte \target
- .byte \stat
- .byte \level
- .4byte \address
- .endm
-
- .macro if_stat_level_not_equal target, stat, level, address
- .byte 0x3c
- .byte \target
- .byte \stat
- .byte \level
- .4byte \address
- .endm
-
- .macro if_can_faint address
- .byte 0x3d
- .4byte \address
- .endm
-
- .macro if_cant_faint address
- .byte 0x3e
- .4byte \address
- .endm
-
- @ unused
- .macro if_has_move, target, move, address
- .byte 0x3f
- .byte \target
- .2byte \move
- .4byte \address
- .endm
-
- @ unused
- .macro if_dont_have_move, target, move, address
- .byte 0x40
- .byte \target
- .2byte \move
- .4byte \address
- .endm
-
- .macro if_move_effect target, effect, address
- .byte 0x41
- .byte \target
- .byte \effect
- .4byte \address
- .endm
-
- .macro if_not_move_effect target, effect, address
- .byte 0x42
- .byte \target
- .byte \effect
- .4byte \address
- .endm
-
- .macro if_last_move_did_damage target, byte, address
- .byte 0x43
- .byte \target
- .byte \byte
- .4byte \address
- .endm
-
- .macro if_encored target, address
- .byte 0x44
- .byte \target
- .4byte \address
- .endm
-
- .macro flee
- .byte 0x45
- .endm
-
- .macro if_random_100 address
- .byte 0x46
- .4byte \address
- .endm
-
- .macro watch
- .byte 0x47
- .endm
-
- .macro get_hold_effect target
- .byte 0x48
- .byte \target
- .endm
-
- .macro get_gender target
- .byte 0x49
- .byte \target
- .endm
-
- .macro is_first_turn target
- .byte 0x4a
- .byte \target
- .endm
-
- .macro get_stockpile_count target
- .byte 0x4b
- .byte \target
- .endm
-
- .macro is_double_battle
- .byte 0x4c
- .endm
-
- .macro get_item target
- .byte 0x4d
- .byte \target
- .endm
-
- .macro get_move_type_from_result
- .byte 0x4e
- .endm
-
- .macro get_move_power_from_result
- .byte 0x4f
- .endm
-
- .macro get_move_effect_from_result
- .byte 0x50
- .endm
-
- .macro get_protect_count target
- .byte 0x51
- .byte \target
- .endm
-
- @ nullsub
- .macro ai_52
- .byte 0x52
- .endm
-
- @ nullsub
- .macro ai_53
- .byte 0x53
- .endm
-
- @ nullsub
- .macro ai_54
- .byte 0x54
- .endm
-
- @ nullsub
- .macro ai_55
- .byte 0x55
- .endm
-
- @ nullsub
- .macro ai_56
- .byte 0x56
- .endm
-
- @ nullsub
- .macro ai_57
- .byte 0x57
- .endm
-
- @ unused
- .macro call address
- .byte 0x58
- .4byte \address
- .endm
-
- .macro jump address
- .byte 0x59
- .4byte \address
- .endm
-
- .macro end
- .byte 0x5a
- .endm
-
- .macro if_level_cond cond, address
- .byte 0x5b
- .byte \cond
- .4byte \address
- .endm
-
- .macro if_user_higher_level address
- if_level_cond 0, \address
- .endm
-
- .macro if_target_higher_level address
- if_level_cond 1, \address
- .endm
-
- .macro if_equal_levels address
- if_level_cond 2, \address
- .endm
-
- @ unused
- .macro if_taunted address
- .byte 0x5c
- .4byte \address
- .endm
-
- .macro if_not_taunted address
- .byte 0x5d
- .4byte \address
- .endm
diff --git a/asm/macros/battle_anim.inc b/asm/macros/battle_anim.inc
deleted file mode 100644
index 4ff845032..000000000
--- a/asm/macros/battle_anim.inc
+++ /dev/null
@@ -1,266 +0,0 @@
- .macro loadsprite id
- .byte 0x00
- .2byte \id
- .endm
-
- .macro unloadsprite id
- .byte 0x01
- .2byte \id
- .endm
-
- .macro sprite template, priority, argv:vararg
- .byte 0x02
- .4byte \template
- .byte \priority
- .byte (.Lsprite_\@_2 - .Lsprite_\@_1) / 2
-.Lsprite_\@_1:
- .2byte \argv
-.Lsprite_\@_2:
- .endm
-
- .macro createtask addr, priority, argv:vararg
- .byte 0x03
- .4byte \addr
- .byte \priority
- .byte (.Lcreatetask_\@_2 - .Lcreatetask_\@_1) / 2
-.Lcreatetask_\@_1:
- .2byte \argv
-.Lcreatetask_\@_2:
- .endm
-
- .macro pause delay
- .byte 0x04
- .byte \delay
- .endm
-
- .macro wait
- .byte 0x05
- .endm
-
- .macro hang1
- .byte 0x06
- .endm
-
- .macro hang2
- .byte 0x07
- .endm
-
- .macro end
- .byte 0x08
- .endm
-
- .macro playse id
- .byte 0x09
- .2byte \id
- .endm
-
- .macro monbg which
- .byte 0x0A
- .byte \which
- .endm
-
- .macro clearmonbg which
- .byte 0x0B
- .byte \which
- .endm
-
- .macro setalpha eva, evb
- .byte 0x0C
- .2byte ((\evb) << 8) | (\eva)
- .endm
-
- .macro blendoff
- .byte 0x0D
- .endm
-
- .macro call addr
- .byte 0x0E
- .4byte \addr
- .endm
-
- .macro ret
- .byte 0x0F
- .endm
-
- .macro setvar var_num, value
- .byte 0x10
- .byte \var_num
- .2byte \value
- .endm
-
- .macro ifelse addr1, addr2
- .byte 0x11
- .4byte \addr1
- .4byte \addr2
- .endm
-
- .macro jumpif cond, addr
- .byte 0x12
- .byte \cond
- .4byte \addr
- .endm
-
- .macro jump addr
- .byte 0x13
- .4byte \addr
- .endm
-
- .macro fadetobg id
- .byte 0x14
- .byte \id
- .endm
-
- .macro restorebg
- .byte 0x15
- .endm
-
- .macro waitbgfadeout
- .byte 0x16
- .endm
-
- .macro waitbgfadein
- .byte 0x17
- .endm
-
- .macro changebg id
- .byte 0x18
- .byte \id
- .endm
-
- .macro panse_19 id, pan
- .byte 0x19
- .2byte \id
- .byte \pan
- .endm
-
- .macro setpan pan
- .byte 0x1A
- .byte \pan
- .endm
-
- .macro panse_1B id, pan_start, pan_end, step, delay
- .byte 0x1B
- .2byte \id
- .byte \pan_start
- .byte \pan_end
- .byte \step
- .byte \delay
- .endm
-
- .macro panse_1C id, pan, delay, count
- .byte 0x1C
- .2byte \id
- .byte \pan
- .byte \delay
- .byte \count
- .endm
-
- .macro panse_1D id, pan, count
- .byte 0x1D
- .2byte \id
- .byte \pan
- .byte \count
- .endm
-
- .macro setbldcnt bldcnt
- .byte 0x1E
- .2byte \bldcnt
- .endm
-
- .macro createtask_1F addr, argv:vararg
- .byte 0x1F
- .4byte \addr
- .byte (.Lcreatetask_1F_\@_2 - .Lcreatetask_1F_\@_1) / 2
-.Lcreatetask_1F_\@_1:
- .2byte \argv
-.Lcreatetask_1F_\@_2:
- .endm
-
- .macro waitsound
- .byte 0x20
- .endm
-
- .macro jumpvareq var_num, value, addr
- .byte 0x21
- .byte \var_num
- .2byte \value
- .4byte \addr
- .endm
-
- .macro monbg_22 unk
- .byte 0x22
- .byte \unk
- .endm
-
- .macro clearmonbg_23 unk
- .byte 0x23
- .byte \unk
- .endm
-
- .macro jumpunkcond addr
- .byte 0x24
- .4byte \addr
- .endm
-
- .macro fadetobg_25 a, b, c
- .byte 0x25
- .byte \a
- .byte \b
- .byte \c
- .endm
-
- .macro panse_26 id, pan_start, pan_end, step, delay
- .byte 0x26
- .2byte \id
- .byte \pan_start
- .byte \pan_end
- .byte \step
- .byte \delay
- .endm
-
- .macro panse_27 id, pan_start, pan_end, step, delay
- .byte 0x27
- .2byte \id
- .byte \pan_start
- .byte \pan_end
- .byte \step
- .byte \delay
- .endm
-
- .macro monbgprio_28 unk
- .byte 0x28
- .byte \unk
- .endm
-
- .macro monbgprio_29
- .byte 0x29
- .endm
-
- .macro monbgprio_2A unk
- .byte 0x2A
- .byte \unk
- .endm
-
- .macro invisible side
- .byte 0x2B
- .byte \side
- .endm
-
- .macro visible side
- .byte 0x2C
- .byte \side
- .endm
-
- .macro doublebattle_2D unk
- .byte 0x2D
- .byte \unk
- .endm
-
- .macro doublebattle_2E unk
- .byte 0x2E
- .byte \unk
- .endm
-
- .macro stopsound
- .byte 0x2F
- .endm
diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc
deleted file mode 100644
index e4fa0c454..000000000
--- a/asm/macros/battle_script.inc
+++ /dev/null
@@ -1,1414 +0,0 @@
-@ 0 ==
-@ 1 !=
-@ 2 <
-@ 3 >
-@ 4 &=
-
- .macro calculatedamage
- critical
- atk5
- atk6
- atk7
- .endm
-
-
- .macro attackcanceler
- .byte 0x00
- .endm
-
- .macro accuracycheck address, param1
- .byte 0x01
- .4byte \address
- .2byte \param1
- .endm
-
- .macro attackstring
- .byte 0x02
- .endm
-
- .macro ppreduce
- .byte 0x03
- .endm
-
- .macro critcalc
- .byte 0x04
- .endm
-
- .macro damagecalc
- .byte 0x05
- .endm
-
- .macro typecalc
- .byte 0x06
- .endm
-
- .macro adjustnormaldamage
- .byte 0x07
- .endm
-
- .macro adjustnormaldamage2
- .byte 0x08
- .endm
-
- .macro attackanimation
- .byte 0x09
- .endm
-
- .macro waitanimation
- .byte 0x0a
- .endm
-
- .macro healthbarupdate bank
- .byte 0x0b
- .byte \bank
- .endm
-
- .macro datahpupdate bank
- .byte 0x0c
- .byte \bank
- .endm
-
- .macro critmessage
- .byte 0x0d
- .endm
-
- .macro effectivenesssound
- .byte 0x0e
- .endm
-
- .macro resultmessage
- .byte 0x0f
- .endm
-
- .macro printstring string
- .byte 0x10
- .2byte \string
- .endm
-
- .macro printselectionstring string
- .byte 0x11
- .2byte \string
- .endm
-
- .macro waitmessage delay
- .byte 0x12
- .2byte \delay
- .endm
-
- .macro printfromtable table
- .byte 0x13
- .4byte \table
- .endm
-
- .macro printselectionstringfromtable table
- .byte 0x14
- .4byte \table
- .endm
-
- .macro seteffectwithchance
- .byte 0x15
- .endm
-
- .macro seteffectprimary
- .byte 0x16
- .endm
-
- .macro seteffectsecondary
- .byte 0x17
- .endm
-
- .macro clearstatusfromeffect bank
- .byte 0x18
- .byte \bank
- .endm
-
- .macro tryfaintmon bank, param2, param3
- .byte 0x19
- .byte \bank
- .byte \param2
- .4byte \param3
- .endm
-
- .macro dofaintanimation param1
- .byte 0x1a
- .byte \param1
- .endm
-
- .macro cleareffectsonfaint bank
- .byte 0x1b
- .byte \bank
- .endm
-
- .macro jumpifstatus bank, status, address
- .byte 0x1c
- .byte \bank
- .4byte \status
- .4byte \address
- .endm
-
- .macro jumpifstatus2 bank, status, address
- .byte 0x1d
- .byte \bank
- .4byte \status
- .4byte \address
- .endm
-
- .macro jumpifability bank, ability, address
- .byte 0x1e
- .byte \bank
- .byte \ability
- .4byte \address
- .endm
-
- .macro jumpifsideaffecting bank, status, address
- .byte 0x1f
- .byte \bank
- .2byte \status
- .4byte \address
- .endm
-
- .macro jumpifstat bank, flag, quantity, statid, address
- .byte 0x20
- .byte \bank
- .byte \flag
- .byte \quantity
- .byte \statid
- .4byte \address
- .endm
-
- .macro jumpifstatus3condition bank, mask, status, address
- .byte 0x21
- .byte \bank
- .4byte \mask
- .byte \status
- .4byte \address
- .endm
-
- .macro jumpiftype bank, type, address
- .byte 0x22
- .byte \bank
- .byte \type
- .4byte \address
- .endm
-
- .macro getexp bank
- .byte 0x23
- .byte \bank
- .endm
-
- .macro atk24 address
- .byte 0x24
- .4byte \address
- .endm
-
- .macro movevaluescleanup
- .byte 0x25
- .endm
-
- .macro setmultihit param1
- .byte 0x26
- .byte \param1
- .endm
-
- .macro decrementmultihit address
- .byte 0x27
- .4byte \address
- .endm
-
- .macro goto address
- .byte 0x28
- .4byte \address
- .endm
-
- .macro jumpifbyte ifflag, checkaddr, compare, address
- .byte 0x29
- .byte \ifflag
- .4byte \checkaddr
- .byte \compare
- .4byte \address
- .endm
-
- .macro jumpifhalfword ifflag, checkaddr, compare, address
- .byte 0x2a
- .byte \ifflag
- .4byte \checkaddr
- .2byte \compare
- .4byte \address
- .endm
-
- .macro jumpifword ifflag, checkaddr, compare, address
- .byte 0x2b
- .byte \ifflag
- .4byte \checkaddr
- .4byte \compare
- .4byte \address
- .endm
-
- .macro jumpifarrayequal mem1, mem2, size, address
- .byte 0x2c
- .4byte \mem1
- .4byte \mem2
- .byte \size
- .4byte \address
- .endm
-
- .macro jumpifarraynotequal mem1, mem2, size, address
- .byte 0x2d
- .4byte \mem1
- .4byte \mem2
- .byte \size
- .4byte \address
- .endm
-
- .macro setbyte pointer, value
- .byte 0x2e
- .4byte \pointer
- .byte \value
- .endm
-
- .macro addbyte pointer, value
- .byte 0x2f
- .4byte \pointer
- .byte \value
- .endm
-
- .macro subbyte pointer, value
- .byte 0x30
- .4byte \pointer
- .byte \value
- .endm
-
- .macro copyarray destination, source, size
- .byte 0x31
- .4byte \destination
- .4byte \source
- .byte \size
- .endm
-
- .macro copyarraywithindex param1, param2, param3, byte
- .byte 0x32
- .4byte \param1
- .4byte \param2
- .4byte \param3
- .byte \byte
- .endm
-
- .macro orbyte pointer, value
- .byte 0x33
- .4byte \pointer
- .byte \value
- .endm
-
- .macro orhalfword pointer, value
- .byte 0x34
- .4byte \pointer
- .2byte \value
- .endm
-
- .macro orword pointer, value
- .byte 0x35
- .4byte \pointer
- .4byte \value
- .endm
-
- .macro bicbyte pointer, value
- .byte 0x36
- .4byte \pointer
- .byte \value
- .endm
-
- .macro bichalfword pointer, value
- .byte 0x37
- .4byte \pointer
- .2byte \value
- .endm
-
- .macro bicword pointer, value
- .byte 0x38
- .4byte \pointer
- .4byte \value
- .endm
-
- .macro pause pause_duration
- .byte 0x39
- .2byte \pause_duration
- .endm
-
- .macro waitstate
- .byte 0x3a
- .endm
-
- .macro healthbar_update bank
- .byte 0x3b
- .byte \bank
- .endm
-
- .macro return
- .byte 0x3c
- .endm
-
- .macro end
- .byte 0x3d
- .endm
-
- .macro end2
- .byte 0x3e
- .endm
-
- .macro end3
- .byte 0x3f
- .endm
-
- .macro jumpifaffectedbyprotect address
- .byte 0x40
- .4byte \address
- .endm
-
- .macro call address
- .byte 0x41
- .4byte \address
- .endm
-
- .macro jumpiftype2 bank, type, address
- .byte 0x42
- .byte \bank
- .byte \type
- .4byte \address
- .endm
-
- .macro jumpifabilitypresent ability, address
- .byte 0x43
- .byte \ability
- .4byte \address
- .endm
-
- .macro endselectionscript
- .byte 0x44
- .endm
-
- .macro playanimation bank, animation, var_address
- .byte 0x45
- .byte \bank
- .byte \animation
- .4byte \var_address
- .endm
-
- .macro playanimation2 bank, address, int
- .byte 0x46
- .byte \bank
- .4byte \address
- .4byte \int
- .endm
-
- .macro setgraphicalstatchangevalues
- .byte 0x47
- .endm
-
- .macro playstatchangeanimation bank, color, byte
- .byte 0x48
- .byte \bank
- .byte \color
- .byte \byte
- .endm
-
- .macro moveend byte1, byte2
- .byte 0x49
- .byte \byte1
- .byte \byte2
- .endm
-
- .macro typecalc2
- .byte 0x4a
- .endm
-
- .macro returnatktoball
- .byte 0x4b
- .endm
-
- .macro getswitchedmondata bank
- .byte 0x4c
- .byte \bank
- .endm
-
- .macro switchindataupdate bank
- .byte 0x4d
- .byte \bank
- .endm
-
- .macro switchinanim bank, byte
- .byte 0x4e
- .byte \bank
- .byte \byte
- .endm
-
- .macro jumpifcantswitch bank, address
- .byte 0x4f
- .byte \bank
- .4byte \address
- .endm
-
- .macro openpartyscreen bank, address
- .byte 0x50
- .byte \bank
- .4byte \address
- .endm
-
- .macro switchhandleorder bank, param2
- .byte 0x51
- .byte \bank
- .byte \param2
- .endm
-
- .macro switchineffects bank
- .byte 0x52
- .byte \bank
- .endm
-
- .macro trainerslidein bank
- .byte 0x53
- .byte \bank
- .endm
-
- .macro playse word
- .byte 0x54
- .2byte \word
- .endm
-
- .macro fanfare int
- .byte 0x55
- .2byte \int
- .endm
-
- .macro playfaintcry bank_or_side
- .byte 0x56
- .byte \bank_or_side
- .endm
-
- .macro atk57
- .byte 0x57
- .endm
-
- .macro returntoball bank
- .byte 0x58
- .byte \bank
- .endm
-
- .macro handlelearnnewmove param1, param2, bank_maybe
- .byte 0x59
- .4byte \param1
- .4byte \param2
- .byte \bank_maybe
- .endm
-
- .macro yesnoboxlearnmove address
- .byte 0x5a
- .4byte \address
- .endm
-
- .macro yesnoboxstoplearningmove address
- .byte 0x5b
- .4byte \address
- .endm
-
- .macro hitanimation bank
- .byte 0x5c
- .byte \bank
- .endm
-
- .macro getmoneyreward
- .byte 0x5d
- .endm
-
- .macro atk5e bank
- .byte 0x5e
- .byte \bank
- .endm
-
- .macro atk5f
- .byte 0x5f
- .endm
-
- .macro incrementgamestat byte
- .byte 0x60
- .byte \byte
- .endm
-
- .macro drawpartystatussummary bank_or_side
- .byte 0x61
- .byte \bank_or_side
- .endm
-
- .macro atk62 bank_or_side
- .byte 0x62
- .byte \bank_or_side
- .endm
-
- .macro jumptorandomattack bank
- .byte 0x63
- .byte \bank
- .endm
-
- .macro statusanimation bank
- .byte 0x64
- .byte \bank
- .endm
-
- .macro status2animation bank_or_side, address
- .byte 0x65
- .byte \bank_or_side
- .4byte \address
- .endm
-
- .macro chosenstatusanimation bank_or_side, bank_or_side2, address
- .byte 0x66
- .byte \bank_or_side
- .byte \bank_or_side2
- .4byte \address
- .endm
-
- .macro yesnobox
- .byte 0x67
- .endm
-
- .macro cancelallactions
- .byte 0x68
- .endm
-
- .macro adjustsetdamage
- .byte 0x69
- .endm
-
- .macro removeitem bank
- .byte 0x6a
- .byte \bank
- .endm
-
- .macro atknameinbuff1
- .byte 0x6b
- .endm
-
- .macro drawlvlupbox
- .byte 0x6c
- .endm
-
- .macro resetsentmonsvalue
- .byte 0x6d
- .endm
-
- .macro setatktoplayer0
- .byte 0x6e
- .endm
-
- .macro makevisible bank
- .byte 0x6f
- .byte \bank
- .endm
-
- .macro recordlastability bank
- .byte 0x70
- .byte \bank
- .endm
-
- .macro buffermovetolearn
- .byte 0x71
- .endm
-
- .macro jumpifplayerran address
- .byte 0x72
- .4byte \address
- .endm
-
- .macro hpthresholds bank
- .byte 0x73
- .byte \bank
- .endm
-
- .macro hpthresholds2 bank
- .byte 0x74
- .byte \bank
- .endm
-
- .macro useitemonopponent
- .byte 0x75
- .endm
-
- .macro various bank, byte
- .byte 0x76
- .byte \bank
- .byte \byte
- .endm
-
- .macro setprotectlike
- .byte 0x77
- .endm
-
- .macro faintifabilitynotdamp
- .byte 0x78
- .endm
-
- .macro setatkhptozero
- .byte 0x79
- .endm
-
- .macro jumpifnexttargetvalid address
- .byte 0x7a
- .4byte \address
- .endm
-
- .macro tryhealhalfhealth address, byte
- .byte 0x7b
- .4byte \address
- .byte \byte
- .endm
-
- .macro trymirrormove
- .byte 0x7c
- .endm
-
- .macro setrain
- .byte 0x7d
- .endm
-
- .macro setreflect
- .byte 0x7e
- .endm
-
- .macro setseeded
- .byte 0x7f
- .endm
-
- .macro manipulatedamage id
- .byte 0x80
- .byte \id
- .endm
-
- .macro trysetrest address
- .byte 0x81
- .4byte \address
- .endm
-
- .macro jumpifnotfirstturn address
- .byte 0x82
- .4byte \address
- .endm
-
- .macro nop
- .byte 0x83
- .endm
-
- .macro jumpifcantmakeasleep address
- .byte 0x84
- .4byte \address
- .endm
-
- .macro stockpile
- .byte 0x85
- .endm
-
- .macro stockpiletobasedamage address
- .byte 0x86
- .4byte \address
- .endm
-
- .macro stockpiletohpheal address
- .byte 0x87
- .4byte \address
- .endm
-
- .macro negativedamage
- .byte 0x88
- .endm
-
- .macro statbuffchange target, address
- .byte 0x89
- .byte \target
- .4byte \address
- .endm
-
- .macro normalisebuffs
- .byte 0x8a
- .endm
-
- .macro setbide
- .byte 0x8b
- .endm
-
- .macro confuseifrepeatingattackends
- .byte 0x8c
- .endm
-
- .macro setmultihitcounter count
- .byte 0x8d
- .byte \count
- .endm
-
- .macro initmultihitstring
- .byte 0x8e
- .endm
-
- .macro forcerandomswitch address
- .byte 0x8f
- .4byte \address
- .endm
-
- .macro tryconversiontypechange address
- .byte 0x90
- .4byte \address
- .endm
-
- .macro givepaydaymoney
- .byte 0x91
- .endm
-
- .macro setlightscreen
- .byte 0x92
- .endm
-
- .macro tryKO address
- .byte 0x93
- .4byte \address
- .endm
-
- .macro damagetohalftargethp
- .byte 0x94
- .endm
-
- .macro setsandstorm
- .byte 0x95
- .endm
-
- .macro weatherdamage
- .byte 0x96
- .endm
-
- .macro tryinfatuating address
- .byte 0x97
- .4byte \address
- .endm
-
- .macro updatestatusicon byte
- .byte 0x98
- .byte \byte
- .endm
-
- .macro setmist
- .byte 0x99
- .endm
-
- .macro setfocusenergy
- .byte 0x9a
- .endm
-
- .macro transformdataexecution
- .byte 0x9b
- .endm
-
- .macro setsubstitute
- .byte 0x9c
- .endm
-
- .macro mimicattackcopy address
- .byte 0x9d
- .4byte \address
- .endm
-
- .macro metronome
- .byte 0x9e
- .endm
-
- .macro dmgtolevel
- .byte 0x9f
- .endm
-
- .macro psywavedamageeffect
- .byte 0xa0
- .endm
-
- .macro counterdamagecalculator address
- .byte 0xa1
- .4byte \address
- .endm
-
- .macro mirrorcoatdamagecalculator address
- .byte 0xa2
- .4byte \address
- .endm
-
- .macro disablelastusedattack address
- .byte 0xa3
- .4byte \address
- .endm
-
- .macro trysetencore address
- .byte 0xa4
- .4byte \address
- .endm
-
- .macro painsplitdmgcalc address
- .byte 0xa5
- .4byte \address
- .endm
-
- .macro settypetorandomresistance address
- .byte 0xa6
- .4byte \address
- .endm
-
- .macro setalwayshitflag
- .byte 0xa7
- .endm
-
- .macro copymovepermanently address
- .byte 0xa8
- .4byte \address
- .endm
-
- .macro trychoosesleeptalkmove address
- .byte 0xa9
- .4byte \address
- .endm
-
- .macro setdestinybond
- .byte 0xaa
- .endm
-
- .macro trysetdestinybondtohappen
- .byte 0xab
- .endm
-
- .macro remaininghptopower
- .byte 0xac
- .endm
-
- .macro tryspiteppreduce address
- .byte 0xad
- .4byte \address
- .endm
-
- .macro healpartystatus
- .byte 0xae
- .endm
-
- .macro cursetarget address
- .byte 0xaf
- .4byte \address
- .endm
-
- .macro trysetspikes address
- .byte 0xb0
- .4byte \address
- .endm
-
- .macro setforesight
- .byte 0xb1
- .endm
-
- .macro trysetperishsong address
- .byte 0xb2
- .4byte \address
- .endm
-
- .macro rolloutdamagecalculation
- .byte 0xb3
- .endm
-
- .macro jumpifconfusedandstatmaxed bank, address
- .byte 0xb4
- .byte \bank
- .4byte \address
- .endm
-
- .macro furycuttercalc
- .byte 0xb5
- .endm
-
- .macro happinesstodamagecalculation
- .byte 0xb6
- .endm
-
- .macro presentdamagecalculation
- .byte 0xb7
- .endm
-
- .macro setsafeguard
- .byte 0xb8
- .endm
-
- .macro magnitudedamagecalculation
- .byte 0xb9
- .endm
-
- .macro jumpifnopursuitswitchdmg address
- .byte 0xba
- .4byte \address
- .endm
-
- .macro setsunny
- .byte 0xbb
- .endm
-
- .macro maxattackhalvehp address
- .byte 0xbc
- .4byte \address
- .endm
-
- .macro copyfoestats address
- .byte 0xbd
- .4byte \address
- .endm
-
- .macro rapidspinfree
- .byte 0xbe
- .endm
-
- .macro setdefensecurlbit
- .byte 0xbf
- .endm
-
- .macro recoverbasedonsunlight address
- .byte 0xc0
- .4byte \address
- .endm
-
- .macro hiddenpowercalc
- .byte 0xc1
- .endm
-
- .macro selectfirstvalidtarget
- .byte 0xc2
- .endm
-
- .macro trysetfutureattack address
- .byte 0xc3
- .4byte \address
- .endm
-
- .macro trydobeatup address1, address2
- .byte 0xc4
- .4byte \address1
- .4byte \address2
- .endm
-
- .macro setsemiinvulnerablebit
- .byte 0xc5
- .endm
-
- .macro clearsemiinvulnerablebit
- .byte 0xc6
- .endm
-
- .macro setminimize
- .byte 0xc7
- .endm
-
- .macro sethail
- .byte 0xc8
- .endm
-
- .macro jumpifattackandspecialattackcannotfall address
- .byte 0xc9
- .4byte \address
- .endm
-
- .macro setforcedtarget
- .byte 0xca
- .endm
-
- .macro setcharge
- .byte 0xcb
- .endm
-
- .macro callterrainattack
- .byte 0xcc
- .endm
-
- .macro cureifburnedparalysedorpoisoned address
- .byte 0xcd
- .4byte \address
- .endm
-
- .macro settorment address
- .byte 0xce
- .4byte \address
- .endm
-
- .macro jumpifnodamage address
- .byte 0xcf
- .4byte \address
- .endm
-
- .macro settaunt address
- .byte 0xd0
- .4byte \address
- .endm
-
- .macro trysethelpinghand address
- .byte 0xd1
- .4byte \address
- .endm
-
- .macro tryswapitems address
- .byte 0xd2
- .4byte \address
- .endm
-
- .macro trycopyability address
- .byte 0xd3
- .4byte \address
- .endm
-
- .macro trywish byte, address
- .byte 0xd4
- .byte \byte
- .4byte \address
- .endm
-
- .macro trysetroots address
- .byte 0xd5
- .4byte \address
- .endm
-
- .macro doubledamagedealtifdamaged
- .byte 0xd6
- .endm
-
- .macro setyawn address
- .byte 0xd7
- .4byte \address
- .endm
-
- .macro setdamagetohealthdifference address
- .byte 0xd8
- .4byte \address
- .endm
-
- .macro scaledamagebyhealthratio
- .byte 0xd9
- .endm
-
- .macro tryswapabilities address
- .byte 0xda
- .4byte \address
- .endm
-
- .macro tryimprision address
- .byte 0xdb
- .4byte \address
- .endm
-
- .macro trysetgrudge address
- .byte 0xdc
- .4byte \address
- .endm
-
- .macro weightdamagecalculation
- .byte 0xdd
- .endm
-
- .macro assistattackselect address
- .byte 0xde
- .4byte \address
- .endm
-
- .macro trysetmagiccoat address
- .byte 0xdf
- .4byte \address
- .endm
-
- .macro trysetsnatch address
- .byte 0xe0
- .4byte \address
- .endm
-
- .macro trygetintimidatetarget address
- .byte 0xe1
- .4byte \address
- .endm
-
- .macro switchoutabilities bank
- .byte 0xe2
- .byte \bank
- .endm
-
- .macro jumpifhasnohp bank, address
- .byte 0xe3
- .byte \bank
- .4byte \address
- .endm
-
- .macro getsecretpowereffect
- .byte 0xe4
- .endm
-
- .macro pickup
- .byte 0xe5
- .endm
-
- .macro docastformchangeanimation
- .byte 0xe6
- .endm
-
- .macro trycastformdatachange
- .byte 0xe7
- .endm
-
- .macro settypebasedhalvers address
- .byte 0xe8
- .4byte \address
- .endm
-
- .macro setweatherballtype
- .byte 0xe9
- .endm
-
- .macro tryrecycleitem address
- .byte 0xea
- .4byte \address
- .endm
-
- .macro settypetoterrain address
- .byte 0xeb
- .4byte \address
- .endm
-
- .macro pursuitrelated address
- .byte 0xec
- .4byte \address
- .endm
-
- .macro snatchsetbanks
- .byte 0xed
- .endm
-
- .macro removelightscreenreflect
- .byte 0xee
- .endm
-
- .macro handleballthrow
- .byte 0xef
- .endm
-
- .macro givecaughtmon
- .byte 0xf0
- .endm
-
- .macro trysetcaughtmondexflags address
- .byte 0xf1
- .4byte \address
- .endm
-
- .macro displaydexinfo
- .byte 0xf2
- .endm
-
- .macro trygivecaughtmonnick address
- .byte 0xf3
- .4byte \address
- .endm
-
- .macro subattackerhpbydmg
- .byte 0xf4
- .endm
-
- .macro removeattackerstatus1
- .byte 0xf5
- .endm
-
- .macro finishaction
- .byte 0xf6
- .endm
-
- .macro finishturn
- .byte 0xf7
- .endm
-
- .macro trainerslideout bank
- .byte 0xf8
- .byte \bank
- .endm
-
-@ various command changed to more readable macros
- .macro cancelmultiturnmoves bank
- various \bank, VARIOUS_CANCEL_MULTI_TURN_MOVES
- .endm
-
- .macro setmagiccoattarget bank
- various \bank, VARIOUS_SET_MAGIC_COAT_TARGET
- .endm
-
- .macro getifcantrunfrombattle bank
- various \bank, VARIOUS_IS_RUNNING_IMPOSSIBLE
- .endm
-
- .macro getmovetarget bank
- various \bank, VARIOUS_GET_MOVE_TARGET
- .endm
-
- .macro various4 bank
- various \bank, 4
- .endm
-
- .macro resetintrimidatetracebits bank
- various \bank, VARIOUS_RESET_INTIMIDATE_TRACE_BITS
- .endm
-
- .macro updatechoicemoveonlvlup bank
- various \bank, VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP
- .endm
-
- .macro various7 bank
- various \bank, 7
- .endm
-
- .macro various8 bank
- various \bank, 8
- .endm
-
- .macro various9 bank
- various \bank, 9
- .endm
-
- .macro various10 bank
- various \bank, 10
- .endm
-
- .macro various11 bank
- various \bank, 11
- .endm
-
- .macro various12 bank
- various \bank, 12
- .endm
-
- .macro forfeityesnobox bank
- various \bank, VARIOUS_EMIT_YESNOBOX
- .endm
-
- .macro various14 bank
- various \bank, 14
- .endm
-
- .macro various15 bank
- various \bank, 15
- .endm
-
- .macro various16 bank
- various \bank, 16
- .endm
-
- .macro various17 bank
- various \bank, 17
- .endm
-
- .macro waitcry bank
- various \bank, VARIOUS_WAIT_CRY
- .endm
-
- .macro returnopponentmon1toball bank
- various \bank, VARIOUS_RETURN_OPPONENT_MON1
- .endm
-
- .macro returnopponentmon2toball bank
- various \bank, VARIOUS_RETURN_OPPONENT_MON2
- .endm
-
- .macro various21 bank
- various \bank, 21
- .endm
-
- .macro various22 bank
- various \bank, 22
- .endm
-
- .macro various23 bank
- various \bank, 23
- .endm
-
- .macro various24 bank
- various \bank, 24
- .endm
-
- .macro setoutcomeonteleport bank
- various \bank, VARIOUS_SET_TELEPORT_OUTCOME
- .endm
-
- .macro playtrainerdefeatbgm bank
- various \bank, VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC
- .endm
-
-@ helpful macros
- .macro setstatchanger stat, stages, down
- setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7
- .endm
-
- .macro setmoveeffect effect
- setbyte cEFFECT_CHOOSER \effect
- .endm
-
- .macro chosenstatus1animation bank, status
- chosenstatusanimation \bank 0x0 \status
- .endm
-
- .macro chosenstatus2animation bank, status
- chosenstatusanimation \bank 0x1 \status
- .endm
-
- .macro sethword dst, value
- setbyte \dst, \value & 0xFF
- setbyte \dst + 1, (\value >> 8) & 0xFF
- .endm
-
- .macro setword dst, value
- setbyte \dst, \value & 0xFF
- setbyte \dst + 1, (\value >> 8) & 0xFF
- setbyte \dst + 2, (\value >> 16) & 0xFF
- setbyte \dst + 3, (\value >> 24) & 0xFF
- .endm
-
- .macro copybyte dst, src
- copyarray \dst, \src, 0x1
- .endm
-
- .macro copyhword dst, src
- copyarray \dst, \src, 0x2
- .endm
-
- .macro copyword dst, src
- copyarray \dst, \src, 0x4
- .endm
-
- .macro jumpifbytenotequal byte1, byte2, jumpptr
- jumpifarraynotequal \byte1, \byte2, 0x1, \jumpptr
- .endm
-
- .macro jumpifbyteequal byte1, byte2, jumpptr
- jumpifarrayequal \byte1, \byte2, 0x1, \jumpptr
- .endm
-
- .macro jumpifmove move, jumpptr
- jumpifhalfword EQUAL, gCurrentMove, \move, \jumpptr
- .endm
-
- .macro jumpifnotmove move, jumpptr
- jumpifhalfword NOT_EQUAL, gCurrentMove, \move, \jumpptr
- .endm
-
- .macro jumpifstatus3 bank, status, jumpptr
- jumpifstatus3condition \bank, \status, 0x0, \jumpptr
- .endm
-
- .macro jumpifnostatus3 bank, status, jumpptr
- jumpifstatus3condition \bank, \status, 0x1, \jumpptr
- .endm
-
- .macro jumpifmovehadnoeffect jumpptr
- jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, \jumpptr
- .endm
-
- .macro jumpifbattletype flags, jumpptr
- jumpifhalfword COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr
- .endm
-
- .macro jumpifnotbattletype flags, jumpptr
- jumpifhalfword NO_COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr
- .endm
diff --git a/asm/macros/contest_ai_script.inc b/asm/macros/contest_ai_script.inc
deleted file mode 100644
index 05d70e351..000000000
--- a/asm/macros/contest_ai_script.inc
+++ /dev/null
@@ -1,506 +0,0 @@
-@ Add a positive/negative value to the score of the move being evaluated.
-
- .macro score score
- .byte 0x00
- .byte \score
- .endm
-
-@ turn (AKA "Appeal No.")
-
- .macro get_turn
- .byte 0x01
- .endm
-
- .macro if_turn_less_than param, addr
- .byte 0x02
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_turn_more_than param, addr
- .byte 0x03
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_turn_eq param, addr
- .byte 0x04
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_turn_not_eq param, addr
- .byte 0x05
- .byte \param
- .4byte \addr
- .endm
-
-@ audience excitement
-
- .macro get_excitement
- .byte 0x06
- .endm
-
- .macro if_excitement_less_than param, addr
- .byte 0x07
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_excitement_more_than param, addr
- .byte 0x08
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_excitement_eq param, addr
- .byte 0x09
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_excitement_not_eq param, addr
- .byte 0x0A
- .byte \param
- .4byte \addr
- .endm
-
-@ the order that the user goes in the current turn
-
- .macro get_user_order
- .byte 0x0B
- .endm
-
- .macro if_user_order_less_than param addr
- .byte 0x0C
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_user_order_more_than param addr
- .byte 0x0D
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_user_order_eq param addr
- .byte 0x0E
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_user_order_not_eq param addr
- .byte 0x0F
- .byte \param
- .4byte \addr
- .endm
-
-@ user condition
-
- .macro get_user_condition
- .byte 0x10
- .endm
-
- .macro if_user_condition_less_than param, addr
- .byte 0x11
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_user_condition_more_than param, addr
- .byte 0x12
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_user_condition_eq param, addr
- .byte 0x13
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_user_condition_not_eq param, addr
- .byte 0x14
- .byte \param
- .4byte \addr
- .endm
-
-@ 15
-@ 16
-@ 17
-@ 18
-@ 19
-@ 1A
-@ 1B
-@ 1C
-@ 1D
-@ 1E
-
-@ contest type
-
- .macro get_contest_type
- .byte 0x1F
- .endm
-
- .macro if_contest_type_eq param, addr
- .byte 0x20
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_contest_type_not_eq param, addr
- .byte 0x21
- .byte \param
- .4byte \addr
- .endm
-
-@ move excitement (change in excitement due to move)
-
- .macro get_move_excitement
- .byte 0x22
- .endm
-
- .macro if_move_excitement_less_than param, addr
- .byte 0x23
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_move_excitement_more_than param, addr
- .byte 0x24
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_move_excitement_eq param, addr
- .byte 0x25
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_move_excitement_not_eq param, addr
- .byte 0x26
- .byte \param
- .4byte \addr
- .endm
-
-@ move effect
-
- .macro get_effect
- .byte 0x27
- .endm
-
- .macro if_effect_eq param, addr
- .byte 0x28
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_effect_not_eq param, addr
- .byte 0x29
- .byte \param
- .4byte \addr
- .endm
-
-@ move effect type
-
- .macro get_effect_type
- .byte 0x2A
- .endm
-
- .macro if_effect_type_eq param, addr
- .byte 0x2B
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_effect_type_not_eq param, addr
- .byte 0x2C
- .byte \param
- .4byte \addr
- .endm
-
-@ whether the current move is the most appealing in the user's moveset
-
- .macro check_most_appealing_move
- .byte 0x2D
- .endm
-
- .macro if_most_appealing_move addr
- .byte 0x2E
- .4byte \addr
- .endm
-
-@ 2F
-@ 30
-@ 31
-@ 32
-@ 33
-@ 34
-@ 35
-@ 36
-@ 37
-@ 38
-@ 39
-@ 3A
-
-@ number of times current move has been used
-
- .macro get_move_used_count
- .byte 0x3B
- .endm
-
- .macro if_move_used_count_less_than param, addr
- .byte 0x3C
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_move_used_count_more_than param, addr
- .byte 0x3D
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_move_used_count_eq param, addr
- .byte 0x3E
- .byte \param
- .4byte \addr
- .endm
-
- .macro if_move_used_count_not_eq param, addr
- .byte 0x3F
- .byte \param
- .4byte \addr
- .endm
-
-@ whether the current move is a combo starter (with another move in the moveset)
-
- .macro check_combo_starter
- .byte 0x40
- .endm
-
- .macro if_combo_starter addr
- .byte 0x41
- .4byte \addr
- .endm
-
- .macro if_not_combo_starter addr
- .byte 0x42
- .4byte \addr
- .endm
-
-@ whether the current move is a combo finisher (with another move in the moveset)
-
- .macro check_combo_finisher
- .byte 0x43
- .endm
-
- .macro if_combo_finisher addr
- .byte 0x44
- .4byte \addr
- .endm
-
- .macro if_not_combo_finisher addr
- .byte 0x45
- .4byte \addr
- .endm
-
-@ whether the current move would finish a combo
-
- .macro check_would_finish_combo
- .byte 0x46
- .endm
-
- .macro if_would_finish_combo addr
- .byte 0x47
- .4byte \addr
- .endm
-
- .macro if_would_not_finish_combo addr
- .byte 0x48
- .4byte \addr
- .endm
-
-@ condition of mon (indexed by order)
-
- .macro get_condition mon
- .byte 0x49
- .byte \mon
- .endm
-
- .macro if_condition_less_than mon, value, addr
- .byte 0x4A
- .byte \mon
- .byte \value
- .4byte \addr
- .endm
-
- .macro if_condition_more_than mon, value, addr
- .byte 0x4B
- .byte \mon
- .byte \value
- .4byte \addr
- .endm
-
- .macro if_condition_eq mon, value, addr
- .byte 0x4C
- .byte \mon
- .byte \value
- .4byte \addr
- .endm
-
- .macro if_condition_not_eq mon, value, addr
- .byte 0x4D
- .byte \mon
- .byte \value
- .4byte \addr
- .endm
-
-@ whether the mon used a combo starter move
-@ Even though this value is always 1 or 0 (i.e. TRUE/FALSE),
-@ there are less-than and greater-than comparison operations for some reason.
-
- .macro get_used_combo_starter mon
- .byte 0x4E
- .byte \mon
- .endm
-
- .macro if_used_combo_starter_less_than mon, value, addr
- .byte 0x4F
- .byte \mon
- .byte \value
- .4byte \addr
- .endm
-
- .macro if_used_combo_starter_more_than mon, value, addr
- .byte 0x50
- .byte \mon
- .byte \value
- .4byte \addr
- .endm
-
-
- .macro if_used_combo_starter_eq mon, value, addr
- .byte 0x51
- .byte \mon
- .byte \value
- .4byte \addr
- .endm
-
- .macro if_used_combo_starter_not_eq mon, value, addr
- .byte 0x52
- .byte \mon
- .byte \value
- .4byte \addr
- .endm
-
-@ whether the mon can make an appeal
-
- .macro check_can_participate mon
- .byte 0x53
- .byte \mon
- .endm
-
- .macro if_can_participate mon, addr
- .byte 0x54
- .byte \mon
- .4byte \addr
- .endm
-
- .macro if_cannot_participate mon, addr
- .byte 0x55
- .byte \mon
- .4byte \addr
- .endm
-
-@ 56
-@ 57
-
- .macro contest_58 param addr
- .byte 0x58
- .byte \param
- .4byte \addr
- .endm
-
-@ 59
-@ 5A
-@ 5B
-@ 5C
-@ 5D
-@ 5E
-@ 5F
-@ 60
-@ 61
-@ 62
-@ 63
-@ 64
-@ 65
-@ 66
-@ 67
-@ 68
-@ 69
-@ 6A
-@ 6B
-@ 6C
-@ 6D
-@ 6E
-@ 6F
-@ 70
-@ 71
-@ 72
-@ 73
-@ 74
-@ 75
-@ 76
-@ 77
-@ 78
-@ 79
-@ 7A
-@ 7B
-@ 7C
-
- .macro if_random param addr
- .byte 0x7D
- .byte \param
- .4byte \addr
- .endm
-
-@ 7E
-
- .macro jump addr
- .byte 0x7F
- .4byte \addr
- .endm
-
- .macro call addr
- .byte 0x80
- .4byte \addr
- .endm
-
- .macro end
- .byte 0x81
- .endm
-
- .macro check_user_has_exciting_move
- .byte 0x82
- .endm
-
- .macro if_user_has_exciting_move addr
- .byte 0x83
- .4byte \addr
- .endm
-
- .macro if_user_doesnt_have_exciting_move addr
- .byte 0x84
- .4byte \addr
- .endm
-
-@ 85
-@ 86
-
- .macro if_effect_in_user_moveset param addr
- .byte 0x87
- .2byte \param
- .4byte \addr
- .endm
diff --git a/asm/macros/ec.inc b/asm/macros/ec.inc
deleted file mode 100644
index d3fd45c2f..000000000
--- a/asm/macros/ec.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-
- .macro ec_duplicates count
- .2byte 0xff00 + \count
- .endm
-
- .macro ec_words_by_letter label
- .2byte (gEasyChatWordsByLetter_\label - gEasyChatWordsAlphabetized) / 2
- .endm
diff --git a/asm/macros/event.inc b/asm/macros/event.inc
deleted file mode 100644
index fcbd3a055..000000000
--- a/asm/macros/event.inc
+++ /dev/null
@@ -1,1481 +0,0 @@
- @ Does nothing.
- .macro nop
- .byte 0x00
- .endm
-
- @ Does nothing.
- .macro nop1
- .byte 0x01
- .endm
-
- @ Terminates script execution.
- .macro end
- .byte 0x02
- .endm
-
- @ Jumps back to after the last-executed call statement, and continues script execution from there.
- .macro return
- .byte 0x03
- .endm
-
- @ Jumps to destination and continues script execution from there. The location of the calling script is remembered and can be returned to later.
- .macro call destination
- .byte 0x04
- .4byte \destination
- .endm
-
- @ Jumps to destination and continues script execution from there.
- .macro goto destination
- .byte 0x05
- .4byte \destination
- .endm
-
- @ If the result of the last comparison matches condition (see Comparison operators), jumps to destination and continues script execution from there.
- .macro goto_if condition, destination
- .byte 0x06
- .byte \condition
- .4byte \destination
- .endm
-
- @ If the result of the last comparison matches condition (see Comparison operators), calls destination.
- .macro call_if condition, destination
- .byte 0x07
- .byte \condition
- .4byte \destination
- .endm
-
- @ Jumps to the standard function at index function.
- .macro gotostd function
- .byte 0x08
- .byte \function
- .endm
-
- @ Calls the standard function at index function.
- .macro callstd function
- .byte 0x09
- .byte \function
- .endm
-
- @ If the result of the last comparison matches condition (see Comparison operators), jumps to the standard function at index function.
- .macro gotostd_if condition, function
- .byte 0x0a
- .byte \condition
- .byte \function
- .endm
-
- @ If the result of the last comparison matches condition (see Comparison operators), calls the standard function at index function.
- .macro callstd_if condition, function
- .byte 0x0b
- .byte \condition
- .byte \function
- .endm
-
- @ Executes a script stored in a default RAM location.
- .macro gotoram
- .byte 0x0c
- .endm
-
- @ Terminates script execution and "resets the script RAM".
- .macro killscript
- .byte 0x0d
- .endm
-
- @ Sets some status related to Mystery Event.
- .macro setmysteryeventstatus value
- .byte 0x0e
- .byte \value
- .endm
-
- @ Sets the specified script bank to value.
- .macro loadword destination, value
- .byte 0x0f
- .byte \destination
- .4byte \value
- .endm
-
- @ Sets the specified script bank to value.
- .macro loadbyte destination, value
- .byte 0x10
- .byte \destination
- .byte \value
- .endm
-
- @ Sets the byte at offset to value.
- .macro writebytetoaddr value, offset
- .byte 0x11
- .byte \value
- .4byte \offset
- .endm
-
- @ Copies the byte value at source into the specified script bank.
- .macro loadbytefromaddr destination, source
- .byte 0x12
- .byte \destination
- .4byte \source
- .endm
-
- @ Not sure. Judging from XSE's description I think it takes the least-significant byte in bank source and writes it to destination.
- .macro setptrbyte source, destination
- .byte 0x13
- .byte \source
- .4byte \destination
- .endm
-
- @ Copies the contents of bank source into bank destination.
- .macro copylocal destination, source
- .byte 0x14
- .byte \destination
- .byte \source
- .endm
-
- @ Copies the byte at source to destination, replacing whatever byte was previously there.
- .macro copybyte destination, source
- .byte 0x15
- .4byte \destination
- .4byte \source
- .endm
-
- @ Changes the value of destination to value.
- .macro setvar destination, value
- .byte 0x16
- .2byte \destination
- .2byte \value
- .endm
-
- @ Changes the value of destination by adding value to it. Overflow is not prevented (0xFFFF + 1 = 0x0000).
- .macro addvar destination, value
- .byte 0x17
- .2byte \destination
- .2byte \value
- .endm
-
- @ Changes the value of destination by subtracting value to it. Overflow is not prevented (0x0000 - 1 = 0xFFFF).
- .macro subvar destination, value
- .byte 0x18
- .2byte \destination
- .2byte \value
- .endm
-
- @ Copies the value of source into destination.
- .macro copyvar destination, source
- .byte 0x19
- .2byte \destination
- .2byte \source
- .endm
-
- @ If source is not a variable, then this function acts like setvar. Otherwise, it acts like copyvar.
- .macro setorcopyvar destination, source
- .byte 0x1a
- .2byte \destination
- .2byte \source
- .endm
-
- @ Compares the values of script banks a and b, after forcing the values to bytes.
- .macro compare_local_to_local byte1, byte2
- .byte 0x1b
- .byte \byte1
- .byte \byte2
- .endm
-
- @ Compares the least-significant byte of the value of script bank a to a fixed byte value (b).
- .macro compare_local_to_value a, b
- .byte 0x1c
- .byte \a
- .byte \b
- .endm
-
- @ Compares the least-significant byte of the value of script bank a to the byte located at offset b.
- .macro compare_local_to_addr a, b
- .byte 0x1d
- .byte \a
- .4byte \b
- .endm
-
- @ Compares the byte located at offset a to the least-significant byte of the value of script bank b.
- .macro compare_addr_to_local a, b
- .byte 0x1e
- .4byte \a
- .byte \b
- .endm
-
- @ Compares the byte located at offset a to a fixed byte value (b).
- .macro compare_addr_to_value a, b
- .byte 0x1f
- .4byte \a
- .byte \b
- .endm
-
- @ Compares the byte located at offset a to the byte located at offset b.
- .macro compare_addr_to_addr a, b
- .byte 0x20
- .4byte \a
- .4byte \b
- .endm
-
- @ Compares the value of `var` to a fixed word value (b).
- .macro compare_var_to_value var, value
- .byte 0x21
- .2byte \var
- .2byte \value
- .endm
-
- @ Compares the value of `var1` to the value of `var2`.
- .macro compare_var_to_var var1, var2
- .byte 0x22
- .2byte \var1
- .2byte \var2
- .endm
-
- @ Generic compare macro which attempts to deduce argument types based on their values
- @ Any values between 0x4000 to 0x4FFF and 0x8000 to 0x8FFF are considered event variable identifiers
- .macro compare arg1, arg2
- .if (((\arg1) >> 12) == 4 || ((\arg1) >> 12) == 8) && (((\arg2) >> 12) == 4 || ((\arg2) >> 12) == 8)
- compare_var_to_var (\arg1), (\arg2)
- .elseif (((\arg1) >> 12) == 4 || ((\arg1) >> 12) == 8) && ((\arg2) >= -0xFFFF && (\arg2) <= 0xFFFF)
- compare_var_to_value (\arg1), ((\arg2) & 0xFFFF)
- .else
- .error "Invalid arguments for 'compare'"
- .endif
- .endm
-
- @ Calls the native C function stored at `func`.
- .macro callnative func
- .byte 0x23
- .4byte \func
- .endm
-
- @ Replaces the script with the function stored at `func`. Execution returns to the bytecode script when func returns TRUE.
- .macro gotonative func
- .byte 0x24
- .4byte \func
- .endm
-
- @ Calls a special function; that is, a function designed for use by scripts and listed in a table of pointers.
- .macro special function
- .byte 0x25
- .2byte SPECIAL_\function
- .endm
-
- @ Calls a special function. That function's output (if any) will be written to the variable you specify.
- .macro specialvar output, function
- .byte 0x26
- .2byte \output
- .2byte SPECIAL_\function
- .endm
-
- @ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock state, the script will remain blocked indefinitely (essentially a hang).
- .macro waitstate
- .byte 0x27
- .endm
-
- @ Blocks script execution for time (frames? milliseconds?).
- .macro delay time
- .byte 0x28
- .2byte \time
- .endm
-
- @ Sets a to 1.
- .macro setflag a
- .byte 0x29
- .2byte \a
- .endm
-
- @ Sets a to 0.
- .macro clearflag a
- .byte 0x2a
- .2byte \a
- .endm
-
- @ Compares a to 1.
- .macro checkflag a
- .byte 0x2b
- .2byte \a
- .endm
-
- @ Initializes the RTC`s local time offset to the given hour and minute. In FireRed, this command is a nop.
- .macro initclock hour, minute
- .byte 0x2c
- .2byte \hour
- .2byte \minute
- .endm
-
- @ Runs time based events. In FireRed, this command is a nop.
- .macro dodailyevents
- .byte 0x2d
- .endm
-
- @ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG, this command sets those variables to zero.
- .macro gettime
- .byte 0x2e
- .endm
-
- @ Plays the specified (sound_number) sound. Only one sound may play at a time, with newer ones interrupting older ones.
- .macro playse sound_number
- .byte 0x2f
- .2byte \sound_number
- .endm
-
- @ Blocks script execution until the currently-playing sound (triggered by playse) finishes playing.
- .macro waitse
- .byte 0x30
- .endm
-
- @ Plays the specified (fanfare_number) fanfare.
- .macro playfanfare fanfare_number
- .byte 0x31
- .2byte \fanfare_number
- .endm
-
- @ Blocks script execution until all currently-playing fanfares finish.
- .macro waitfanfare
- .byte 0x32
- .endm
-
- @ Plays the specified (song_number) song. The byte is apparently supposed to be 0x00.
- .macro playbgm song_number, unknown
- .byte 0x33
- .2byte \song_number
- .byte \unknown
- .endm
-
- @ Saves the specified (song_number) song to be played later.
- .macro savebgm song_number
- .byte 0x34
- .2byte \song_number
- .endm
-
- @ Crossfades the currently-playing song into the map's default song.
- .macro fadedefaultbgm
- .byte 0x35
- .endm
-
- @ Crossfades the currently-playng song into the specified (song_number) song.
- .macro fadenewbgm song_number
- .byte 0x36
- .2byte \song_number
- .endm
-
- @ Fades out the currently-playing song.
- .macro fadeoutbgm speed
- .byte 0x37
- .byte \speed
- .endm
-
- @ Fades the previously-playing song back in.
- .macro fadeinbgm speed
- .byte 0x38
- .byte \speed
- .endm
-
- @ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF, then the player will instead be sent to (X, Y) on the map.
- .macro warp map, warp, X, Y
- .byte 0x39
- map \map
- .byte \warp
- .2byte \X
- .2byte \Y
- .endm
-
- @ Clone of warp that does not play a sound effect.
- .macro warpsilent map, warp, X, Y
- .byte 0x3a
- map \map
- .byte \warp
- .2byte \X
- .2byte \Y
- .endm
-
- @ Clone of warp that plays a door opening animation before stepping upwards into it.
- .macro warpdoor map, warp, X, Y
- .byte 0x3b
- map \map
- .byte \warp
- .2byte \X
- .2byte \Y
- .endm
-
- @ Warps the player to another map using a hole animation.
- .macro warphole map
- .byte 0x3c
- map \map
- .endm
-
- @ Clone of warp that uses a teleport effect. It is apparently only used in R/S/E.
- .macro warpteleport map, warp, X, Y
- .byte 0x3d
- map \map
- .byte \warp
- .2byte \X
- .2byte \Y
- .endm
-
- @ Sets the warp destination to be used later.
- .macro setwarp map, warp, X, Y
- .byte 0x3e
- map \map
- .byte \warp
- .2byte \X
- .2byte \Y
- .endm
-
- @ Sets the warp destination that a warp to Warp 127 on Map 127.127 will connect to. Useful when a map has warps that need to go to script-controlled locations (i.e. elevators).
- .macro setdynamicwarp map, warp, X, Y
- .byte 0x3f
- map \map
- .byte \warp
- .2byte \X
- .2byte \Y
- .endm
-
- @ Sets the destination that diving or emerging from a dive will take the player to.
- .macro setdivewarp map, warp, X, Y
- .byte 0x40
- map \map
- .byte \warp
- .2byte \X
- .2byte \Y
- .endm
-
- @ Sets the destination that falling into a hole will take the player to.
- .macro setholewarp map, warp, X, Y
- .byte 0x41
- map \map
- .byte \warp
- .2byte \X
- .2byte \Y
- .endm
-
- @ Retrieves the player's zero-indexed X- and Y-coordinates in the map, and stores them in the specified variables.
- .macro getplayerxy X, Y
- .byte 0x42
- .2byte \X
- .2byte \Y
- .endm
-
- @ Retrieves the number of Pokemon in the player's party, and stores that number in variable 0x800D (LASTRESULT).
- .macro getpartysize
- .byte 0x43
- .endm
-
- @ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and variable 0x800D (LASTRESULT) will be set to 0x0001; otherwise, LASTRESULT is set to 0x0000.
- .macro giveitem index, quantity
- .byte 0x44
- .2byte \index
- .2byte \quantity
- .endm
-
- @ Removes quantity of item index from the player's Bag.
- .macro takeitem index, quantity
- .byte 0x45
- .2byte \index
- .2byte \quantity
- .endm
-
- @ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets variable 0x800D (LASTRESULT) to 0x0001 if there is room, or 0x0000 is there is no room.
- .macro checkitemspace index, quantity
- .byte 0x46
- .2byte \index
- .2byte \quantity
- .endm
-
- @ Checks if the player has quantity or more of item index in their Bag. Sets variable 0x800D (LASTRESULT) to 0x0001 if the player has enough of the item, or 0x0000 if they have fewer than quantity of the item.
- .macro checkitem index, quantity
- .byte 0x47
- .2byte \index
- .2byte \quantity
- .endm
-
- @ Checks which Bag pocket the specified (index) item belongs in, and writes the value to variable 0x800D (LASTRESULT). This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
- .macro checkitemtype index
- .byte 0x48
- .2byte \index
- .endm
-
- @ Adds a quantity amount of item index to the player's PC. Both arguments can be variables.
- .macro givepcitem index, quantity
- .byte 0x49
- .2byte \index
- .2byte \quantity
- .endm
-
- @ Checks for quantity amount of item index in the player's PC. Both arguments can be variables.
- .macro checkpcitem index, quantity
- .byte 0x4a
- .2byte \index
- .2byte \quantity
- .endm
-
- @ Adds decoration to the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
- .macro givedecoration decoration
- .byte 0x4b
- .2byte \decoration
- .endm
-
- @ Removes a decoration from the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
- .macro takedecoration decoration
- .byte 0x4c
- .2byte \decoration
- .endm
-
- @ Checks for decoration in the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
- .macro checkdecor decoration
- .byte 0x4d
- .2byte \decoration
- .endm
-
- @ Checks if the player has enough space in their PC to hold decoration. Sets variable 0x800D (LASTRESULT) to 0x0001 if there is room, or 0x0000 is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
- .macro checkdecorspace decoration
- .byte 0x4e
- .2byte \decoration
- .endm
-
- @ Applies the movement data at movements to the specified (index) Object event. Also closes any standard message boxes that are still open.
- @ This command in fact uses variables to access the Object event ID. So, for example, if you setvar 0x8000 to 0x3, and then use applymovementpos 0x8000 @move1, Object event 3 will have the movements at @move1 applied to them.
- .macro applymovement index, movements, mapGroup, mapNum
- .ifb \mapGroup
- .byte 0x4f
- .2byte \index
- .4byte \movements
- .else
- .byte 0x50
- .2byte \index
- .4byte \movements
- .byte \mapGroup
- .byte \mapNum
- .endif
- .endm
-
- @ Blocks script execution until the movements being applied to the specified (index) Object event finish. If the specified Object event is 0x0000, then the command will block script execution until all Object events affected by applymovement finish their movements. If the specified Object event is not currently being manipulated with applymovement, then this command does nothing.
- .macro waitmovement index, mapBank, mapNum
- .ifb \mapBank
- .byte 0x51
- .2byte \index
- .else
- .byte 0x52
- .2byte \index
- .byte \mapBank
- .byte \mapNum
- .endif
- .endm
-
- @ Attempts to hide the specified (local_ID, a local ID) Object event on the specified map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
- @ If no map is specified, then the current map is used
- .macro removeobject localId, mapGroup, mapNum
- .ifb \mapGroup
- .byte 0x53
- .2byte \localId
- .else
- .byte 0x54
- .2byte \localId
- .byte \mapGroup
- .byte \mapNum
- .endif
- .endm
-
- .macro addobject localId, mapGroup, mapNum
- .ifb \mapGroup
- .byte 0x55
- .2byte \localId
- .else
- .byte 0x56
- .2byte \localId
- .byte \mapGroup
- .byte \mapNum
- .endif
- .endm
-
- @ Sets the specified (index) Object's position on the current map.
- .macro setobjectxy index, x, y
- .byte 0x57
- .2byte \index
- .2byte \x
- .2byte \y
- .endm
-
- .macro showobjectat index, map
- .byte 0x58
- .2byte \index
- map \map
- .endm
-
- .macro hideobjectat index, map
- .byte 0x59
- .2byte \index
- map \map
- .endm
-
- @ If the script was called by a Object event, then that Object will turn to face toward the tile that the player is stepping off of.
- .macro faceplayer
- .byte 0x5a
- .endm
-
- .macro turnobject index, direction
- .byte 0x5b
- .2byte \index
- .byte \direction
- .endm
-
- @ If the Trainer flag for Trainer index is not set, this command does absolutely nothing.
- .macro trainerbattle type, trainer, word, pointer1, pointer2, pointer3, pointer4
- .byte 0x5c
- .byte \type
- .2byte \trainer
- .2byte \word
- .if \type == 0
- .4byte \pointer1 @ text
- .4byte \pointer2 @ text
- .elseif \type == 1
- .4byte \pointer1 @ text
- .4byte \pointer2 @ text
- .4byte \pointer3 @ event script
- .elseif \type == 2
- .4byte \pointer1 @ text
- .4byte \pointer2 @ text
- .4byte \pointer3 @ event script
- .elseif \type == 3
- .4byte \pointer1 @ text
- .elseif \type == 4
- .4byte \pointer1 @ text
- .4byte \pointer2 @ text
- .4byte \pointer3 @ text
- .elseif \type == 5
- .4byte \pointer1 @ text
- .4byte \pointer2 @ text
- .elseif \type == 6
- .4byte \pointer1 @ text
- .4byte \pointer2 @ text
- .4byte \pointer3 @ text
- .4byte \pointer4 @ event script
- .elseif \type == 7
- .4byte \pointer1 @ text
- .4byte \pointer2 @ text
- .4byte \pointer3 @ text
- .elseif \type == 8
- .4byte \pointer1 @ text
- .4byte \pointer2 @ text
- .4byte \pointer3 @ text
- .4byte \pointer4 @ event script
- .endif
- .endm
-
- @ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes.
- .macro trainerbattlebegin
- .byte 0x5d
- .endm
-
- @ Goes to address after the trainerbattle command (called by the battle functions, see battle_setup.c)
- .macro gotopostbattlescript
- .byte 0x5e
- .endm
-
- @ Goes to address specified in the trainerbattle command (called by the battle functions, see battle_setup.c)
- .macro gotobeatenscript
- .byte 0x5f
- .endm
-
- @ Compares Flag (trainer + 0x500) to 1. (If the flag is set, then the trainer has been defeated by the player.)
- .macro checktrainerflag trainer
- .byte 0x60
- .2byte \trainer
- .endm
-
- @ Sets Flag (trainer + 0x500).
- .macro settrainerflag trainer
- .byte 0x61
- .2byte \trainer
- .endm
-
- @ Clears Flag (trainer + 0x500).
- .macro cleartrainerflag trainer
- .byte 0x62
- .2byte \trainer
- .endm
-
- .macro setobjectxyperm index, x, y
- .byte 0x63
- .2byte \index
- .2byte \x
- .2byte \y
- .endm
-
- .macro moveobjectoffscreen index
- .byte 0x64
- .2byte \index
- .endm
-
- .macro setobjectmovementtype word, byte
- .byte 0x65
- .2byte \word
- .byte \byte
- .endm
-
- @ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the box and its text have been fully drawn.
- .macro waitmessage
- .byte 0x66
- .endm
-
- @ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at that offset will be loaded and used. If text is script bank 0, then the value of script bank 0 will be treated as a pointer to the text. (You can use loadpointer to place a string pointer in a script bank.)
- .macro message text
- .byte 0x67
- .4byte \text
- .endm
-
- @ Closes the current message box.
- .macro closemessage
- .byte 0x68
- .endm
-
- @ Ceases movement for all Objects on-screen.
- .macro lockall
- .byte 0x69
- .endm
-
- @ If the script was called by an Object, then that Object's movement will cease.
- .macro lock
- .byte 0x6a
- .endm
-
- @ Resumes normal movement for all Objects on-screen, and closes any standard message boxes that are still open.
- .macro releaseall
- .byte 0x6b
- .endm
-
- @ If the script was called by an Object, then that Object's movement will resume. This command also closes any standard message boxes that are still open.
- .macro release
- .byte 0x6c
- .endm
-
- @ Blocks script execution until the player presses any key.
- .macro waitbuttonpress
- .byte 0x6d
- .endm
-
- @ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection. Their selection is stored in variable 0x800D (LASTRESULT); 0x0000 for "NO" or if the user pressed B, and 0x0001 for "YES".
- .macro yesnobox x, y
- .byte 0x6e
- .byte \x
- .byte \y
- .endm
-
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
- .macro multichoice x, y, list, b
- .byte 0x6f
- .byte \x
- .byte \y
- .byte \list
- .byte \b
- .endm
-
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined and the one to be used is specified with list. The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
- .macro multichoicedefault x, y, list, default, b
- .byte 0x70
- .byte \x
- .byte \y
- .byte \list
- .byte \default
- .byte \b
- .endm
-
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined and the one to be used is specified with list. The per_row argument determines how many list items will be shown on a single row of the box.
- .macro multichoicegrid x, y, list, per_row, B
- .byte 0x71
- .byte \x
- .byte \y
- .byte \list
- .byte \per_row
- .byte \B
- .endm
-
- .macro drawbox byte1, byte2, byte3, byte4
- .byte 0x72
- .byte \byte1
- .byte \byte2
- .byte \byte3
- .byte \byte4
- .endm
-
- .macro erasebox byte1, byte2, byte3, byte4
- .byte 0x73
- .byte \byte1
- .byte \byte2
- .byte \byte3
- .byte \byte4
- .endm
-
- .macro drawboxtext byte1, byte2, byte3, byte4
- .byte 0x74
- .byte \byte1
- .byte \byte2
- .byte \byte3
- .byte \byte4
- .endm
-
- @ Displays a box containing the front sprite for the specified (species) Pokemon species.
- .macro drawmonpic species, x, y
- .byte 0x75
- .2byte \species
- .byte \x
- .byte \y
- .endm
-
- @ Hides all boxes displayed with drawmonpic.
- .macro erasemonpic
- .byte 0x76
- .endm
-
- @ Draws an image of the winner of the contest. In FireRed, this command is a nop. (The argument is discarded.)
- .macro drawcontestwinner a
- .byte 0x77
- .byte \a
- .endm
-
- @ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille characters.
- .macro braillemessage text
- .byte 0x78
- .4byte \text
- .endm
-
- @ Gives the player one of the specified (species) Pokemon at level level holding item. The unknown arguments should all be zeroes.
- .macro givemon species, level, item, unknown1, unknown2, unknown3
- .byte 0x79
- .2byte \species
- .byte \level
- .2byte \item
- .4byte \unknown1
- .4byte \unknown2
- .byte \unknown3
- .endm
-
- .macro giveegg species
- .byte 0x7a
- .2byte \species
- .endm
-
- .macro setmonmove index, slot, move
- .byte 0x7b
- .byte \index
- .byte \slot
- .2byte \move
- .endm
-
- @ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, variable 0x800D (LASTRESULT) is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, LASTRESULT is set to 0x0006. Variable 0x8004 is also set to this Pokemon's species.
- .macro checkpartymove index
- .byte 0x7c
- .2byte \index
- .endm
-
- @ Writes the name of the Pokemon at index species to the specified buffer.
- .macro bufferspeciesname out, species
- .byte 0x7d
- .byte \out
- .2byte \species
- .endm
-
- @ Writes the name of the species of the first Pokemon in the player's party to the specified buffer.
- .macro bufferleadmonspeciesname out
- .byte 0x7e
- .byte \out
- .endm
-
- @ Writes the nickname of the Pokemon in slot slot (zero-indexed) of the player's party to the specified buffer. If an empty or invalid slot is specified, ten spaces ("") are written to the buffer.
- .macro bufferpartymonnick out, slot
- .byte 0x7f
- .byte \out
- .2byte \slot
- .endm
-
- @ Writes the name of the item at index item to the specified buffer. If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
- .macro bufferitemname out, item
- .byte 0x80
- .byte \out
- .2byte \item
- .endm
-
- @ Writes the name of the decoration at index decoration to the specified buffer. In FireRed, this command is a nop.
- .macro bufferdecorationname out, decoration
- .byte 0x81
- .byte \out
- .2byte \decoration
- .endm
-
- @ Writes the name of the move at index move to the specified buffer.
- .macro buffermovename out, move
- .byte 0x82
- .byte \out
- .2byte \move
- .endm
-
- @ Converts the value of input to a decimal string, and writes that string to the specified buffer.
- .macro buffernumberstring out, input
- .byte 0x83
- .byte \out
- .2byte \input
- .endm
-
- @ Writes the standard string identified by index to the specified buffer. This command has no protections in place at all, so specifying an invalid standard string (e.x. 0x2B) can and usually will cause data corruption.
- .macro bufferstdstring out, index
- .byte 0x84
- .byte \out
- .2byte \index
- .endm
-
- @ Copies the string at offset to the specified buffer.
- .macro bufferstring out, offset
- .byte 0x85
- .byte \out
- .4byte \offset
- .endm
-
- @ Opens the Pokemart system, offering the specified products for sale.
- .macro pokemart products
- .byte 0x86
- .4byte \products
- .endm
-
- @ Opens the Pokemart system and treats the list of items as decorations.
- .macro pokemartdecoration products
- .byte 0x87
- .4byte \products
- .endm
-
- @ Apparent clone of pokemartdecoration.
- .macro pokemartdecoration2 products
- .byte 0x88
- .4byte \products
- .endm
-
- @ Starts up the slot machine minigame.
- .macro playslotmachine word
- .byte 0x89
- .2byte \word
- .endm
-
- @ Sets a berry tree's specific berry and growth stage. In FireRed, this command is a nop.
- .macro setberrytree tree_id, berry, growth_stage
- .byte 0x8a
- .byte \tree_id
- .byte \berry
- .byte \growth_stage
- .endm
-
- @ This allows you to choose a Pokemon to use in a contest. In FireRed, this command sets the byte at 0x03000EA8 to 0x01.
- .macro choosecontestmon
- .byte 0x8b
- .endm
-
- @ Starts a contest. In FireRed, this command is a nop.
- .macro startcontest
- .byte 0x8c
- .endm
-
- @ Shows the results of a contest. In FireRed, this command is a nop.
- .macro showcontestresults
- .byte 0x8d
- .endm
-
- @ Starts a contest over a link connection. In FireRed, this command is a nop.
- .macro contestlinktransfer
- .byte 0x8e
- .endm
-
- @ Stores a random integer between 0 and limit in variable 0x800D (LASTRESULT).
- .macro random limit
- .byte 0x8f
- .2byte \limit
- .endm
-
- @ If check is 0x00, this command adds value to the player's money.
- .macro givemoney value, check
- .byte 0x90
- .4byte \value
- .byte \check
- .endm
-
- @ If check is 0x00, this command subtracts value from the player's money.
- .macro takemoney value, check
- .byte 0x91
- .4byte \value
- .byte \check
- .endm
-
- @ If check is 0x00, this command will check if the player has value or more money; script variable 0x800D (LASTRESULT) is set to 0x0001 if the player has enough money, or 0x0000 if the do not.
- .macro checkmoney value, check
- .byte 0x92
- .4byte \value
- .byte \check
- .endm
-
- @ Spawns a secondary box showing how much money the player has.
- .macro showmoneybox x, y
- .byte 0x93
- .byte \x
- .byte \y
- .endm
-
- @ Hides the secondary box spawned by showmoney.
- .macro hidemoneybox x, y
- .byte 0x94
- .byte \x
- .byte \y
- .endm
-
- @ Updates the secondary box spawned by showmoney. Consumes but does not use arguments.
- .macro updatemoneybox x, y
- .byte 0x95
- .byte \x
- .byte \y
- .endm
-
- @ Gets the price reduction for the index given. In FireRed, this command is a nop.
- .macro getpricereduction index
- .byte 0x96
- .2byte \index
- .endm
-
- @ Fades the screen to and from black and white. Mode 0x00 fades from black, mode 0x01 fades out to black, mode 0x2 fades in from white, and mode 0x3 fades out to white.
- .macro fadescreen effect
- .byte 0x97
- .byte \effect
- .endm
-
- @ Fades the screen to and from black and white. Mode 0x00 fades from black, mode 0x01 fades out to black, mode 0x2 fades in from white, and mode 0x3 fades out to white. Other modes may exist.
- .macro fadescreenspeed effect, speed
- .byte 0x98
- .byte \effect
- .byte \speed
- .endm
-
- .macro setflashradius word
- .byte 0x99
- .2byte \word
- .endm
-
- .macro animateflash byte
- .byte 0x9a
- .byte \byte
- .endm
-
- .macro messageautoscroll pointer
- .byte 0x9b
- .4byte \pointer
- .endm
-
- @ Executes the specified field move animation.
- .macro dofieldeffect animation
- .byte 0x9c
- .2byte \animation
- .endm
-
- @ Sets up the field effect argument argument with the value value.
- .macro setfieldeffectargument argument, param
- .byte 0x9d
- .byte \argument
- .2byte \param
- .endm
-
- @ Blocks script execution until all playing field move animations complete.
- .macro waitfieldeffect animation
- .byte 0x9e
- .2byte \animation
- .endm
-
- @ Sets which healing place the player will return to if all of the Pokemon in their party faint.
- .macro setrespawn heallocation
- .byte 0x9f
- .2byte \heallocation
- .endm
-
- @ Checks the player's gender. If male, then 0x0000 is stored in variable 0x800D (LASTRESULT). If female, then 0x0001 is stored in LASTRESULT.
- .macro checkplayergender
- .byte 0xa0
- .endm
-
- @ Plays the specified (species) Pokemon's cry. You can use waitcry to block script execution until the sound finishes.
- .macro playmoncry species, effect
- .byte 0xa1
- .2byte \species
- .2byte \effect
- .endm
-
- @ Changes the metatile at (x, y) on the current map.
- .macro setmetatile x, y, metatile_number, tile_attrib
- .byte 0xa2
- .2byte \x
- .2byte \y
- .2byte \metatile_number
- .2byte \tile_attrib
- .endm
-
- @ Queues a weather change to the default weather for the map.
- .macro resetweather
- .byte 0xa3
- .endm
-
- @ Queues a weather change to type weather.
- .macro setweather type
- .byte 0xa4
- .2byte \type
- .endm
-
- @ Executes the weather change queued with resetweather or setweather. The current weather will smoothly fade into the queued weather.
- .macro doweather
- .byte 0xa5
- .endm
-
- @ This command manages cases in which maps have tiles that change state when stepped on (specifically, cracked/breakable floors).
- .macro setstepcallback subroutine
- .byte 0xa6
- .byte \subroutine
- .endm
-
- .macro setmaplayoutindex index
- .byte 0xa7
- .2byte \index
- .endm
-
- .macro setobjectpriority index, map, priority
- .byte 0xa8
- .2byte \index
- map \map
- .byte \priority
- .endm
-
- .macro resetobjectpriority index, map
- .byte 0xa9
- .2byte \index
- map \map
- .endm
-
- .macro createvobject sprite, byte2, x, y, elevation, direction
- .byte 0xaa
- .byte \sprite
- .byte \byte2
- .2byte \x
- .2byte \y
- .byte \elevation
- .byte \direction
- .endm
-
- .macro turnvobject index, direction
- .byte 0xab
- .byte \index
- .byte \direction
- .endm
-
- @ Opens the door metatile at (X, Y) with an animation.
- .macro opendoor x, y
- .byte 0xac
- .2byte \x
- .2byte \y
- .endm
-
- @ Closes the door metatile at (X, Y) with an animation.
- .macro closedoor x, y
- .byte 0xad
- .2byte \x
- .2byte \y
- .endm
-
- @ Waits for the door animation started with opendoor or closedoor to finish.
- .macro waitdooranim
- .byte 0xae
- .endm
-
- @ Sets the door tile at (x, y) to be open without an animation.
- .macro setdooropen x, y
- .byte 0xaf
- .2byte \x
- .2byte \y
- .endm
-
- @ Sets the door tile at (x, y) to be closed without an animation.
- .macro setdoorclosed x, y
- .byte 0xb0
- .2byte \x
- .2byte \y
- .endm
-
- @ In FireRed, this command is a nop.
- .macro addelevmenuitem
- .byte 0xb1
- .endm
-
- @ In FireRed and Emerald, this command is a nop.
- .macro showelevmenu
- .byte 0xb2
- .endm
-
- .macro checkcoins out
- .byte 0xb3
- .2byte \out
- .endm
-
- .macro givecoins count
- .byte 0xb4
- .2byte \count
- .endm
-
- .macro takecoins count
- .byte 0xb5
- .2byte \count
- .endm
-
- @ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect normal wild battles. You start the prepared battle with dowildbattle.
- .macro setwildbattle species, level, item
- .byte 0xb6
- .2byte \species
- .byte \level
- .2byte \item
- .endm
-
- @ Starts a wild battle against the Pokemon generated by setwildbattle. Blocks script execution until the battle finishes.
- .macro dowildbattle
- .byte 0xb7
- .endm
-
- .macro setvaddress long, word
- .byte 0xb8
- .4byte \long
- .2byte \word
- .endm
-
- .macro vgoto pointer
- .byte 0xb9
- .4byte \pointer
- .endm
-
- .macro vcall pointer
- .byte 0xba
- .4byte \pointer
- .endm
-
- .macro vgoto_if byte, pointer
- .byte 0xbb
- .byte \byte
- .4byte \pointer
- .endm
-
- .macro vcall_if byte, pointer
- .byte 0xbc
- .byte \byte
- .4byte \pointer
- .endm
-
- .macro vmessage pointer
- .byte 0xbd
- .4byte \pointer
- .endm
-
- .macro vloadptr pointer
- .byte 0xbe
- .4byte \pointer
- .endm
-
- .macro vbufferstring byte, pointer
- .byte 0xbf
- .byte \byte
- .4byte \pointer
- .endm
-
- @ Spawns a secondary box showing how many Coins the player has.
- .macro showcoinsbox x, y
- .byte 0xc0
- .byte \x
- .byte \y
- .endm
-
- @ Hides the secondary box spawned by showcoins. It consumes its arguments but doesn't use them.
- .macro hidecoinsbox x, y
- .byte 0xc1
- .byte \x
- .byte \y
- .endm
-
- @ Updates the secondary box spawned by showcoins. It consumes its arguments but doesn't use them.
- .macro updatecoinsbox x, y
- .byte 0xc2
- .byte \x
- .byte \y
- .endm
-
- @ Increases the value of the specified game stat by 1. The stat's value will not be allowed to exceed 0x00FFFFFF.
- .macro incrementgamestat stat
- .byte 0xc3
- .byte \stat
- .endm
-
- @ Sets the destination that using an Escape Rope or Dig will take the player to.
- .macro setescapewarp map, warp, x, y
- .byte 0xc4
- map \map
- .byte \warp
- .2byte \x
- .2byte \y
- .endm
-
- @ Blocks script execution until cry finishes.
- .macro waitmoncry
- .byte 0xc5
- .endm
-
- @ Writes the name of the specified (box) PC box to the specified buffer.
- .macro bufferboxname out, box
- .byte 0xc6
- .byte \out
- .2byte \box
- .endm
-
- @ Sets the color of the text in standard message boxes. 0x00 produces blue (male) text, 0x01 produces red (female) text, 0xFF resets the color to the default for the current OW's gender, and all other values produce black text.
- .macro textcolor color
- .byte 0xc7
- .byte \color
- .endm
-
- @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
- .macro loadhelp pointer
- .byte 0xc8
- .4byte \pointer
- .endm
-
- @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
- .macro unloadhelp
- .byte 0xc9
- .endm
-
- @ After using this command, all standard message boxes will use the signpost frame.
- .macro signmsg
- .byte 0xca
- .endm
-
- @ Ends the effects of signmsg, returning message box frames to normal.
- .macro normalmsg
- .byte 0xcb
- .endm
-
- @ Compares the value of a hidden variable to a dword.
- .macro comparehiddenvar a, value
- .byte 0xcc
- .byte \a
- .4byte \value
- .endm
-
-@ Supplementary
-
- .macro goto_if_trainer_not_defeated opponent, dest
- checktrainerflag \opponent
- goto_if 0, \dest
- .endm
-
- .macro goto_if_trainer_defeated opponent, dest
- checktrainerflag \opponent
- goto_if 1, \dest
- .endm
-
- .macro call_if_trainer_not_defeated opponent, dest
- checktrainerflag \opponent
- call_if 0, \dest
- .endm
-
- .macro call_if_trainer_defeated opponent, dest
- checktrainerflag \opponent
- call_if 1, \dest
- .endm
-
- .macro goto_if_unset flag, dest
- checkflag \flag
- goto_if 0, \dest
- .endm
-
- .macro goto_if_set flag, dest
- checkflag \flag
- goto_if 1, \dest
- .endm
-
- .macro goto_if_lt dest @ LESS THAN
- goto_if 0, \dest
- .endm
-
- .macro goto_if_eq dest @ EQUAL
- goto_if 1, \dest
- .endm
-
- .macro goto_if_gt dest @ GREATER THAN
- goto_if 2, \dest
- .endm
-
- .macro goto_if_le dest @ LESS THAN OR EQUAL
- goto_if 3, \dest
- .endm
-
- .macro goto_if_ge dest @ GREATER THAN OR EQUAL
- goto_if 4, \dest
- .endm
-
- .macro goto_if_ne dest @ NOT EQUAL
- goto_if 5, \dest
- .endm
-
- .macro call_if_unset flag, dest
- checkflag \flag
- call_if 0, \dest
- .endm
-
- .macro call_if_set flag, dest
- checkflag \flag
- call_if 1, \dest
- .endm
-
- .macro call_if_lt dest @ LESS THAN
- call_if 0, \dest
- .endm
-
- .macro call_if_eq dest @ EQUAL
- call_if 1, \dest
- .endm
-
- .macro call_if_gt dest @ GREATER THAN
- call_if 2, \dest
- .endm
-
- .macro call_if_le dest @ LESS THAN OR EQUAL
- call_if 3, \dest
- .endm
-
- .macro call_if_ge dest @ GREATER THAN OR EQUAL
- call_if 4, \dest
- .endm
-
- .macro call_if_ne dest @ NOT EQUAL
- call_if 5, \dest
- .endm
-
- .macro switch var
- copyvar VAR_SPECIAL_0, \var
- .endm
-
- .macro case condition, dest
- compare_var_to_value VAR_SPECIAL_0, \condition
- goto_if_eq \dest
- .endm
-
- .macro msgbox text, type=4
- loadword 0, \text
- callstd \type
- .endm
-
- @ Message box types
- MSGBOX_YESNO = 5
-
- YES = 1
- NO = 0
-
- .macro giveitem_std item, amount=1, function=0
- setorcopyvar VAR_SPECIAL_0, \item
- setorcopyvar VAR_SPECIAL_1, \amount
- callstd \function
- .endm
-
- .macro givedecoration_std decoration
- setorcopyvar VAR_SPECIAL_0, \decoration
- callstd 7
- .endm
diff --git a/asm/macros/field_effect_script.inc b/asm/macros/field_effect_script.inc
deleted file mode 100644
index d5895b0ef..000000000
--- a/asm/macros/field_effect_script.inc
+++ /dev/null
@@ -1,42 +0,0 @@
- .macro loadtiles address
- .byte 0
- .4byte \address
- .endm
-
- .macro loadfadedpal address
- .byte 1
- .4byte \address
- .endm
-
- .macro loadpal address
- .byte 2
- .4byte \address
- .endm
-
- .macro callnative address
- .byte 3
- .4byte \address
- .endm
-
- .macro end
- .byte 4
- .endm
-
- .macro loadgfx_callnative tiles_address, palette_address, function_address
- .byte 5
- .4byte \tiles_address
- .4byte \palette_address
- .4byte \function_address
- .endm
-
- .macro loadtiles_callnative tiles_address, function_address
- .byte 6
- .4byte \tiles_address
- .4byte \function_address
- .endm
-
- .macro loadfadedpal_callnative palette_address, function_address
- .byte 7
- .4byte \palette_address
- .4byte \function_address
- .endm
diff --git a/asm/macros/function.inc b/asm/macros/function.inc
deleted file mode 100644
index 67fb373a8..000000000
--- a/asm/macros/function.inc
+++ /dev/null
@@ -1,29 +0,0 @@
- .macro arm_func_start name
- .align 2, 0
- .global \name
- .arm
- .type \name, function
- .endm
-
- .macro arm_func_end name
- .size \name, .-\name
- .endm
-
- .macro thumb_func_start name
- .align 2, 0
- .global \name
- .thumb
- .thumb_func
- .type \name, function
- .endm
-
- .macro non_word_aligned_thumb_func_start name
- .global \name
- .thumb
- .thumb_func
- .type \name, function
- .endm
-
- .macro thumb_func_end name
- .size \name, .-\name
- .endm
diff --git a/asm/macros/m4a.inc b/asm/macros/m4a.inc
deleted file mode 100644
index 6c5abc09b..000000000
--- a/asm/macros/m4a.inc
+++ /dev/null
@@ -1,13 +0,0 @@
- .macro song label, music_player, unknown
- .4byte \label
- .2byte \music_player
- .2byte \unknown
- .endm
-
- .macro music_player info_struct, track_struct, unknown_1, unknown_2
- .4byte \info_struct
- .4byte \track_struct
- .byte \unknown_1
- .space 1
- .2byte \unknown_2
- .endm
diff --git a/asm/macros/map.inc b/asm/macros/map.inc
deleted file mode 100644
index db37d9346..000000000
--- a/asm/macros/map.inc
+++ /dev/null
@@ -1,96 +0,0 @@
- .macro map map_id
- .byte \map_id >> 8 @ map group
- .byte \map_id & 0xFF @ map num
- .endm
-
- .macro map_script type, address
- .byte \type
- .4byte \address
- .endm
-
- .macro map_script_2 word1, word2, address
- .2byte \word1
- .2byte \word2
- .4byte \address
- .endm
-
- .macro object_event byte1, word1, byte2, byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10, byte11, byte12, byte13, byte14, script, word2, byte15, byte16
- .byte \byte1
- .2byte \word1
- .byte \byte2, \byte3, \byte4, \byte5, \byte6, \byte7, \byte8, \byte9, \byte10, \byte11, \byte12, \byte13, \byte14
- .4byte \script
- .2byte \word2
- .byte \byte15, \byte16
- inc _num_npcs
- .endm
-
- .macro warp_def x, y, byte, warp, map_id
- .2byte \x, \y
- .byte \byte, \warp
- .byte \map_id & 0xFF @ map num
- .byte \map_id >> 8 @ map group
- inc _num_warps
- .endm
-
- .macro coord_event x, y, byte1, byte2, word1, word2, word3, script
- .2byte \x, \y
- .byte \byte1, \byte2
- .2byte \word1, \word2, \word3
- .4byte \script
- inc _num_traps
- .endm
-
- .macro coord_weather_event x, y, height, weather
- coord_event \x, \y, \height, 0, \weather, 0, 0, 0x0
- .endm
-
- .macro bg_event x, y, byte, kind, word, arg6, arg7, arg8
- .2byte \x, \y
- .byte \byte, \kind
- .2byte \word
- .if \kind < 5
- .4byte \arg6
- .else
- .2byte \arg6
- .byte \arg7, \arg8
- .endif
- inc _num_signs
- .endm
-
- .macro bg_hidden_item_event x, y, height, item, flag
- bg_event \x, \y, \height, 7, 0, \item, ((\flag) - FLAG_HIDDEN_ITEMS_START), 0
- .endm
-
- .macro bg_secret_base_event x, y, height, secret_base_id
- bg_event \x, \y, \height, 8, 0, \secret_base_id, 0, 0
- .endm
-
- .macro map_events npcs, warps, traps, signs
- .byte _num_npcs, _num_warps, _num_traps, _num_signs
- .4byte \npcs, \warps, \traps, \signs
- reset_map_events
- .endm
-
- .macro reset_map_events
- .set _num_npcs, 0
- .set _num_warps, 0
- .set _num_traps, 0
- .set _num_signs, 0
- .endm
-
- reset_map_events
-
-
- .equiv connection_down, 1
- .equiv connection_up, 2
- .equiv connection_left, 3
- .equiv connection_right, 4
- .equiv connection_dive, 5
- .equiv connection_emerge, 6
-
- .macro connection direction, offset, map, filler
- .4byte connection_\direction
- .4byte \offset
- map \map
- .space 2
- .endm
diff --git a/asm/macros/movement.inc b/asm/macros/movement.inc
deleted file mode 100644
index 674ce7169..000000000
--- a/asm/macros/movement.inc
+++ /dev/null
@@ -1,116 +0,0 @@
- .macro create_movement name
- enum _\name
- .macro \name
- .byte _\name
- .endm
- .endm
-
- enum_start
- create_movement step_00
- create_movement step_01
- create_movement step_02
- create_movement step_03
- create_movement slow_step_down
- create_movement slow_step_up
- create_movement slow_step_left
- create_movement slow_step_right
- create_movement step_down
- create_movement step_up
- create_movement step_left
- create_movement step_right
- create_movement fast_step_down
- create_movement fast_step_up
- create_movement fast_step_left
- create_movement fast_step_right
- create_movement step_10
- create_movement step_11
- create_movement step_12
- create_movement step_13
- create_movement step_14
- create_movement step_15
- create_movement step_16
- create_movement step_17
- create_movement step_18
- create_movement step_19
- create_movement step_1a
- create_movement step_1b
- create_movement step_1c
- create_movement step_1d
- create_movement step_1e
- create_movement step_1f
- create_movement step_20
- create_movement step_21
- create_movement step_22
- create_movement step_23
- create_movement step_24
- create_movement step_25
- create_movement step_26
- create_movement step_27
- create_movement step_28
- create_movement step_29
- create_movement step_2a
- create_movement step_2b
- create_movement step_2c
- create_movement step_2d
- create_movement step_2e
- create_movement step_2f
- create_movement step_30
- create_movement step_31
- create_movement step_32
- create_movement step_33
- create_movement step_34
- create_movement step_35
- create_movement step_36
- create_movement step_37
- create_movement step_38
- create_movement step_39
- create_movement step_3a
- create_movement step_3b
- create_movement step_3c
- create_movement step_3d
- create_movement step_3e
- create_movement step_3f
- create_movement step_40
- create_movement step_41
- create_movement step_42
- create_movement step_43
- create_movement step_44
- create_movement step_45
- create_movement step_46
- create_movement step_47
- create_movement step_48
- create_movement step_49
- create_movement step_4a
- create_movement step_4b
- create_movement step_4c
- create_movement step_4d
- create_movement step_4e
- create_movement step_4f
- create_movement step_50
- create_movement step_51
- create_movement step_52
- create_movement step_53
- create_movement step_54
- create_movement step_55
- create_movement step_56
- create_movement step_57
- create_movement step_58
- create_movement step_59
- create_movement step_5a
- create_movement step_5b
- create_movement step_5c
- create_movement step_5d
- create_movement step_5e
- create_movement step_5f
- create_movement step_60
- create_movement step_61
-
- enum_start 0x91
- create_movement step_91
- create_movement step_92
-
- enum_start 0x96
- create_movement step_96
-
- enum_start 0xfe
- create_movement step_end
diff --git a/asm/macros/music_voice.inc b/asm/macros/music_voice.inc
deleted file mode 100644
index b7a9e7f8d..000000000
--- a/asm/macros/music_voice.inc
+++ /dev/null
@@ -1,125 +0,0 @@
- .macro voice_directsound base_midi_key, pan, sample_data_pointer, attack, decay, sustain, release
- .byte 0
- _voice_directsound \base_midi_key, \pan, \sample_data_pointer, \attack, \decay, \sustain, \release
- .endm
-
- .macro voice_directsound_no_resample base_midi_key, pan, sample_data_pointer, attack, decay, sustain, release
- .byte 8
- _voice_directsound \base_midi_key, \pan, \sample_data_pointer, \attack, \decay, \sustain, \release
- .endm
-
- .macro voice_directsound_alt base_midi_key, pan, sample_data_pointer, attack, decay, sustain, release
- .byte 16
- _voice_directsound \base_midi_key, \pan, \sample_data_pointer, \attack, \decay, \sustain, \release
- .endm
-
- .macro _voice_directsound base_midi_key, pan, sample_data_pointer, attack, decay, sustain, release
- .byte \base_midi_key
- .byte 0
- .if \pan != 0
- .byte (0x80 | \pan)
- .else
- .byte 0
- .endif
- .4byte \sample_data_pointer
- .byte \attack
- .byte \decay
- .byte \sustain
- .byte \release
- .endm
-
- .macro voice_square_1 sweep, duty_cycle, attack, decay, sustain, release
- _voice_square_1 1, \sweep, \duty_cycle, \attack, \decay, \sustain, \release
- .endm
-
- .macro voice_square_1_alt sweep, duty_cycle, attack, decay, sustain, release
- _voice_square_1 9, \sweep, \duty_cycle, \attack, \decay, \sustain, \release
- .endm
-
- .macro _voice_square_1 type, sweep, duty_cycle, attack, decay, sustain, release
- .byte \type, 60, 0
- .byte \sweep
- .byte (\duty_cycle & 0x3)
- .byte 0, 0, 0
- .byte (\attack & 0x7)
- .byte (\decay & 0x7)
- .byte (\sustain & 0xF)
- .byte (\release & 0x7)
- .endm
-
- .macro voice_square_2 duty_cycle, attack, decay, sustain, release
- _voice_square_2 2, \duty_cycle, \attack, \decay, \sustain, \release
- .endm
-
- .macro voice_square_2_alt duty_cycle, attack, decay, sustain, release
- _voice_square_2 10, \duty_cycle, \attack, \decay, \sustain, \release
- .endm
-
- .macro _voice_square_2 type, duty_cycle, attack, decay, sustain, release
- .byte \type, 60, 0, 0
- .byte (\duty_cycle & 0x3)
- .byte 0, 0, 0
- .byte (\attack & 0x7)
- .byte (\decay & 0x7)
- .byte (\sustain & 0xF)
- .byte (\release & 0x7)
- .endm
-
- .macro voice_programmable_wave wave_samples_pointer, attack, decay, sustain, release
- _voice_programmable_wave 3, \wave_samples_pointer, \attack, \decay, \sustain, \release
- .endm
-
- .macro voice_programmable_wave_alt wave_samples_pointer, attack, decay, sustain, release
- _voice_programmable_wave 11, \wave_samples_pointer, \attack, \decay, \sustain, \release
- .endm
-
- .macro _voice_programmable_wave type, wave_samples_pointer, attack, decay, sustain, release
- .byte \type, 60, 0, 0
- .4byte \wave_samples_pointer
- .byte (\attack & 0x7)
- .byte (\decay & 0x7)
- .byte (\sustain & 0xF)
- .byte (\release & 0x7)
- .endm
-
- .macro voice_noise period, attack, decay, sustain, release
- _voice_noise 4, \period, \attack, \decay, \sustain, \release
- .endm
-
- .macro voice_noise_alt period, attack, decay, sustain, release
- _voice_noise 12, \period, \attack, \decay, \sustain, \release
- .endm
-
- .macro _voice_noise type, period, attack, decay, sustain, release
- .byte \type, 60, 0, 0
- .byte (\period & 0x1)
- .byte 0, 0, 0
- .byte (\attack & 0x7)
- .byte (\decay & 0x7)
- .byte (\sustain & 0xF)
- .byte (\release & 0x7)
- .endm
-
- .macro voice_keysplit voice_group_pointer, keysplit_table_pointer
- .byte 0x40, 0, 0, 0
- .4byte \voice_group_pointer
- .4byte \keysplit_table_pointer
- .endm
-
- .macro voice_keysplit_all voice_group_pointer
- .byte 0x80, 0, 0, 0
- .4byte \voice_group_pointer
- .4byte 0
- .endm
-
- .macro cry sample
- .byte 0x20, 60, 0, 0
- .4byte \sample
- .byte 0xff, 0, 0xff, 0
- .endm
-
- .macro cry2 sample
- .byte 0x30, 60, 0, 0
- .4byte \sample
- .byte 0xff, 0, 0xff, 0
- .endm
diff --git a/asm/macros/pokemon_data.inc b/asm/macros/pokemon_data.inc
deleted file mode 100644
index b0a5f22e3..000000000
--- a/asm/macros/pokemon_data.inc
+++ /dev/null
@@ -1,57 +0,0 @@
- .macro pokedex_entry pokemon_name, height, weight, pokemon_scale, pokemon_offset, trainer_scale, trainer_offset
- .2byte \height @ in decimeters
- .2byte \weight @ in hectograms
- .4byte DexDescription_\pokemon_name\()_1
- .4byte DexDescription_\pokemon_name\()_2
- .2byte 0 @ unused
- .2byte \pokemon_scale
- .2byte \pokemon_offset
- .2byte \trainer_scale
- .2byte \trainer_offset
- .2byte 0 @ padding
- .endm
-
- .macro base_stats hp, attack, defense, speed, sp_attack, sp_defense
- .byte \hp
- .byte \attack
- .byte \defense
- .byte \speed
- .byte \sp_attack
- .byte \sp_defense
- .endm
-
- .macro ev_yield hp, attack, defense, speed, sp_attack, sp_defense
- .2byte (\sp_defense << 10) | (\sp_attack << 8) | (\speed << 6) | (\defense << 4) | (\attack << 2) | \hp
- .endm
-
- .macro level_up_move level, move
- .2byte (\level << 9) | \move
- .endm
-
- .macro evo_entry method, parameter, target_species
- .2byte \method
- .2byte \parameter
- .2byte \target_species
- .2byte 0 @ padding
- .endm
-
- .macro empty_evo_entries count
- .fill 8 * \count, 1, 0
- .endm
-
- .macro egg_moves_begin species
- .2byte 20000 + \species
- .endm
-
-@ If the min level equals the max level, only one level argument is needed.
- .macro wild_mon species, min_level, max_level
- .byte \min_level
-
- .ifb \max_level
- .byte \min_level
- .else
- .byte \max_level
- .endif
-
- .2byte SPECIES_\species
- .endm
diff --git a/asm/normal.s b/asm/normal.s
index a800b348a..fffbc3870 100755
--- a/asm/normal.s
+++ b/asm/normal.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -1103,15 +1103,15 @@ _080E24F0:
beq _080E2508
b _080E2518
_080E24F6:
- ldr r1, _080E24FC @ =gUnknown_030041B0
+ ldr r1, _080E24FC @ =gBattle_BG3_X
b _080E250A
.align 2, 0
-_080E24FC: .4byte gUnknown_030041B0
+_080E24FC: .4byte gBattle_BG3_X
_080E2500:
- ldr r1, _080E2504 @ =gUnknown_030041B8
+ ldr r1, _080E2504 @ =gBattle_BG3_Y
b _080E250A
.align 2, 0
-_080E2504: .4byte gUnknown_030041B8
+_080E2504: .4byte gBattle_BG3_Y
_080E2508:
ldr r1, _080E2514 @ =gSpriteCoordOffsetX
_080E250A:
@@ -1359,10 +1359,10 @@ sub_80E26BC: @ 80E26BC
strh r1, [r2, 0xE]
ldrh r1, [r3, 0x6]
strh r1, [r2, 0x18]
- ldr r4, _080E2704 @ =gUnknown_030041B0
+ ldr r4, _080E2704 @ =gBattle_BG3_X
ldrh r1, [r3]
strh r1, [r4]
- ldr r4, _080E2708 @ =gUnknown_030041B8
+ ldr r4, _080E2708 @ =gBattle_BG3_Y
ldrh r1, [r3, 0x2]
strh r1, [r4]
ldr r1, _080E270C @ =sub_80E2710
@@ -1374,8 +1374,8 @@ sub_80E26BC: @ 80E26BC
.align 2, 0
_080E26FC: .4byte gTasks
_080E2700: .4byte gBattleAnimArgs
-_080E2704: .4byte gUnknown_030041B0
-_080E2708: .4byte gUnknown_030041B8
+_080E2704: .4byte gBattle_BG3_X
+_080E2708: .4byte gBattle_BG3_Y
_080E270C: .4byte sub_80E2710
thumb_func_end sub_80E26BC
@@ -1395,7 +1395,7 @@ sub_80E2710: @ 80E2710
mov r12, r1
cmp r0, 0
bne _080E2796
- ldr r0, _080E2744 @ =gUnknown_030041B0
+ ldr r0, _080E2744 @ =gBattle_BG3_X
ldrh r2, [r0]
movs r7, 0x8
ldrsh r1, [r3, r7]
@@ -1407,12 +1407,12 @@ sub_80E2710: @ 80E2710
b _080E274A
.align 2, 0
_080E2740: .4byte gTasks
-_080E2744: .4byte gUnknown_030041B0
+_080E2744: .4byte gBattle_BG3_X
_080E2748:
ldrh r0, [r3, 0x8]
_080E274A:
strh r0, [r6]
- ldr r2, _080E2768 @ =gUnknown_030041B8
+ ldr r2, _080E2768 @ =gBattle_BG3_Y
ldrh r3, [r2]
lsls r1, r5, 2
adds r0, r1, r5
@@ -1426,7 +1426,7 @@ _080E274A:
movs r0, 0
b _080E2770
.align 2, 0
-_080E2768: .4byte gUnknown_030041B8
+_080E2768: .4byte gBattle_BG3_Y
_080E276C:
ldrh r0, [r4, 0xA]
negs r0, r0
@@ -3905,13 +3905,13 @@ sub_80E3AD0: @ 80E3AD0
ldrh r7, [r1, 0x1E]
adds r2, r7
strh r2, [r1, 0x1E]
- ldr r6, _080E3B40 @ =gUnknown_030041B0
+ ldr r6, _080E3B40 @ =gBattle_BG3_X
lsls r0, r3, 16
asrs r0, 24
ldrh r4, [r6]
adds r0, r4
strh r0, [r6]
- ldr r4, _080E3B44 @ =gUnknown_030041B8
+ ldr r4, _080E3B44 @ =gBattle_BG3_Y
lsls r0, r2, 16
asrs r0, 24
ldrh r7, [r4]
@@ -3942,8 +3942,8 @@ _080E3B36:
bx r0
.align 2, 0
_080E3B3C: .4byte gTasks
-_080E3B40: .4byte gUnknown_030041B0
-_080E3B44: .4byte gUnknown_030041B8
+_080E3B40: .4byte gBattle_BG3_X
+_080E3B44: .4byte gBattle_BG3_Y
_080E3B48: .4byte gBattleAnimArgs
thumb_func_end sub_80E3AD0
diff --git a/asm/pc_screen_effect.s b/asm/pc_screen_effect.s
index 665978d19..9d36df66c 100755
--- a/asm/pc_screen_effect.s
+++ b/asm/pc_screen_effect.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/poison.s b/asm/poison.s
deleted file mode 100755
index 234348df2..000000000
--- a/asm/poison.s
+++ /dev/null
@@ -1,364 +0,0 @@
- .include "constants/gba_constants.inc"
- .include "asm/macros.inc"
-
- .syntax unified
-
- .text
-
- @ poison
-
- thumb_func_start sub_80D9D70
-sub_80D9D70: @ 80D9D70
- push {r4,r5,lr}
- adds r5, r0, 0
- ldr r4, _080D9DC4 @ =gBattleAnimArgs
- movs r1, 0x6
- ldrsh r0, [r4, r1]
- cmp r0, 0
- bne _080D9D86
- adds r0, r5, 0
- movs r1, 0x2
- bl StartSpriteAnim
-_080D9D86:
- adds r0, r5, 0
- movs r1, 0x1
- bl sub_80787B0
- ldrh r0, [r4, 0x4]
- strh r0, [r5, 0x2E]
- ldr r4, _080D9DC8 @ =gAnimBankTarget
- ldrb r0, [r4]
- movs r1, 0x2
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x32]
- ldrb r0, [r4]
- movs r1, 0x3
- bl GetBankPosition
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r5, 0x36]
- ldr r0, _080D9DCC @ =0x0000ffe2
- strh r0, [r5, 0x38]
- adds r0, r5, 0
- bl sub_80786EC
- ldr r0, _080D9DD0 @ =sub_80D9DD4
- str r0, [r5, 0x1C]
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_080D9DC4: .4byte gBattleAnimArgs
-_080D9DC8: .4byte gAnimBankTarget
-_080D9DCC: .4byte 0x0000ffe2
-_080D9DD0: .4byte sub_80D9DD4
- thumb_func_end sub_80D9D70
-
- thumb_func_start sub_80D9DD4
-sub_80D9DD4: @ 80D9DD4
- push {r4,lr}
- adds r4, r0, 0
- bl sub_8078718
- lsls r0, 24
- cmp r0, 0
- beq _080D9DE8
- adds r0, r4, 0
- bl DestroyAnimSprite
-_080D9DE8:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_80D9DD4
-
- thumb_func_start sub_80D9DF0
-sub_80D9DF0: @ 80D9DF0
- push {r4-r6,lr}
- sub sp, 0x4
- adds r4, r0, 0
- ldr r5, _080D9E64 @ =gBattleAnimArgs
- movs r1, 0x6
- ldrsh r0, [r5, r1]
- cmp r0, 0
- bne _080D9E08
- adds r0, r4, 0
- movs r1, 0x2
- bl StartSpriteAnim
-_080D9E08:
- adds r0, r4, 0
- movs r1, 0x1
- bl sub_80787B0
- ldr r0, _080D9E68 @ =gAnimBankTarget
- ldrb r0, [r0]
- mov r6, sp
- adds r6, 0x2
- movs r1, 0x1
- mov r2, sp
- adds r3, r6, 0
- bl sub_807A3FC
- ldr r0, _080D9E6C @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- beq _080D9E36
- ldrh r0, [r5, 0x8]
- negs r0, r0
- strh r0, [r5, 0x8]
-_080D9E36:
- ldrh r0, [r5, 0x4]
- strh r0, [r4, 0x2E]
- mov r1, sp
- ldrh r0, [r5, 0x8]
- ldrh r1, [r1]
- adds r0, r1
- strh r0, [r4, 0x32]
- ldrh r0, [r5, 0xA]
- ldrh r6, [r6]
- adds r0, r6
- strh r0, [r4, 0x36]
- ldr r0, _080D9E70 @ =0x0000ffe2
- strh r0, [r4, 0x38]
- adds r0, r4, 0
- bl sub_80786EC
- ldr r0, _080D9E74 @ =sub_80D9E78
- str r0, [r4, 0x1C]
- add sp, 0x4
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_080D9E64: .4byte gBattleAnimArgs
-_080D9E68: .4byte gAnimBankTarget
-_080D9E6C: .4byte gAnimBankAttacker
-_080D9E70: .4byte 0x0000ffe2
-_080D9E74: .4byte sub_80D9E78
- thumb_func_end sub_80D9DF0
-
- thumb_func_start sub_80D9E78
-sub_80D9E78: @ 80D9E78
- push {r4,lr}
- adds r4, r0, 0
- bl sub_8078718
- lsls r0, 24
- cmp r0, 0
- beq _080D9E8C
- adds r0, r4, 0
- bl DestroyAnimSprite
-_080D9E8C:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_80D9E78
-
- thumb_func_start sub_80D9E94
-sub_80D9E94: @ 80D9E94
- push {r4,r5,lr}
- adds r4, r0, 0
- ldr r5, _080D9EE0 @ =gBattleAnimArgs
- ldrh r0, [r5, 0x4]
- strh r0, [r4, 0x2E]
- ldrh r0, [r4, 0x20]
- strh r0, [r4, 0x30]
- ldrh r1, [r5]
- adds r0, r1
- strh r0, [r4, 0x32]
- ldrh r0, [r4, 0x22]
- strh r0, [r4, 0x34]
- ldrh r1, [r5, 0x2]
- adds r0, r1
- strh r0, [r4, 0x36]
- adds r0, r4, 0
- bl sub_8078A5C
- movs r1, 0x30
- ldrsh r0, [r4, r1]
- movs r2, 0x4
- ldrsh r1, [r5, r2]
- bl __divsi3
- strh r0, [r4, 0x38]
- movs r1, 0x32
- ldrsh r0, [r4, r1]
- movs r2, 0x4
- ldrsh r1, [r5, r2]
- bl __divsi3
- strh r0, [r4, 0x3A]
- ldr r0, _080D9EE4 @ =sub_80D9EE8
- str r0, [r4, 0x1C]
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_080D9EE0: .4byte gBattleAnimArgs
-_080D9EE4: .4byte sub_80D9EE8
- thumb_func_end sub_80D9E94
-
- thumb_func_start sub_80D9EE8
-sub_80D9EE8: @ 80D9EE8
- push {r4,lr}
- adds r4, r0, 0
- bl sub_8078394
- ldrh r0, [r4, 0x30]
- ldrh r1, [r4, 0x38]
- subs r0, r1
- strh r0, [r4, 0x30]
- ldrh r0, [r4, 0x32]
- ldrh r1, [r4, 0x3A]
- subs r0, r1
- strh r0, [r4, 0x32]
- movs r1, 0x2E
- ldrsh r0, [r4, r1]
- cmp r0, 0
- bne _080D9F0E
- adds r0, r4, 0
- bl DestroyAnimSprite
-_080D9F0E:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_80D9EE8
-
- thumb_func_start sub_80D9F14
-sub_80D9F14: @ 80D9F14
- push {r4,lr}
- adds r4, r0, 0
- ldr r0, _080D9F74 @ =gAnimBankTarget
- ldrb r0, [r0]
- adds r2, r4, 0
- adds r2, 0x20
- adds r3, r4, 0
- adds r3, 0x22
- movs r1, 0x1
- bl sub_807A3FC
- ldr r0, _080D9F78 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- beq _080D9F40
- ldr r1, _080D9F7C @ =gBattleAnimArgs
- ldrh r0, [r1]
- negs r0, r0
- strh r0, [r1]
-_080D9F40:
- ldr r0, _080D9F7C @ =gBattleAnimArgs
- ldrh r2, [r0]
- ldrh r1, [r4, 0x20]
- adds r2, r1
- strh r2, [r4, 0x20]
- ldrh r1, [r0, 0x2]
- ldrh r3, [r4, 0x22]
- adds r1, r3
- strh r1, [r4, 0x22]
- ldrh r3, [r0, 0x8]
- strh r3, [r4, 0x2E]
- ldrh r0, [r0, 0x4]
- adds r2, r0
- strh r2, [r4, 0x32]
- adds r1, r3
- strh r1, [r4, 0x36]
- ldr r0, _080D9F80 @ =sub_8078B34
- str r0, [r4, 0x1C]
- ldr r1, _080D9F84 @ =DestroyAnimSprite
- adds r0, r4, 0
- bl StoreSpriteCallbackInData
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_080D9F74: .4byte gAnimBankTarget
-_080D9F78: .4byte gAnimBankAttacker
-_080D9F7C: .4byte gBattleAnimArgs
-_080D9F80: .4byte sub_8078B34
-_080D9F84: .4byte DestroyAnimSprite
- thumb_func_end sub_80D9F14
-
- thumb_func_start sub_80D9F88
-sub_80D9F88: @ 80D9F88
- push {r4,r5,lr}
- adds r4, r0, 0
- ldr r5, _080D9FA0 @ =gBattleAnimArgs
- movs r1, 0x4
- ldrsh r0, [r5, r1]
- cmp r0, 0
- bne _080D9FA4
- adds r0, r4, 0
- movs r1, 0x1
- bl sub_8078764
- b _080D9FDA
- .align 2, 0
-_080D9FA0: .4byte gBattleAnimArgs
-_080D9FA4:
- ldr r0, _080D9FE4 @ =gAnimBankTarget
- ldrb r0, [r0]
- adds r2, r4, 0
- adds r2, 0x20
- adds r3, r4, 0
- adds r3, 0x22
- movs r1, 0x1
- bl sub_807A3FC
- ldr r0, _080D9FE8 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- cmp r0, 0
- beq _080D9FCA
- ldrh r0, [r5]
- negs r0, r0
- strh r0, [r5]
-_080D9FCA:
- ldrh r0, [r5]
- ldrh r1, [r4, 0x20]
- adds r0, r1
- strh r0, [r4, 0x20]
- ldrh r0, [r5, 0x2]
- ldrh r1, [r4, 0x22]
- adds r0, r1
- strh r0, [r4, 0x22]
-_080D9FDA:
- ldr r0, _080D9FEC @ =sub_80D9FF0
- str r0, [r4, 0x1C]
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_080D9FE4: .4byte gAnimBankTarget
-_080D9FE8: .4byte gAnimBankAttacker
-_080D9FEC: .4byte sub_80D9FF0
- thumb_func_end sub_80D9F88
-
- thumb_func_start sub_80D9FF0
-sub_80D9FF0: @ 80D9FF0
- push {r4,lr}
- adds r4, r0, 0
- ldrh r0, [r4, 0x2E]
- adds r0, 0xB
- movs r1, 0xFF
- ands r0, r1
- strh r0, [r4, 0x2E]
- movs r1, 0x2E
- ldrsh r0, [r4, r1]
- movs r1, 0x4
- bl Sin
- strh r0, [r4, 0x24]
- ldrh r0, [r4, 0x30]
- adds r0, 0x30
- strh r0, [r4, 0x30]
- lsls r0, 16
- asrs r0, 24
- negs r0, r0
- strh r0, [r4, 0x26]
- adds r0, r4, 0
- adds r0, 0x3F
- ldrb r1, [r0]
- movs r0, 0x20
- ands r0, r1
- cmp r0, 0
- beq _080DA02C
- adds r0, r4, 0
- bl DestroyAnimSprite
-_080DA02C:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_80D9FF0
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/asm/pokedex_area_screen.s b/asm/pokedex_area_screen.s
index fd5555524..779a5a0ed 100644
--- a/asm/pokedex_area_screen.s
+++ b/asm/pokedex_area_screen.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/pokedex_cry_screen.s b/asm/pokedex_cry_screen.s
index 5eea28b99..00f8cfe14 100644
--- a/asm/pokedex_cry_screen.s
+++ b/asm/pokedex_cry_screen.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/pokemon_item_effect.s b/asm/pokemon_item_effect.s
index a8b8fa401..6995dc62b 100644
--- a/asm/pokemon_item_effect.s
+++ b/asm/pokemon_item_effect.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s
index d878821cb..2ac873fcd 100644
--- a/asm/pokemon_storage_system.s
+++ b/asm/pokemon_storage_system.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/pokenav.s b/asm/pokenav.s
index 7c766addc..ca65b2e06 100644
--- a/asm/pokenav.s
+++ b/asm/pokenav.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -10956,8 +10956,8 @@ sub_80F5B50: @ 80F5B50
_080F5B68: .4byte gUnknown_083DFEC4
_080F5B6C: .4byte 0x00009345
_080F5B70:
- bl dp12_8087EA4
- ldr r0, _080F5BA8 @ =gUnknown_03004DE0
+ bl ScanlineEffect_Clear
+ ldr r0, _080F5BA8 @ =gScanlineEffectRegBuffers
movs r2, 0xEF
movs r3, 0xF4
lsls r3, 3
@@ -10984,7 +10984,7 @@ _080F5B82:
movs r0, 0x1
b _080F5BCE
.align 2, 0
-_080F5BA8: .4byte gUnknown_03004DE0
+_080F5BA8: .4byte gScanlineEffectRegBuffers
_080F5BAC: .4byte gUnknown_083DFEC4
_080F5BB0: .4byte 0x00009345
_080F5BB4:
@@ -10995,7 +10995,7 @@ _080F5BB4:
ldr r0, [sp]
ldr r1, [sp, 0x4]
ldr r2, [sp, 0x8]
- bl sub_80895F8
+ bl ScanlineEffect_SetParams
ldrb r0, [r4]
adds r0, 0x1
strb r0, [r4]
@@ -11013,14 +11013,14 @@ _080F5BD8: .4byte gUnknown_083E4990
thumb_func_start sub_80F5BDC
sub_80F5BDC: @ 80F5BDC
push {lr}
- ldr r1, _080F5BEC @ =gUnknown_03004DC0
+ ldr r1, _080F5BEC @ =gScanlineEffect
movs r0, 0x3
strb r0, [r1, 0x15]
- bl sub_8089668
+ bl ScanlineEffect_InitHBlankDmaTransfer
pop {r0}
bx r0
.align 2, 0
-_080F5BEC: .4byte gUnknown_03004DC0
+_080F5BEC: .4byte gScanlineEffect
thumb_func_end sub_80F5BDC
thumb_func_start sub_80F5BF0
@@ -11045,7 +11045,7 @@ sub_80F5BF0: @ 80F5BF0
adds r0, r4, 0
bl sub_80F5A1C
movs r6, 0
- ldr r1, _080F5CC4 @ =gUnknown_03004DE0
+ ldr r1, _080F5CC4 @ =gScanlineEffectRegBuffers
mov r12, r1
movs r0, 0xF0
lsls r0, 3
@@ -11128,7 +11128,7 @@ _080F5CA6:
_080F5CB8: .4byte gUnknown_083DFEC4
_080F5CBC: .4byte 0x00009344
_080F5CC0: .4byte 0x0000911c
-_080F5CC4: .4byte gUnknown_03004DE0
+_080F5CC4: .4byte gScanlineEffectRegBuffers
_080F5CC8: .4byte 0x0000ffff
_080F5CCC: .4byte 0x00009130
_080F5CD0: .4byte 0x00009132
@@ -11164,7 +11164,7 @@ sub_80F5CDC: @ 80F5CDC
lsls r0, 17
lsrs r5, r0, 16
movs r7, 0
- ldr r1, _080F5DBC @ =gUnknown_03004DE0
+ ldr r1, _080F5DBC @ =gScanlineEffectRegBuffers
mov r12, r1
movs r4, 0xF0
lsls r4, 3
@@ -11248,7 +11248,7 @@ _080F5DA0:
_080F5DB0: .4byte gUnknown_083DFEC4
_080F5DB4: .4byte 0x00009344
_080F5DB8: .4byte 0x0000911c
-_080F5DBC: .4byte gUnknown_03004DE0
+_080F5DBC: .4byte gScanlineEffectRegBuffers
_080F5DC0: .4byte 0x0000ffff
_080F5DC4: .4byte 0x00009130
_080F5DC8: .4byte 0x00009132
diff --git a/asm/psychic.s b/asm/psychic.s
index 20e558bf6..f91ce950e 100755
--- a/asm/psychic.s
+++ b/asm/psychic.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -1588,7 +1588,7 @@ _080DC380:
adds r0, 0x40
cmp r1, r0
bgt _080DC3BA
- ldr r5, _080DC3E8 @ =gUnknown_03004DE0
+ ldr r5, _080DC3E8 @ =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r6, r5, r0
@@ -1621,7 +1621,7 @@ _080DC3BA:
ldr r0, [sp]
ldr r1, [sp, 0x4]
ldr r2, [sp, 0x8]
- bl sub_80895F8
+ bl ScanlineEffect_SetParams
ldr r0, _080DC3F0 @ =sub_80DC3F4
str r0, [r4]
add sp, 0xC
@@ -1631,7 +1631,7 @@ _080DC3BA:
.align 2, 0
_080DC3E0: .4byte gBattle_BG2_X
_080DC3E4: .4byte REG_BG2HOFS
-_080DC3E8: .4byte gUnknown_03004DE0
+_080DC3E8: .4byte gScanlineEffectRegBuffers
_080DC3EC: .4byte 0xa2600001
_080DC3F0: .4byte sub_80DC3F4
thumb_func_end sub_80DC2D4
@@ -1676,7 +1676,7 @@ _080DC426:
ldr r0, _080DC470 @ =gSineTable
mov r9, r0
movs r7, 0x3
- ldr r1, _080DC474 @ =gUnknown_03004DE0
+ ldr r1, _080DC474 @ =gScanlineEffectRegBuffers
mov r12, r1
movs r2, 0xF0
lsls r2, 3
@@ -1704,7 +1704,7 @@ _080DC448:
b _080DC484
.align 2, 0
_080DC470: .4byte gSineTable
-_080DC474: .4byte gUnknown_03004DE0
+_080DC474: .4byte gScanlineEffectRegBuffers
_080DC478:
cmp r3, 0
bge _080DC488
@@ -1753,7 +1753,7 @@ _080DC4BE:
ble _080DC4E6
b _080DC4D4
_080DC4CE:
- ldr r1, _080DC4DC @ =gUnknown_03004DC0
+ ldr r1, _080DC4DC @ =gScanlineEffect
movs r0, 0x3
strb r0, [r1, 0x15]
_080DC4D4:
@@ -1762,7 +1762,7 @@ _080DC4D4:
strh r0, [r5, 0x8]
b _080DC4E6
.align 2, 0
-_080DC4DC: .4byte gUnknown_03004DC0
+_080DC4DC: .4byte gScanlineEffect
_080DC4E0:
adds r0, r2, 0
bl DestroyAnimVisualTask
diff --git a/asm/rock.s b/asm/rock.s
index 923c842be..98afb53e6 100755
--- a/asm/rock.s
+++ b/asm/rock.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -1549,7 +1549,7 @@ sub_80DDA8C: @ 80DDA8C
movs r0, 0xC8
strh r0, [r5, 0xA]
_080DDAAE:
- ldr r4, _080DDAEC @ =gUnknown_030041B8
+ ldr r4, _080DDAEC @ =gBattle_BG3_Y
movs r1, 0xA
ldrsh r0, [r5, r1]
movs r1, 0xA
@@ -1577,7 +1577,7 @@ _080DDADA:
bx r0
.align 2, 0
_080DDAE8: .4byte gTasks
-_080DDAEC: .4byte gUnknown_030041B8
+_080DDAEC: .4byte gBattle_BG3_Y
thumb_func_end sub_80DDA8C
thumb_func_start sub_80DDAF0
@@ -1600,7 +1600,7 @@ sub_80DDAF0: @ 80DDAF0
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
- ldr r0, _080DDB60 @ =gUnknown_030041B8
+ ldr r0, _080DDB60 @ =gBattle_BG3_Y
ldrh r0, [r0]
strh r0, [r4, 0xC]
_080DDB1C:
@@ -1609,7 +1609,7 @@ _080DDB1C:
movs r1, 0xFF
ands r0, r1
strh r0, [r4, 0xA]
- ldr r6, _080DDB60 @ =gUnknown_030041B8
+ ldr r6, _080DDB60 @ =gBattle_BG3_Y
movs r2, 0xA
ldrsh r1, [r4, r2]
movs r0, 0x4
@@ -1635,7 +1635,7 @@ _080DDB54:
bx r0
.align 2, 0
_080DDB5C: .4byte gTasks
-_080DDB60: .4byte gUnknown_030041B8
+_080DDB60: .4byte gBattle_BG3_Y
_080DDB64: .4byte gBattleAnimArgs
_080DDB68: .4byte 0x00000fff
thumb_func_end sub_80DDAF0
diff --git a/asm/unk_text_8095904.s b/asm/unk_text_8095904.s
index f144eab26..00c81faca 100755
--- a/asm/unk_text_8095904.s
+++ b/asm/unk_text_8095904.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
diff --git a/asm/water.s b/asm/water.s
index d72f9438c..45fb7f82a 100755
--- a/asm/water.s
+++ b/asm/water.s
@@ -1,5 +1,5 @@
.include "constants/gba_constants.inc"
- .include "asm/macros.inc"
+ .include "include/macros.inc"
.syntax unified
@@ -300,7 +300,7 @@ _080D3D9C:
movs r3, 0
movs r2, 0x10
ldrsh r0, [r4, r2]
- ldr r1, _080D3E6C @ =gUnknown_03004DE0
+ ldr r1, _080D3E6C @ =gScanlineEffectRegBuffers
mov r12, r1
cmp r3, r0
bge _080D3DDA
@@ -337,7 +337,7 @@ _080D3DDA:
ldrsh r0, [r4, r3]
cmp r1, r0
bge _080D3E14
- ldr r5, _080D3E6C @ =gUnknown_03004DE0
+ ldr r5, _080D3E6C @ =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r6, r5, r0
@@ -366,7 +366,7 @@ _080D3E14:
asrs r0, r2, 16
cmp r0, 0x9F
bgt _080D3E4A
- ldr r5, _080D3E6C @ =gUnknown_03004DE0
+ ldr r5, _080D3E6C @ =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r6, r5, r0
@@ -407,7 +407,7 @@ _080D3E4A:
ldrh r0, [r4, 0xA]
b _080D3E8A
.align 2, 0
-_080D3E6C: .4byte gUnknown_03004DE0
+_080D3E6C: .4byte gScanlineEffectRegBuffers
_080D3E70: .4byte 0x0000ffff
_080D3E74:
lsls r0, r3, 16
@@ -436,7 +436,7 @@ _080D3E8A:
ldr r0, [sp]
ldr r1, [sp, 0x4]
ldr r2, [sp, 0x8]
- bl sub_80895F8
+ bl ScanlineEffect_SetParams
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
@@ -475,8 +475,8 @@ _080D3EE8:
ldrsh r0, [r4, r1]
cmp r3, r0
bge _080D3F1C
- ldr r6, _080D3F80 @ =gUnknown_03004DE0
- ldr r5, _080D3F84 @ =gUnknown_03004DC0
+ ldr r6, _080D3F80 @ =gScanlineEffectRegBuffers
+ ldr r5, _080D3F84 @ =gScanlineEffect
_080D3EF6:
lsls r1, r3, 16
asrs r1, 16
@@ -505,8 +505,8 @@ _080D3F1C:
ldrsh r0, [r4, r3]
cmp r1, r0
bge _080D3F50
- ldr r6, _080D3F80 @ =gUnknown_03004DE0
- ldr r5, _080D3F84 @ =gUnknown_03004DC0
+ ldr r6, _080D3F80 @ =gScanlineEffectRegBuffers
+ ldr r5, _080D3F84 @ =gScanlineEffect
_080D3F2E:
asrs r3, r2, 16
lsls r2, r3, 1
@@ -531,8 +531,8 @@ _080D3F50:
asrs r0, r1, 16
cmp r0, 0x9F
bgt _080D4032
- ldr r6, _080D3F80 @ =gUnknown_03004DE0
- ldr r5, _080D3F84 @ =gUnknown_03004DC0
+ ldr r6, _080D3F80 @ =gScanlineEffectRegBuffers
+ ldr r5, _080D3F84 @ =gScanlineEffect
_080D3F5E:
asrs r3, r1, 16
lsls r2, r3, 1
@@ -551,16 +551,16 @@ _080D3F5E:
ble _080D3F5E
b _080D4032
.align 2, 0
-_080D3F80: .4byte gUnknown_03004DE0
-_080D3F84: .4byte gUnknown_03004DC0
+_080D3F80: .4byte gScanlineEffectRegBuffers
+_080D3F84: .4byte gScanlineEffect
_080D3F88:
movs r3, 0
movs r1, 0x10
ldrsh r0, [r4, r1]
cmp r3, r0
bge _080D3FBC
- ldr r6, _080D403C @ =gUnknown_03004DE0
- ldr r5, _080D4040 @ =gUnknown_03004DC0
+ ldr r6, _080D403C @ =gScanlineEffectRegBuffers
+ ldr r5, _080D4040 @ =gScanlineEffect
_080D3F96:
lsls r1, r3, 16
asrs r1, 16
@@ -589,8 +589,8 @@ _080D3FBC:
ldrsh r0, [r4, r3]
cmp r1, r0
bge _080D3FF0
- ldr r6, _080D403C @ =gUnknown_03004DE0
- ldr r5, _080D4040 @ =gUnknown_03004DC0
+ ldr r6, _080D403C @ =gScanlineEffectRegBuffers
+ ldr r5, _080D4040 @ =gScanlineEffect
_080D3FCE:
asrs r3, r2, 16
lsls r2, r3, 1
@@ -615,8 +615,8 @@ _080D3FF0:
asrs r0, r1, 16
cmp r0, 0x9F
bgt _080D401C
- ldr r6, _080D403C @ =gUnknown_03004DE0
- ldr r5, _080D4040 @ =gUnknown_03004DC0
+ ldr r6, _080D403C @ =gScanlineEffectRegBuffers
+ ldr r5, _080D4040 @ =gScanlineEffect
_080D3FFE:
asrs r3, r1, 16
lsls r2, r3, 1
@@ -640,7 +640,7 @@ _080D401C:
negs r0, r0
cmp r1, r0
bne _080D4032
- bl remove_some_task
+ bl ScanlineEffect_Stop
adds r0, r7, 0
bl DestroyTask
_080D4032:
@@ -649,8 +649,8 @@ _080D4032:
pop {r0}
bx r0
.align 2, 0
-_080D403C: .4byte gUnknown_03004DE0
-_080D4040: .4byte gUnknown_03004DC0
+_080D403C: .4byte gScanlineEffectRegBuffers
+_080D4040: .4byte gScanlineEffect
thumb_func_end sub_80D3D68
thumb_func_start sub_80D4044
diff --git a/asm/wisp_fire.s b/asm/wisp_fire.s
deleted file mode 100755
index a6407589f..000000000
--- a/asm/wisp_fire.s
+++ /dev/null
@@ -1,678 +0,0 @@
- .include "constants/gba_constants.inc"
- .include "asm/macros.inc"
-
- .syntax unified
-
- .text
-
- @ wisp_fire
-
- thumb_func_start sub_80D5CC0
-sub_80D5CC0: @ 80D5CC0
- push {r4,lr}
- adds r4, r0, 0
- ldrh r1, [r4, 0x2E]
- movs r2, 0x2E
- ldrsh r0, [r4, r2]
- cmp r0, 0
- bne _080D5CD8
- ldr r0, _080D5D4C @ =gBattleAnimArgs
- ldrh r0, [r0]
- strh r0, [r4, 0x30]
- adds r0, r1, 0x1
- strh r0, [r4, 0x2E]
-_080D5CD8:
- movs r0, 0xC0
- lsls r0, 1
- adds r1, r0, 0
- ldrh r2, [r4, 0x34]
- adds r1, r2
- strh r1, [r4, 0x34]
- ldrh r0, [r4, 0x36]
- adds r0, 0xA0
- strh r0, [r4, 0x36]
- movs r2, 0x30
- ldrsh r0, [r4, r2]
- lsls r1, 16
- asrs r1, 24
- bl Sin
- strh r0, [r4, 0x24]
- movs r1, 0x30
- ldrsh r0, [r4, r1]
- ldrh r1, [r4, 0x36]
- lsls r1, 16
- asrs r1, 24
- bl Cos
- strh r0, [r4, 0x26]
- ldrh r0, [r4, 0x30]
- adds r2, r0, 0x7
- movs r0, 0xFF
- ands r2, r0
- strh r2, [r4, 0x30]
- ldr r0, _080D5D50 @ =gMain
- ldr r1, _080D5D54 @ =0x0000043d
- adds r0, r1
- ldrb r1, [r0]
- movs r0, 0x2
- ands r0, r1
- cmp r0, 0
- beq _080D5D84
- adds r0, r2, 0
- subs r0, 0x40
- lsls r0, 16
- lsrs r0, 16
- cmp r0, 0x83
- bls _080D5D5C
- ldr r0, _080D5D58 @ =gAnimBankTarget
- ldrb r0, [r0]
- bl sub_8079ED4
- movs r1, 0x3
- ands r1, r0
- lsls r1, 2
- ldrb r2, [r4, 0x5]
- movs r0, 0xD
- negs r0, r0
- ands r0, r2
- orrs r0, r1
- strb r0, [r4, 0x5]
- b _080D5DA0
- .align 2, 0
-_080D5D4C: .4byte gBattleAnimArgs
-_080D5D50: .4byte gMain
-_080D5D54: .4byte 0x0000043d
-_080D5D58: .4byte gAnimBankTarget
-_080D5D5C:
- ldr r0, _080D5D80 @ =gAnimBankTarget
- ldrb r0, [r0]
- bl sub_8079ED4
- lsls r0, 24
- lsrs r0, 24
- adds r0, 0x1
- movs r1, 0x3
- ands r0, r1
- lsls r0, 2
- ldrb r2, [r4, 0x5]
- movs r1, 0xD
- negs r1, r1
- ands r1, r2
- orrs r1, r0
- strb r1, [r4, 0x5]
- b _080D5DA0
- .align 2, 0
-_080D5D80: .4byte gAnimBankTarget
-_080D5D84:
- adds r0, r2, 0
- subs r0, 0x40
- lsls r0, 16
- lsrs r0, 16
- cmp r0, 0x83
- bls _080D5D98
- adds r1, r4, 0
- adds r1, 0x43
- movs r0, 0x1D
- b _080D5D9E
-_080D5D98:
- adds r1, r4, 0
- adds r1, 0x43
- movs r0, 0x1F
-_080D5D9E:
- strb r0, [r1]
-_080D5DA0:
- ldrh r0, [r4, 0x32]
- adds r0, 0x1
- strh r0, [r4, 0x32]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x14
- ble _080D5DC8
- adds r3, r4, 0
- adds r3, 0x3E
- ldrb r2, [r3]
- lsls r0, r2, 29
- lsrs r0, 31
- movs r1, 0x1
- eors r1, r0
- lsls r1, 2
- movs r0, 0x5
- negs r0, r0
- ands r0, r2
- orrs r0, r1
- strb r0, [r3]
-_080D5DC8:
- movs r2, 0x32
- ldrsh r0, [r4, r2]
- cmp r0, 0x1E
- bne _080D5DD6
- adds r0, r4, 0
- bl DestroyAnimSprite
-_080D5DD6:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_80D5CC0
-
- thumb_func_start sub_80D5DDC
-sub_80D5DDC: @ 80D5DDC
- push {r4,lr}
- lsls r0, 24
- lsrs r0, 24
- lsls r1, r0, 2
- adds r1, r0
- lsls r1, 3
- ldr r0, _080D5E3C @ =gTasks
- adds r4, r1, r0
- ldr r0, _080D5E40 @ =gAnimBankAttacker
- ldrb r0, [r0]
- bl GetBankSide
- lsls r0, 24
- movs r2, 0x1
- negs r2, r2
- adds r1, r2, 0
- cmp r0, 0
- bne _080D5E02
- movs r1, 0x1
-_080D5E02:
- strh r1, [r4, 0x20]
- ldr r0, _080D5E44 @ =gAnimBankTarget
- ldrb r1, [r0]
- movs r0, 0x2
- eors r0, r1
- bl IsAnimBankSpriteVisible
- lsls r0, 24
- lsrs r0, 24
- adds r0, 0x1
- strh r0, [r4, 0x22]
- movs r0, 0x1
- bl GetAnimBankSpriteId
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r4, 0x24]
- movs r0, 0x3
- bl GetAnimBankSpriteId
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r4, 0x26]
- ldr r0, _080D5E48 @ =sub_80D5E4C
- str r0, [r4]
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_080D5E3C: .4byte gTasks
-_080D5E40: .4byte gAnimBankAttacker
-_080D5E44: .4byte gAnimBankTarget
-_080D5E48: .4byte sub_80D5E4C
- thumb_func_end sub_80D5DDC
-
- thumb_func_start sub_80D5E4C
-sub_80D5E4C: @ 80D5E4C
- push {r4-r7,lr}
- lsls r0, 24
- lsrs r4, r0, 24
- lsls r0, r4, 2
- adds r0, r4
- lsls r0, 3
- ldr r1, _080D5E70 @ =gTasks
- adds r2, r0, r1
- movs r0, 0x8
- ldrsh r3, [r2, r0]
- cmp r3, 0x1
- beq _080D5F14
- cmp r3, 0x1
- bgt _080D5E74
- cmp r3, 0
- beq _080D5E82
- b _080D6074
- .align 2, 0
-_080D5E70: .4byte gTasks
-_080D5E74:
- cmp r3, 0x2
- bne _080D5E7A
- b _080D5F9C
-_080D5E7A:
- cmp r3, 0x3
- bne _080D5E80
- b _080D6030
-_080D5E80:
- b _080D6074
-_080D5E82:
- movs r1, 0x20
- ldrsh r0, [r2, r1]
- lsls r0, 1
- ldrh r5, [r2, 0x1C]
- adds r0, r5
- strh r0, [r2, 0x1C]
- ldrh r0, [r2, 0xA]
- adds r0, 0x1
- strh r0, [r2, 0xA]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x1
- ble _080D5EB4
- strh r3, [r2, 0xA]
- ldrh r0, [r2, 0xC]
- adds r0, 0x1
- strh r0, [r2, 0xC]
- movs r1, 0x1
- ands r0, r1
- cmp r0, 0
- beq _080D5EB0
- movs r0, 0x2
- b _080D5EB2
-_080D5EB0:
- ldr r0, _080D5F0C @ =0x0000fffe
-_080D5EB2:
- strh r0, [r2, 0x1E]
-_080D5EB4:
- movs r1, 0
- strh r1, [r2, 0xE]
- movs r7, 0x22
- ldrsh r0, [r2, r7]
- cmp r1, r0
- bge _080D5EF6
- ldr r4, _080D5F10 @ =gSprites
- adds r3, r2, 0
- adds r3, 0x8
-_080D5EC6:
- movs r1, 0xE
- ldrsh r0, [r2, r1]
- adds r0, 0xE
- lsls r0, 1
- adds r0, r3, r0
- movs r5, 0
- ldrsh r0, [r0, r5]
- lsls r1, r0, 4
- adds r1, r0
- lsls r1, 2
- adds r1, r4
- ldrh r0, [r2, 0x1E]
- ldrh r7, [r2, 0x1C]
- adds r0, r7
- strh r0, [r1, 0x24]
- ldrh r0, [r2, 0xE]
- adds r0, 0x1
- strh r0, [r2, 0xE]
- lsls r0, 16
- asrs r0, 16
- movs r5, 0x22
- ldrsh r1, [r2, r5]
- cmp r0, r1
- blt _080D5EC6
-_080D5EF6:
- ldrh r0, [r2, 0x1A]
- adds r0, 0x1
- strh r0, [r2, 0x1A]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x10
- beq _080D5F06
- b _080D6074
-_080D5F06:
- movs r0, 0
- strh r0, [r2, 0x1A]
- b _080D6020
- .align 2, 0
-_080D5F0C: .4byte 0x0000fffe
-_080D5F10: .4byte gSprites
-_080D5F14:
- ldrh r0, [r2, 0xA]
- adds r0, 0x1
- strh r0, [r2, 0xA]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x4
- ble _080D5F3C
- movs r0, 0
- strh r0, [r2, 0xA]
- ldrh r0, [r2, 0xC]
- adds r0, 0x1
- strh r0, [r2, 0xC]
- ands r0, r3
- lsls r0, 16
- cmp r0, 0
- beq _080D5F38
- movs r0, 0x2
- b _080D5F3A
-_080D5F38:
- ldr r0, _080D5F94 @ =0x0000fffe
-_080D5F3A:
- strh r0, [r2, 0x1E]
-_080D5F3C:
- movs r1, 0
- strh r1, [r2, 0xE]
- movs r7, 0x22
- ldrsh r0, [r2, r7]
- cmp r1, r0
- bge _080D5F7E
- ldr r4, _080D5F98 @ =gSprites
- adds r3, r2, 0
- adds r3, 0x8
-_080D5F4E:
- movs r1, 0xE
- ldrsh r0, [r2, r1]
- adds r0, 0xE
- lsls r0, 1
- adds r0, r3, r0
- movs r5, 0
- ldrsh r0, [r0, r5]
- lsls r1, r0, 4
- adds r1, r0
- lsls r1, 2
- adds r1, r4
- ldrh r0, [r2, 0x1E]
- ldrh r7, [r2, 0x1C]
- adds r0, r7
- strh r0, [r1, 0x24]
- ldrh r0, [r2, 0xE]
- adds r0, 0x1
- strh r0, [r2, 0xE]
- lsls r0, 16
- asrs r0, 16
- movs r5, 0x22
- ldrsh r1, [r2, r5]
- cmp r0, r1
- blt _080D5F4E
-_080D5F7E:
- ldrh r0, [r2, 0x1A]
- adds r0, 0x1
- strh r0, [r2, 0x1A]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x60
- bne _080D6074
- movs r0, 0
- strh r0, [r2, 0x1A]
- b _080D6020
- .align 2, 0
-_080D5F94: .4byte 0x0000fffe
-_080D5F98: .4byte gSprites
-_080D5F9C:
- movs r7, 0x20
- ldrsh r1, [r2, r7]
- lsls r1, 1
- ldrh r0, [r2, 0x1C]
- subs r0, r1
- strh r0, [r2, 0x1C]
- ldrh r0, [r2, 0xA]
- adds r0, 0x1
- strh r0, [r2, 0xA]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x1
- ble _080D5FD0
- movs r0, 0
- strh r0, [r2, 0xA]
- ldrh r0, [r2, 0xC]
- adds r0, 0x1
- strh r0, [r2, 0xC]
- movs r1, 0x1
- ands r0, r1
- cmp r0, 0
- beq _080D5FCC
- strh r3, [r2, 0x1E]
- b _080D5FD0
-_080D5FCC:
- ldr r0, _080D6028 @ =0x0000fffe
- strh r0, [r2, 0x1E]
-_080D5FD0:
- movs r1, 0
- strh r1, [r2, 0xE]
- movs r3, 0x22
- ldrsh r0, [r2, r3]
- cmp r1, r0
- bge _080D6012
- ldr r4, _080D602C @ =gSprites
- adds r3, r2, 0
- adds r3, 0x8
-_080D5FE2:
- movs r5, 0xE
- ldrsh r0, [r2, r5]
- adds r0, 0xE
- lsls r0, 1
- adds r0, r3, r0
- movs r7, 0
- ldrsh r0, [r0, r7]
- lsls r1, r0, 4
- adds r1, r0
- lsls r1, 2
- adds r1, r4
- ldrh r0, [r2, 0x1E]
- ldrh r5, [r2, 0x1C]
- adds r0, r5
- strh r0, [r1, 0x24]
- ldrh r0, [r2, 0xE]
- adds r0, 0x1
- strh r0, [r2, 0xE]
- lsls r0, 16
- asrs r0, 16
- movs r7, 0x22
- ldrsh r1, [r2, r7]
- cmp r0, r1
- blt _080D5FE2
-_080D6012:
- ldrh r0, [r2, 0x1A]
- adds r0, 0x1
- strh r0, [r2, 0x1A]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x10
- bne _080D6074
-_080D6020:
- ldrh r0, [r2, 0x8]
- adds r0, 0x1
- strh r0, [r2, 0x8]
- b _080D6074
- .align 2, 0
-_080D6028: .4byte 0x0000fffe
-_080D602C: .4byte gSprites
-_080D6030:
- movs r1, 0
- strh r1, [r2, 0xE]
- movs r3, 0x22
- ldrsh r0, [r2, r3]
- cmp r1, r0
- bge _080D606E
- ldr r6, _080D607C @ =gSprites
- adds r3, r2, 0
- adds r3, 0x8
- movs r5, 0
-_080D6044:
- movs r7, 0xE
- ldrsh r0, [r2, r7]
- adds r0, 0xE
- lsls r0, 1
- adds r0, r3, r0
- movs r7, 0
- ldrsh r1, [r0, r7]
- lsls r0, r1, 4
- adds r0, r1
- lsls r0, 2
- adds r0, r6
- strh r5, [r0, 0x24]
- ldrh r0, [r2, 0xE]
- adds r0, 0x1
- strh r0, [r2, 0xE]
- lsls r0, 16
- asrs r0, 16
- movs r7, 0x22
- ldrsh r1, [r2, r7]
- cmp r0, r1
- blt _080D6044
-_080D606E:
- adds r0, r4, 0
- bl DestroyAnimVisualTask
-_080D6074:
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_080D607C: .4byte gSprites
- thumb_func_end sub_80D5E4C
-
- thumb_func_start sub_80D6080
-sub_80D6080: @ 80D6080
- push {r4,lr}
- sub sp, 0xC
- adds r4, r0, 0
- lsls r4, 24
- lsrs r4, 24
- mov r0, sp
- bl sub_8078914
- mov r0, sp
- ldrb r0, [r0, 0x8]
- lsls r0, 4
- ldr r1, _080D60B0 @ =gBattleAnimArgs
- ldrb r2, [r1]
- ldrh r3, [r1, 0x2]
- movs r1, 0x10
- bl BlendPalette
- adds r0, r4, 0
- bl DestroyAnimVisualTask
- add sp, 0xC
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_080D60B0: .4byte gBattleAnimArgs
- thumb_func_end sub_80D6080
-
- thumb_func_start sub_80D60B4
-sub_80D60B4: @ 80D60B4
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- lsls r0, 24
- lsrs r7, r0, 24
- ldr r1, _080D610C @ =gTasks
- lsls r0, r7, 2
- adds r0, r7
- lsls r0, 3
- adds r2, r0, r1
- movs r3, 0x8
- ldrsh r0, [r2, r3]
- mov r9, r1
- ldr r4, _080D6110 @ =gBattleAnimArgs
- mov r8, r4
- cmp r0, 0
- bne _080D60EA
- ldrh r0, [r4]
- strh r0, [r2, 0xA]
- ldrh r0, [r4, 0x2]
- strh r0, [r2, 0xC]
- ldrh r0, [r4, 0x4]
- strh r0, [r2, 0xE]
- ldrh r0, [r4, 0x6]
- strh r0, [r2, 0x10]
-_080D60EA:
- ldrh r0, [r2, 0x8]
- adds r0, 0x1
- strh r0, [r2, 0x8]
- ldr r1, _080D6114 @ =gObjectBankIDs
- ldr r0, _080D6118 @ =gAnimBankTarget
- ldrb r0, [r0]
- adds r0, r1
- ldrb r6, [r0]
- movs r5, 0x10
- ldrsh r0, [r2, r5]
- cmp r0, 0
- bne _080D6120
- ldr r4, _080D611C @ =gUnknown_083D9794
- movs r1, 0x8
- ldrsh r0, [r2, r1]
- b _080D6126
- .align 2, 0
-_080D610C: .4byte gTasks
-_080D6110: .4byte gBattleAnimArgs
-_080D6114: .4byte gObjectBankIDs
-_080D6118: .4byte gAnimBankTarget
-_080D611C: .4byte gUnknown_083D9794
-_080D6120:
- ldr r4, _080D616C @ =gUnknown_083D97A4
- movs r3, 0x8
- ldrsh r0, [r2, r3]
-_080D6126:
- movs r1, 0xA
- bl __modsi3
- lsls r0, 16
- asrs r0, 16
- adds r0, r4
- ldrb r5, [r0]
- lsls r0, r7, 2
- adds r1, r0, r7
- lsls r1, 3
- add r1, r9
- movs r4, 0xE
- ldrsh r1, [r1, r4]
- mov r12, r0
- cmp r1, 0x1
- bne _080D6174
- ldr r2, _080D6170 @ =gSprites
- lsls r3, r6, 4
- adds r0, r3, r6
- lsls r0, 2
- adds r0, r2
- mov r10, r0
- mov r0, r8
- movs r4, 0x2
- ldrsh r1, [r0, r4]
- lsls r0, r5, 24
- asrs r0, 24
- muls r0, r1
- cmp r0, 0
- bge _080D6164
- negs r0, r0
-_080D6164:
- mov r5, r10
- strh r0, [r5, 0x26]
- b _080D618E
- .align 2, 0
-_080D616C: .4byte gUnknown_083D97A4
-_080D6170: .4byte gSprites
-_080D6174:
- ldr r3, _080D61C4 @ =gSprites
- lsls r4, r6, 4
- adds r2, r4, r6
- lsls r2, 2
- adds r2, r3
- lsls r0, r5, 24
- asrs r0, 24
- mov r5, r8
- ldrh r1, [r5, 0x2]
- muls r0, r1
- strh r0, [r2, 0x24]
- adds r2, r3, 0
- adds r3, r4, 0
-_080D618E:
- mov r1, r12
- adds r0, r1, r7
- lsls r0, 3
- add r0, r9
- movs r4, 0x8
- ldrsh r1, [r0, r4]
- movs r5, 0xA
- ldrsh r0, [r0, r5]
- cmp r1, r0
- bne _080D61B4
- adds r0, r3, r6
- lsls r0, 2
- adds r0, r2
- movs r1, 0
- strh r1, [r0, 0x24]
- strh r1, [r0, 0x26]
- adds r0, r7, 0
- bl DestroyAnimVisualTask
-_080D61B4:
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_080D61C4: .4byte gSprites
- thumb_func_end sub_80D60B4
-
- .align 2, 0 @ Don't pad with nop.