summaryrefslogtreecommitdiff
path: root/asm/music.s
blob: c6177949da109a3bb92353dfe61f3af635bd4b0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
	#include "asm/constants/gba_constants.inc"
	#include "asm/macros.inc"

	.syntax unified

	.text

	thumb_func_start UpdateSound
UpdateSound:
	push {r4-r7,lr}
	mov r7, r8
	push {r7}
	bl m4aSoundMain
	ldr r4, _0800C680
	ldrh r0, [r4]
	cmp r0, 0
	bne _0800C670
	b _0800C7E0
_0800C670:
	cmp r0, 0x2
	beq _0800C6C0
	cmp r0, 0x2
	bgt _0800C684
	cmp r0, 0x1
	beq _0800C68E
	b _0800C8A2
	.align 2, 0
_0800C680: .4byte gUnknown_202D690
_0800C684:
	cmp r0, 0x3
	beq _0800C700
	cmp r0, 0x4
	beq _0800C730
	b _0800C8A2
_0800C68E:
	ldr r2, _0800C69C
	ldrh r0, [r2]
	cmp r0, 0
	beq _0800C6A0
	subs r0, 0x1
	strh r0, [r2]
	b _0800C8A2
	.align 2, 0
_0800C69C: .4byte gUnknown_202D692
_0800C6A0:
	ldr r3, _0800C6B4
	ldrh r1, [r3]
	ldr r0, _0800C6B8
	cmp r1, r0
	bne _0800C6BC
	movs r0, 0x4
	strh r0, [r4]
	movs r0, 0x20
	strh r0, [r2]
	b _0800C8A2
	.align 2, 0
_0800C6B4: .4byte gUnknown_202D68E
_0800C6B8: .4byte 0x000003e5
_0800C6BC:
	ldrh r0, [r3]
	b _0800C6E4
_0800C6C0:
	ldr r0, _0800C6F0
	ldrh r1, [r0]
	ldr r0, _0800C6F4
	cmp r1, r0
	beq _0800C6D8
	movs r0, 0
	bl sub_800CAF0
	lsls r0, 24
	cmp r0, 0
	beq _0800C6D8
	b _0800C8A2
_0800C6D8:
	ldr r2, _0800C6F8
	ldrh r1, [r2]
	ldr r0, _0800C6FC
	cmp r1, r0
	beq _0800C718
	ldrh r0, [r2]
_0800C6E4:
	bl m4aSongNumStart
	movs r0, 0x3
	strh r0, [r4]
	b _0800C8A2
	.align 2, 0
_0800C6F0: .4byte gCurrentBGSong
_0800C6F4: .4byte 0x000003e7
_0800C6F8: .4byte gUnknown_202D68E
_0800C6FC: .4byte 0x000003e5
_0800C700:
	ldr r0, _0800C724
	ldrh r1, [r0]
	ldr r0, _0800C728
	cmp r1, r0
	beq _0800C718
	movs r0, 0x1
	bl sub_800CAF0
	lsls r0, 24
	cmp r0, 0
	bne _0800C718
	b _0800C8A2
_0800C718:
	movs r0, 0x4
	strh r0, [r4]
	ldr r1, _0800C72C
	movs r0, 0x20
	strh r0, [r1]
	b _0800C8A2
	.align 2, 0
_0800C724: .4byte gUnknown_202D68E
_0800C728: .4byte 0x000003e5
_0800C72C: .4byte gUnknown_202D692
_0800C730:
	ldr r0, _0800C74C
	ldrh r1, [r0]
	ldr r0, _0800C750
	cmp r1, r0
	beq _0800C754
	movs r0, 0x1
	bl sub_800CAF0
	lsls r0, 24
	cmp r0, 0
	beq _0800C748
	b _0800C8A2
_0800C748:
	b _0800C75A
	.align 2, 0
_0800C74C: .4byte gUnknown_202D68E
_0800C750: .4byte 0x000003e5
_0800C754:
	ldr r0, _0800C76C
	bl m4aMPlayStop
_0800C75A:
	ldr r1, _0800C770
	ldrh r0, [r1]
	adds r2, r0, 0
	cmp r2, 0
	beq _0800C774
	subs r0, 0x1
	strh r0, [r1]
	b _0800C8A2
	.align 2, 0
_0800C76C: .4byte gUnknown_2000970
_0800C770: .4byte gUnknown_202D692
_0800C774:
	ldr r3, _0800C794
	ldrh r1, [r3]
	ldr r0, _0800C798
	cmp r1, r0
	beq _0800C7B4
	ldr r1, _0800C79C
	movs r0, 0x1
	strh r0, [r1]
	ldr r0, _0800C7A0
	ldrb r0, [r0]
	cmp r0, 0
	beq _0800C7A4
	ldrh r0, [r3]
	bl m4aSongNumStart
	b _0800C7BE
	.align 2, 0
_0800C794: .4byte gCurrentBGSong
_0800C798: .4byte 0x000003e7
_0800C79C: .4byte gBGMusicPlayerState
_0800C7A0: .4byte gUnknown_202D694
_0800C7A4:
	ldr r0, _0800C7B0
	movs r1, 0x4
	bl m4aMPlayFadeIn
	b _0800C7BE
	.align 2, 0
_0800C7B0: .4byte gMPlayInfo_BGM
_0800C7B4:
	ldr r0, _0800C7CC
	strh r2, [r0]
	ldr r0, _0800C7D0
	bl m4aMPlayStop
_0800C7BE:
	ldr r1, _0800C7D4
	movs r0, 0
	strh r0, [r1]
	ldr r1, _0800C7D8
	ldr r2, _0800C7DC
	b _0800C84C
	.align 2, 0
_0800C7CC: .4byte gBGMusicPlayerState
_0800C7D0: .4byte gMPlayInfo_BGM
_0800C7D4: .4byte gUnknown_202D690
_0800C7D8: .4byte gUnknown_202D68E
_0800C7DC: .4byte 0x000003e5
_0800C7E0:
	ldr r5, _0800C810
	ldrh r0, [r5]
	cmp r0, 0
	beq _0800C864
	cmp r0, 0x3
	bgt _0800C8A2
	cmp r0, 0x2
	bge _0800C81C
	cmp r0, 0x1
	bne _0800C8A2
	ldr r0, _0800C814
	ldrh r1, [r0]
	ldr r0, _0800C818
	cmp r1, r0
	beq _0800C80A
	movs r0, 0
	bl sub_800CAF0
	lsls r0, 24
	cmp r0, 0
	beq _0800C8A2
_0800C80A:
	movs r0, 0x2
	strh r0, [r5]
	b _0800C8A2
	.align 2, 0
_0800C810: .4byte gBGMusicPlayerState
_0800C814: .4byte gCurrentBGSong
_0800C818: .4byte 0x000003e7
_0800C81C:
	ldr r0, _0800C834
	ldrh r1, [r0]
	ldr r0, _0800C838
	cmp r1, r0
	beq _0800C83C
	movs r0, 0
	bl sub_800CAF0
	lsls r0, 24
	cmp r0, 0
	bne _0800C8A2
	b _0800C842
	.align 2, 0
_0800C834: .4byte gCurrentBGSong
_0800C838: .4byte 0x000003e7
_0800C83C:
	ldr r0, _0800C854
	bl m4aMPlayStop
_0800C842:
	ldr r1, _0800C858
	movs r0, 0
	strh r0, [r1]
	ldr r1, _0800C85C
	ldr r2, _0800C860
_0800C84C:
	adds r0, r2, 0
	strh r0, [r1]
	b _0800C8A2
	.align 2, 0
_0800C854: .4byte gMPlayInfo_BGM
_0800C858: .4byte gBGMusicPlayerState
_0800C85C: .4byte gCurrentBGSong
_0800C860: .4byte 0x000003e7
_0800C864:
	movs r0, 0
	bl sub_800CAF0
	lsls r0, 24
	lsrs r0, 24
	cmp r0, 0
	bne _0800C8A2
	ldr r6, _0800C890
	ldrh r2, [r6]
	adds r1, r2, 0
	ldr r4, _0800C894
	cmp r1, r4
	beq _0800C89C
	movs r0, 0x1
	strh r0, [r5]
	ldr r0, _0800C898
	strh r2, [r0]
	adds r0, r1, 0
	bl m4aSongNumStart
	strh r4, [r6]
	b _0800C8A2
	.align 2, 0
_0800C890: .4byte gUnknown_202D68C
_0800C894: .4byte 0x000003e7
_0800C898: .4byte gCurrentBGSong
_0800C89C:
	strh r0, [r5]
	ldr r0, _0800C8C4
	strh r1, [r0]
_0800C8A2:
	movs r5, 0x2
	ldr r4, _0800C8C8
	ldr r0, _0800C8CC
	mov r8, r0
	movs r6, 0x18
	movs r7, 0
_0800C8AE:
	ldrh r1, [r4, 0x2]
	cmp r1, r8
	beq _0800C926
	ldrh r0, [r4]
	cmp r0, 0x1
	beq _0800C8D0
	cmp r0, 0x1
	ble _0800C926
	cmp r0, 0x2
	beq _0800C8F0
	b _0800C926
	.align 2, 0
_0800C8C4: .4byte gCurrentBGSong
_0800C8C8: .4byte gUnknown_3000FE8
_0800C8CC: .4byte 0x000003e5
_0800C8D0:
	ldr r0, _0800C8EC
	cmp r1, r0
	beq _0800C8E4
	lsls r0, r5, 16
	lsrs r0, 16
	bl sub_800CAF0
	lsls r0, 24
	cmp r0, 0
	beq _0800C926
_0800C8E4:
	movs r0, 0x2
	strh r0, [r4]
	b _0800C926
	.align 2, 0
_0800C8EC: .4byte 0x000003e7
_0800C8F0:
	lsls r0, r5, 16
	lsrs r0, 16
	bl sub_800CAF0
	lsls r0, 24
	lsrs r0, 24
	cmp r0, 0
	beq _0800C91C
	ldrb r0, [r4, 0x6]
	cmp r0, 0
	beq _0800C926
	strb r7, [r4, 0x6]
	ldr r0, _0800C918
	adds r0, r6, r0
	ldr r0, [r0]
	ldrh r2, [r4, 0x4]
	movs r1, 0xFF
	bl m4aMPlayVolumeControl
	b _0800C926
	.align 2, 0
_0800C918: .4byte gMPlayTable
_0800C91C:
	strh r0, [r4]
	mov r1, r8
	strh r1, [r4, 0x2]
	strh r0, [r4, 0x4]
	strb r7, [r4, 0x6]
_0800C926:
	adds r6, 0xC
	adds r5, 0x1
	adds r4, 0x8
	cmp r5, 0x6
	ble _0800C8AE
	pop {r3}
	mov r8, r3
	pop {r4-r7}
	pop {r0}
	bx r0
	thumb_func_end UpdateSound

        .align 2,0