summaryrefslogtreecommitdiff
path: root/asm/Dolphin/gx/GXMisc.s
blob: d1ba191236945e9fdd2e039a84b4a5219d27990c (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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
.include "macros.inc"

.section .text, "ax"  # 0x80005600 - 0x8036FBA0
.global GXSetMisc
GXSetMisc:
/* 800A8198 000A50D8  2C 03 00 01 */	cmpwi r3, 1
/* 800A819C 000A50DC  41 82 00 14 */	beq lbl_800A81B0
/* 800A81A0 000A50E0  4D 80 00 20 */	bltlr 
/* 800A81A4 000A50E4  2C 03 00 03 */	cmpwi r3, 3
/* 800A81A8 000A50E8  4C 80 00 20 */	bgelr 
/* 800A81AC 000A50EC  48 00 00 4C */	b lbl_800A81F8
lbl_800A81B0:
/* 800A81B0 000A50F0  80 6D 82 C8 */	lwz r3, gx@sda21(r13)
/* 800A81B4 000A50F4  38 00 00 01 */	li r0, 1
/* 800A81B8 000A50F8  B0 83 00 04 */	sth r4, 4(r3)
/* 800A81BC 000A50FC  80 8D 82 C8 */	lwz r4, gx@sda21(r13)
/* 800A81C0 000A5100  A0 64 00 04 */	lhz r3, 4(r4)
/* 800A81C4 000A5104  7C 63 00 34 */	cntlzw r3, r3
/* 800A81C8 000A5108  54 63 DC 3E */	rlwinm r3, r3, 0x1b, 0x10, 0x1f
/* 800A81CC 000A510C  B0 64 00 00 */	sth r3, 0(r4)
/* 800A81D0 000A5110  80 6D 82 C8 */	lwz r3, gx@sda21(r13)
/* 800A81D4 000A5114  B0 03 00 02 */	sth r0, 2(r3)
/* 800A81D8 000A5118  80 6D 82 C8 */	lwz r3, gx@sda21(r13)
/* 800A81DC 000A511C  A0 03 00 04 */	lhz r0, 4(r3)
/* 800A81E0 000A5120  28 00 00 00 */	cmplwi r0, 0
/* 800A81E4 000A5124  4D 82 00 20 */	beqlr 
/* 800A81E8 000A5128  80 03 04 F4 */	lwz r0, 0x4f4(r3)
/* 800A81EC 000A512C  60 00 00 08 */	ori r0, r0, 8
/* 800A81F0 000A5130  90 03 04 F4 */	stw r0, 0x4f4(r3)
/* 800A81F4 000A5134  4E 80 00 20 */	blr 
lbl_800A81F8:
/* 800A81F8 000A5138  7C 84 00 D0 */	neg r4, r4
/* 800A81FC 000A513C  80 6D 82 C8 */	lwz r3, gx@sda21(r13)
/* 800A8200 000A5140  30 04 FF FF */	addic r0, r4, -1
/* 800A8204 000A5144  7C 00 21 10 */	subfe r0, r0, r4
/* 800A8208 000A5148  98 03 04 F1 */	stb r0, 0x4f1(r3)
/* 800A820C 000A514C  4E 80 00 20 */	blr 

.global GXFlush
GXFlush:
/* 800A8210 000A5150  7C 08 02 A6 */	mflr r0
/* 800A8214 000A5154  90 01 00 04 */	stw r0, 4(r1)
/* 800A8218 000A5158  94 21 FF F8 */	stwu r1, -8(r1)
/* 800A821C 000A515C  80 6D 82 C8 */	lwz r3, gx@sda21(r13)
/* 800A8220 000A5160  80 03 04 F4 */	lwz r0, 0x4f4(r3)
/* 800A8224 000A5164  28 00 00 00 */	cmplwi r0, 0
/* 800A8228 000A5168  41 82 00 08 */	beq lbl_800A8230
/* 800A822C 000A516C  48 00 05 DD */	bl __GXSetDirtyState
lbl_800A8230:
/* 800A8230 000A5170  38 00 00 00 */	li r0, 0
/* 800A8234 000A5174  3C 60 CC 01 */	lis r3, 0xCC008000@ha
/* 800A8238 000A5178  90 03 80 00 */	stw r0, 0xCC008000@l(r3)
/* 800A823C 000A517C  90 03 80 00 */	stw r0, -0x8000(r3)
/* 800A8240 000A5180  90 03 80 00 */	stw r0, -0x8000(r3)
/* 800A8244 000A5184  90 03 80 00 */	stw r0, -0x8000(r3)
/* 800A8248 000A5188  90 03 80 00 */	stw r0, -0x8000(r3)
/* 800A824C 000A518C  90 03 80 00 */	stw r0, -0x8000(r3)
/* 800A8250 000A5190  90 03 80 00 */	stw r0, -0x8000(r3)
/* 800A8254 000A5194  90 03 80 00 */	stw r0, -0x8000(r3)
/* 800A8258 000A5198  4B FE 41 81 */	bl PPCSync
/* 800A825C 000A519C  80 01 00 0C */	lwz r0, 0xc(r1)
/* 800A8260 000A51A0  38 21 00 08 */	addi r1, r1, 8
/* 800A8264 000A51A4  7C 08 03 A6 */	mtlr r0
/* 800A8268 000A51A8  4E 80 00 20 */	blr 

.global GXSetDrawSync
GXSetDrawSync:
/* 800A826C 000A51AC  7C 08 02 A6 */	mflr r0
/* 800A8270 000A51B0  90 01 00 04 */	stw r0, 4(r1)
/* 800A8274 000A51B4  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 800A8278 000A51B8  93 E1 00 14 */	stw r31, 0x14(r1)
/* 800A827C 000A51BC  93 C1 00 10 */	stw r30, 0x10(r1)
/* 800A8280 000A51C0  7C 7E 1B 78 */	mr r30, r3
/* 800A8284 000A51C4  4B FE 7F 49 */	bl OSDisableInterrupts
/* 800A8288 000A51C8  38 C0 00 61 */	li r6, 0x61
/* 800A828C 000A51CC  80 8D 82 C8 */	lwz r4, gx@sda21(r13)
/* 800A8290 000A51D0  3C A0 CC 01 */	lis r5, 0xCC008000@ha
/* 800A8294 000A51D4  57 C0 04 3E */	clrlwi r0, r30, 0x10
/* 800A8298 000A51D8  98 C5 80 00 */	stb r6, 0xCC008000@l(r5)
/* 800A829C 000A51DC  64 00 48 00 */	oris r0, r0, 0x4800
/* 800A82A0 000A51E0  90 05 80 00 */	stw r0, -0x8000(r5)
/* 800A82A4 000A51E4  54 00 00 1E */	rlwinm r0, r0, 0, 0, 0xf
/* 800A82A8 000A51E8  53 C0 04 3E */	rlwimi r0, r30, 0, 0x10, 0x1f
/* 800A82AC 000A51EC  54 00 02 3E */	clrlwi r0, r0, 8
/* 800A82B0 000A51F0  98 C5 80 00 */	stb r6, -0x8000(r5)
/* 800A82B4 000A51F4  64 00 47 00 */	oris r0, r0, 0x4700
/* 800A82B8 000A51F8  90 05 80 00 */	stw r0, -0x8000(r5)
/* 800A82BC 000A51FC  7C 7E 1B 78 */	mr r30, r3
/* 800A82C0 000A5200  80 04 04 F4 */	lwz r0, 0x4f4(r4)
/* 800A82C4 000A5204  28 00 00 00 */	cmplwi r0, 0
/* 800A82C8 000A5208  41 82 00 08 */	beq lbl_800A82D0
/* 800A82CC 000A520C  48 00 05 3D */	bl __GXSetDirtyState
lbl_800A82D0:
/* 800A82D0 000A5210  3B E0 00 00 */	li r31, 0
/* 800A82D4 000A5214  3C 60 CC 01 */	lis r3, 0xCC008000@ha
/* 800A82D8 000A5218  93 E3 80 00 */	stw r31, 0xCC008000@l(r3)
/* 800A82DC 000A521C  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A82E0 000A5220  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A82E4 000A5224  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A82E8 000A5228  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A82EC 000A522C  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A82F0 000A5230  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A82F4 000A5234  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A82F8 000A5238  4B FE 40 E1 */	bl PPCSync
/* 800A82FC 000A523C  7F C3 F3 78 */	mr r3, r30
/* 800A8300 000A5240  4B FE 7E F5 */	bl OSRestoreInterrupts
/* 800A8304 000A5244  80 6D 82 C8 */	lwz r3, gx@sda21(r13)
/* 800A8308 000A5248  B3 E3 00 02 */	sth r31, 2(r3)
/* 800A830C 000A524C  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 800A8310 000A5250  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 800A8314 000A5254  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 800A8318 000A5258  38 21 00 18 */	addi r1, r1, 0x18
/* 800A831C 000A525C  7C 08 03 A6 */	mtlr r0
/* 800A8320 000A5260  4E 80 00 20 */	blr 

.global GXSetDrawDone
GXSetDrawDone:
/* 800A8324 000A5264  7C 08 02 A6 */	mflr r0
/* 800A8328 000A5268  90 01 00 04 */	stw r0, 4(r1)
/* 800A832C 000A526C  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 800A8330 000A5270  93 E1 00 14 */	stw r31, 0x14(r1)
/* 800A8334 000A5274  93 C1 00 10 */	stw r30, 0x10(r1)
/* 800A8338 000A5278  4B FE 7E 95 */	bl OSDisableInterrupts
/* 800A833C 000A527C  38 00 00 61 */	li r0, 0x61
/* 800A8340 000A5280  80 8D 82 C8 */	lwz r4, gx@sda21(r13)
/* 800A8344 000A5284  3C C0 CC 01 */	lis r6, 0xCC008000@ha
/* 800A8348 000A5288  3C A0 45 00 */	lis r5, 0x45000002@ha
/* 800A834C 000A528C  98 06 80 00 */	stb r0, 0xCC008000@l(r6)
/* 800A8350 000A5290  38 05 00 02 */	addi r0, r5, 0x45000002@l
/* 800A8354 000A5294  90 06 80 00 */	stw r0, -0x8000(r6)
/* 800A8358 000A5298  7C 7E 1B 78 */	mr r30, r3
/* 800A835C 000A529C  80 04 04 F4 */	lwz r0, 0x4f4(r4)
/* 800A8360 000A52A0  28 00 00 00 */	cmplwi r0, 0
/* 800A8364 000A52A4  41 82 00 08 */	beq lbl_800A836C
/* 800A8368 000A52A8  48 00 04 A1 */	bl __GXSetDirtyState
lbl_800A836C:
/* 800A836C 000A52AC  3B E0 00 00 */	li r31, 0
/* 800A8370 000A52B0  3C 60 CC 01 */	lis r3, 0xCC008000@ha
/* 800A8374 000A52B4  93 E3 80 00 */	stw r31, 0xCC008000@l(r3)
/* 800A8378 000A52B8  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A837C 000A52BC  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A8380 000A52C0  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A8384 000A52C4  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A8388 000A52C8  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A838C 000A52CC  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A8390 000A52D0  93 E3 80 00 */	stw r31, -0x8000(r3)
/* 800A8394 000A52D4  4B FE 40 45 */	bl PPCSync
/* 800A8398 000A52D8  9B ED 95 90 */	stb r31, DrawDone@sda21(r13)
/* 800A839C 000A52DC  7F C3 F3 78 */	mr r3, r30
/* 800A83A0 000A52E0  4B FE 7E 55 */	bl OSRestoreInterrupts
/* 800A83A4 000A52E4  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 800A83A8 000A52E8  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 800A83AC 000A52EC  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 800A83B0 000A52F0  38 21 00 18 */	addi r1, r1, 0x18
/* 800A83B4 000A52F4  7C 08 03 A6 */	mtlr r0
/* 800A83B8 000A52F8  4E 80 00 20 */	blr 

.global GXWaitDrawDone
GXWaitDrawDone:
/* 800A83BC 000A52FC  7C 08 02 A6 */	mflr r0
/* 800A83C0 000A5300  90 01 00 04 */	stw r0, 4(r1)
/* 800A83C4 000A5304  94 21 FF F0 */	stwu r1, -0x10(r1)
/* 800A83C8 000A5308  93 E1 00 0C */	stw r31, 0xc(r1)
/* 800A83CC 000A530C  4B FE 7E 01 */	bl OSDisableInterrupts
/* 800A83D0 000A5310  7C 7F 1B 78 */	mr r31, r3
/* 800A83D4 000A5314  48 00 00 0C */	b lbl_800A83E0
lbl_800A83D8:
/* 800A83D8 000A5318  38 6D 95 94 */	addi r3, r13, FinishQueue@sda21
/* 800A83DC 000A531C  4B FE B8 25 */	bl OSSleepThread
lbl_800A83E0:
/* 800A83E0 000A5320  88 0D 95 90 */	lbz r0, DrawDone@sda21(r13)
/* 800A83E4 000A5324  28 00 00 00 */	cmplwi r0, 0
/* 800A83E8 000A5328  41 82 FF F0 */	beq lbl_800A83D8
/* 800A83EC 000A532C  7F E3 FB 78 */	mr r3, r31
/* 800A83F0 000A5330  4B FE 7E 05 */	bl OSRestoreInterrupts
/* 800A83F4 000A5334  80 01 00 14 */	lwz r0, 0x14(r1)
/* 800A83F8 000A5338  83 E1 00 0C */	lwz r31, 0xc(r1)
/* 800A83FC 000A533C  38 21 00 10 */	addi r1, r1, 0x10
/* 800A8400 000A5340  7C 08 03 A6 */	mtlr r0
/* 800A8404 000A5344  4E 80 00 20 */	blr 

.global GXDrawDone
GXDrawDone:
/* 800A8408 000A5348  7C 08 02 A6 */	mflr r0
/* 800A840C 000A534C  90 01 00 04 */	stw r0, 4(r1)
/* 800A8410 000A5350  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 800A8414 000A5354  93 E1 00 14 */	stw r31, 0x14(r1)
/* 800A8418 000A5358  4B FE 7D B5 */	bl OSDisableInterrupts
/* 800A841C 000A535C  38 00 00 61 */	li r0, 0x61
/* 800A8420 000A5360  3C A0 CC 01 */	lis r5, 0xCC008000@ha
/* 800A8424 000A5364  3C 80 45 00 */	lis r4, 0x45000002@ha
/* 800A8428 000A5368  98 05 80 00 */	stb r0, 0xCC008000@l(r5)
/* 800A842C 000A536C  38 04 00 02 */	addi r0, r4, 0x45000002@l
/* 800A8430 000A5370  90 05 80 00 */	stw r0, -0x8000(r5)
/* 800A8434 000A5374  7C 7F 1B 78 */	mr r31, r3
/* 800A8438 000A5378  4B FF FD D9 */	bl GXFlush
/* 800A843C 000A537C  38 00 00 00 */	li r0, 0
/* 800A8440 000A5380  98 0D 95 90 */	stb r0, DrawDone@sda21(r13)
/* 800A8444 000A5384  7F E3 FB 78 */	mr r3, r31
/* 800A8448 000A5388  4B FE 7D AD */	bl OSRestoreInterrupts
/* 800A844C 000A538C  4B FE 7D 81 */	bl OSDisableInterrupts
/* 800A8450 000A5390  7C 7F 1B 78 */	mr r31, r3
/* 800A8454 000A5394  48 00 00 0C */	b lbl_800A8460
lbl_800A8458:
/* 800A8458 000A5398  38 6D 95 94 */	addi r3, r13, FinishQueue@sda21
/* 800A845C 000A539C  4B FE B7 A5 */	bl OSSleepThread
lbl_800A8460:
/* 800A8460 000A53A0  88 0D 95 90 */	lbz r0, DrawDone@sda21(r13)
/* 800A8464 000A53A4  28 00 00 00 */	cmplwi r0, 0
/* 800A8468 000A53A8  41 82 FF F0 */	beq lbl_800A8458
/* 800A846C 000A53AC  7F E3 FB 78 */	mr r3, r31
/* 800A8470 000A53B0  4B FE 7D 85 */	bl OSRestoreInterrupts
/* 800A8474 000A53B4  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 800A8478 000A53B8  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 800A847C 000A53BC  38 21 00 18 */	addi r1, r1, 0x18
/* 800A8480 000A53C0  7C 08 03 A6 */	mtlr r0
/* 800A8484 000A53C4  4E 80 00 20 */	blr 

.global GXPixModeSync
GXPixModeSync:
/* 800A8488 000A53C8  38 00 00 61 */	li r0, 0x61
/* 800A848C 000A53CC  80 8D 82 C8 */	lwz r4, gx@sda21(r13)
/* 800A8490 000A53D0  3C A0 CC 01 */	lis r5, 0xCC008000@ha
/* 800A8494 000A53D4  98 05 80 00 */	stb r0, 0xCC008000@l(r5)
/* 800A8498 000A53D8  38 00 00 00 */	li r0, 0
/* 800A849C 000A53DC  80 64 01 DC */	lwz r3, 0x1dc(r4)
/* 800A84A0 000A53E0  90 65 80 00 */	stw r3, -0x8000(r5)
/* 800A84A4 000A53E4  B0 04 00 02 */	sth r0, 2(r4)
/* 800A84A8 000A53E8  4E 80 00 20 */	blr 

.global GXPokeAlphaMode
GXPokeAlphaMode:
/* 800A84AC 000A53EC  80 AD 95 60 */	lwz r5, __peReg@sda21(r13)
/* 800A84B0 000A53F0  54 80 06 3E */	clrlwi r0, r4, 0x18
/* 800A84B4 000A53F4  50 60 40 2E */	rlwimi r0, r3, 8, 0, 0x17
/* 800A84B8 000A53F8  B0 05 00 06 */	sth r0, 6(r5)
/* 800A84BC 000A53FC  4E 80 00 20 */	blr 

.global GXPokeAlphaRead
GXPokeAlphaRead:
/* 800A84C0 000A5400  54 60 07 B8 */	rlwinm r0, r3, 0, 0x1e, 0x1c
/* 800A84C4 000A5404  80 6D 95 60 */	lwz r3, __peReg@sda21(r13)
/* 800A84C8 000A5408  60 00 00 04 */	ori r0, r0, 4
/* 800A84CC 000A540C  B0 03 00 08 */	sth r0, 8(r3)
/* 800A84D0 000A5410  4E 80 00 20 */	blr 

.global GXPokeAlphaUpdate
GXPokeAlphaUpdate:
/* 800A84D4 000A5414  80 8D 95 60 */	lwz r4, __peReg@sda21(r13)
/* 800A84D8 000A5418  54 60 25 36 */	rlwinm r0, r3, 4, 0x14, 0x1b
/* 800A84DC 000A541C  A4 64 00 02 */	lhzu r3, 2(r4)
/* 800A84E0 000A5420  54 63 07 34 */	rlwinm r3, r3, 0, 0x1c, 0x1a
/* 800A84E4 000A5424  7C 60 03 78 */	or r0, r3, r0
/* 800A84E8 000A5428  B0 04 00 00 */	sth r0, 0(r4)
/* 800A84EC 000A542C  4E 80 00 20 */	blr 

.global GXPokeBlendMode
GXPokeBlendMode:
/* 800A84F0 000A5430  80 ED 95 60 */	lwz r7, __peReg@sda21(r13)
/* 800A84F4 000A5434  2C 03 00 01 */	cmpwi r3, 1
/* 800A84F8 000A5438  39 20 00 01 */	li r9, 1
/* 800A84FC 000A543C  39 47 00 02 */	addi r10, r7, 2
/* 800A8500 000A5440  A0 E7 00 02 */	lhz r7, 2(r7)
/* 800A8504 000A5444  41 82 00 10 */	beq lbl_800A8514
/* 800A8508 000A5448  2C 03 00 03 */	cmpwi r3, 3
/* 800A850C 000A544C  41 82 00 08 */	beq lbl_800A8514
/* 800A8510 000A5450  39 20 00 00 */	li r9, 0
lbl_800A8514:
/* 800A8514 000A5454  54 E8 00 3C */	rlwinm r8, r7, 0, 0, 0x1e
/* 800A8518 000A5458  20 03 00 03 */	subfic r0, r3, 3
/* 800A851C 000A545C  7C 07 00 34 */	cntlzw r7, r0
/* 800A8520 000A5460  20 03 00 02 */	subfic r0, r3, 2
/* 800A8524 000A5464  7D 08 4B 78 */	or r8, r8, r9
/* 800A8528 000A5468  7C 00 00 34 */	cntlzw r0, r0
/* 800A852C 000A546C  55 08 05 66 */	rlwinm r8, r8, 0, 0x15, 0x13
/* 800A8530 000A5470  54 E3 30 28 */	rlwinm r3, r7, 6, 0, 0x14
/* 800A8534 000A5474  7D 03 1B 78 */	or r3, r8, r3
/* 800A8538 000A5478  54 63 07 FA */	rlwinm r3, r3, 0, 0x1f, 0x1d
/* 800A853C 000A547C  54 00 E1 3C */	rlwinm r0, r0, 0x1c, 4, 0x1e
/* 800A8540 000A5480  7C 60 03 78 */	or r0, r3, r0
/* 800A8544 000A5484  54 03 05 1E */	rlwinm r3, r0, 0, 0x14, 0xf
/* 800A8548 000A5488  54 C0 60 26 */	slwi r0, r6, 0xc
/* 800A854C 000A548C  7C 60 03 78 */	or r0, r3, r0
/* 800A8550 000A5490  54 03 06 28 */	rlwinm r3, r0, 0, 0x18, 0x14
/* 800A8554 000A5494  54 80 40 2E */	slwi r0, r4, 8
/* 800A8558 000A5498  7C 60 03 78 */	or r0, r3, r0
/* 800A855C 000A549C  54 03 06 EE */	rlwinm r3, r0, 0, 0x1b, 0x17
/* 800A8560 000A54A0  54 A0 28 34 */	slwi r0, r5, 5
/* 800A8564 000A54A4  7C 60 03 78 */	or r0, r3, r0
/* 800A8568 000A54A8  54 00 02 3E */	clrlwi r0, r0, 8
/* 800A856C 000A54AC  64 00 41 00 */	oris r0, r0, 0x4100
/* 800A8570 000A54B0  B0 0A 00 00 */	sth r0, 0(r10)
/* 800A8574 000A54B4  4E 80 00 20 */	blr 

.global GXPokeColorUpdate
GXPokeColorUpdate:
/* 800A8578 000A54B8  80 8D 95 60 */	lwz r4, __peReg@sda21(r13)
/* 800A857C 000A54BC  54 60 1D 78 */	rlwinm r0, r3, 3, 0x15, 0x1c
/* 800A8580 000A54C0  A4 64 00 02 */	lhzu r3, 2(r4)
/* 800A8584 000A54C4  54 63 07 76 */	rlwinm r3, r3, 0, 0x1d, 0x1b
/* 800A8588 000A54C8  7C 60 03 78 */	or r0, r3, r0
/* 800A858C 000A54CC  B0 04 00 00 */	sth r0, 0(r4)
/* 800A8590 000A54D0  4E 80 00 20 */	blr 

.global GXPokeDstAlpha
GXPokeDstAlpha:
/* 800A8594 000A54D4  80 AD 95 60 */	lwz r5, __peReg@sda21(r13)
/* 800A8598 000A54D8  54 60 44 2E */	rlwinm r0, r3, 8, 0x10, 0x17
/* 800A859C 000A54DC  50 80 06 3E */	rlwimi r0, r4, 0, 0x18, 0x1f
/* 800A85A0 000A54E0  B0 05 00 04 */	sth r0, 4(r5)
/* 800A85A4 000A54E4  4E 80 00 20 */	blr 

.global GXPokeDither
GXPokeDither:
/* 800A85A8 000A54E8  80 8D 95 60 */	lwz r4, __peReg@sda21(r13)
/* 800A85AC 000A54EC  54 60 15 BA */	rlwinm r0, r3, 2, 0x16, 0x1d
/* 800A85B0 000A54F0  A4 64 00 02 */	lhzu r3, 2(r4)
/* 800A85B4 000A54F4  54 63 07 B8 */	rlwinm r3, r3, 0, 0x1e, 0x1c
/* 800A85B8 000A54F8  7C 60 03 78 */	or r0, r3, r0
/* 800A85BC 000A54FC  B0 04 00 00 */	sth r0, 0(r4)
/* 800A85C0 000A5500  4E 80 00 20 */	blr 

.global GXPokeZMode
GXPokeZMode:
/* 800A85C4 000A5504  54 60 06 3E */	clrlwi r0, r3, 0x18
/* 800A85C8 000A5508  80 6D 95 60 */	lwz r3, __peReg@sda21(r13)
/* 800A85CC 000A550C  54 06 07 F6 */	rlwinm r6, r0, 0, 0x1f, 0x1b
/* 800A85D0 000A5510  54 80 08 3C */	slwi r0, r4, 1
/* 800A85D4 000A5514  7C C0 03 78 */	or r0, r6, r0
/* 800A85D8 000A5518  54 04 07 34 */	rlwinm r4, r0, 0, 0x1c, 0x1a
/* 800A85DC 000A551C  54 A0 25 36 */	rlwinm r0, r5, 4, 0x14, 0x1b
/* 800A85E0 000A5520  7C 80 03 78 */	or r0, r4, r0
/* 800A85E4 000A5524  B0 03 00 00 */	sth r0, 0(r3)
/* 800A85E8 000A5528  4E 80 00 20 */	blr 

.global GXPeekARGB
GXPeekARGB:
/* 800A85EC 000A552C  54 60 13 BA */	rlwinm r0, r3, 2, 0xe, 0x1d
/* 800A85F0 000A5530  64 00 C8 00 */	oris r0, r0, 0xc800
/* 800A85F4 000A5534  54 03 05 12 */	rlwinm r3, r0, 0, 0x14, 9
/* 800A85F8 000A5538  54 80 61 26 */	rlwinm r0, r4, 0xc, 4, 0x13
/* 800A85FC 000A553C  7C 60 03 78 */	or r0, r3, r0
/* 800A8600 000A5540  54 03 02 8E */	rlwinm r3, r0, 0, 0xa, 7
/* 800A8604 000A5544  80 03 00 00 */	lwz r0, 0(r3)
/* 800A8608 000A5548  90 05 00 00 */	stw r0, 0(r5)
/* 800A860C 000A554C  4E 80 00 20 */	blr 

.global GXPeekZ
GXPeekZ:
/* 800A8610 000A5550  54 60 13 BA */	rlwinm r0, r3, 2, 0xe, 0x1d
/* 800A8614 000A5554  64 00 C8 00 */	oris r0, r0, 0xc800
/* 800A8618 000A5558  54 03 05 12 */	rlwinm r3, r0, 0, 0x14, 9
/* 800A861C 000A555C  54 80 61 26 */	rlwinm r0, r4, 0xc, 4, 0x13
/* 800A8620 000A5560  7C 60 03 78 */	or r0, r3, r0
/* 800A8624 000A5564  54 00 02 8E */	rlwinm r0, r0, 0, 0xa, 7
/* 800A8628 000A5568  64 03 00 40 */	oris r3, r0, 0x40
/* 800A862C 000A556C  80 03 00 00 */	lwz r0, 0(r3)
/* 800A8630 000A5570  90 05 00 00 */	stw r0, 0(r5)
/* 800A8634 000A5574  4E 80 00 20 */	blr 

.global GXSetDrawSyncCallback
GXSetDrawSyncCallback:
/* 800A8638 000A5578  7C 08 02 A6 */	mflr r0
/* 800A863C 000A557C  90 01 00 04 */	stw r0, 4(r1)
/* 800A8640 000A5580  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 800A8644 000A5584  93 E1 00 14 */	stw r31, 0x14(r1)
/* 800A8648 000A5588  93 C1 00 10 */	stw r30, 0x10(r1)
/* 800A864C 000A558C  7C 7E 1B 78 */	mr r30, r3
/* 800A8650 000A5590  83 ED 95 88 */	lwz r31, TokenCB@sda21(r13)
/* 800A8654 000A5594  4B FE 7B 79 */	bl OSDisableInterrupts
/* 800A8658 000A5598  93 CD 95 88 */	stw r30, TokenCB@sda21(r13)
/* 800A865C 000A559C  4B FE 7B 99 */	bl OSRestoreInterrupts
/* 800A8660 000A55A0  7F E3 FB 78 */	mr r3, r31
/* 800A8664 000A55A4  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 800A8668 000A55A8  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 800A866C 000A55AC  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 800A8670 000A55B0  38 21 00 18 */	addi r1, r1, 0x18
/* 800A8674 000A55B4  7C 08 03 A6 */	mtlr r0
/* 800A8678 000A55B8  4E 80 00 20 */	blr 

.global GXTokenInterruptHandler
GXTokenInterruptHandler:
/* 800A867C 000A55BC  7C 08 02 A6 */	mflr r0
/* 800A8680 000A55C0  90 01 00 04 */	stw r0, 4(r1)
/* 800A8684 000A55C4  94 21 FD 20 */	stwu r1, -0x2e0(r1)
/* 800A8688 000A55C8  93 E1 02 DC */	stw r31, 0x2dc(r1)
/* 800A868C 000A55CC  93 C1 02 D8 */	stw r30, 0x2d8(r1)
/* 800A8690 000A55D0  7C 9E 23 78 */	mr r30, r4
/* 800A8694 000A55D4  80 0D 95 88 */	lwz r0, TokenCB@sda21(r13)
/* 800A8698 000A55D8  80 6D 95 60 */	lwz r3, __peReg@sda21(r13)
/* 800A869C 000A55DC  28 00 00 00 */	cmplwi r0, 0
/* 800A86A0 000A55E0  A3 E3 00 0E */	lhz r31, 0xe(r3)
/* 800A86A4 000A55E4  41 82 00 34 */	beq lbl_800A86D8
/* 800A86A8 000A55E8  38 61 00 10 */	addi r3, r1, 0x10
/* 800A86AC 000A55EC  4B FE 63 39 */	bl OSClearContext
/* 800A86B0 000A55F0  38 61 00 10 */	addi r3, r1, 0x10
/* 800A86B4 000A55F4  4B FE 61 69 */	bl OSSetCurrentContext
/* 800A86B8 000A55F8  81 8D 95 88 */	lwz r12, TokenCB@sda21(r13)
/* 800A86BC 000A55FC  38 7F 00 00 */	addi r3, r31, 0
/* 800A86C0 000A5600  7D 88 03 A6 */	mtlr r12
/* 800A86C4 000A5604  4E 80 00 21 */	blrl 
/* 800A86C8 000A5608  38 61 00 10 */	addi r3, r1, 0x10
/* 800A86CC 000A560C  4B FE 63 19 */	bl OSClearContext
/* 800A86D0 000A5610  7F C3 F3 78 */	mr r3, r30
/* 800A86D4 000A5614  4B FE 61 49 */	bl OSSetCurrentContext
lbl_800A86D8:
/* 800A86D8 000A5618  80 6D 95 60 */	lwz r3, __peReg@sda21(r13)
/* 800A86DC 000A561C  A4 03 00 0A */	lhzu r0, 0xa(r3)
/* 800A86E0 000A5620  54 00 07 B8 */	rlwinm r0, r0, 0, 0x1e, 0x1c
/* 800A86E4 000A5624  60 00 00 04 */	ori r0, r0, 4
/* 800A86E8 000A5628  B0 03 00 00 */	sth r0, 0(r3)
/* 800A86EC 000A562C  80 01 02 E4 */	lwz r0, 0x2e4(r1)
/* 800A86F0 000A5630  83 E1 02 DC */	lwz r31, 0x2dc(r1)
/* 800A86F4 000A5634  83 C1 02 D8 */	lwz r30, 0x2d8(r1)
/* 800A86F8 000A5638  38 21 02 E0 */	addi r1, r1, 0x2e0
/* 800A86FC 000A563C  7C 08 03 A6 */	mtlr r0
/* 800A8700 000A5640  4E 80 00 20 */	blr 

.global GXFinishInterruptHandler
GXFinishInterruptHandler:
/* 800A8704 000A5644  7C 08 02 A6 */	mflr r0
/* 800A8708 000A5648  38 60 00 01 */	li r3, 1
/* 800A870C 000A564C  90 01 00 04 */	stw r0, 4(r1)
/* 800A8710 000A5650  94 21 FD 20 */	stwu r1, -0x2e0(r1)
/* 800A8714 000A5654  93 E1 02 DC */	stw r31, 0x2dc(r1)
/* 800A8718 000A5658  3B E4 00 00 */	addi r31, r4, 0
/* 800A871C 000A565C  80 AD 95 60 */	lwz r5, __peReg@sda21(r13)
/* 800A8720 000A5660  A0 05 00 0A */	lhz r0, 0xa(r5)
/* 800A8724 000A5664  54 00 07 76 */	rlwinm r0, r0, 0, 0x1d, 0x1b
/* 800A8728 000A5668  60 00 00 08 */	ori r0, r0, 8
/* 800A872C 000A566C  B0 05 00 0A */	sth r0, 0xa(r5)
/* 800A8730 000A5670  80 0D 95 8C */	lwz r0, DrawDoneCB@sda21(r13)
/* 800A8734 000A5674  98 6D 95 90 */	stb r3, DrawDone@sda21(r13)
/* 800A8738 000A5678  28 00 00 00 */	cmplwi r0, 0
/* 800A873C 000A567C  41 82 00 30 */	beq lbl_800A876C
/* 800A8740 000A5680  38 61 00 10 */	addi r3, r1, 0x10
/* 800A8744 000A5684  4B FE 62 A1 */	bl OSClearContext
/* 800A8748 000A5688  38 61 00 10 */	addi r3, r1, 0x10
/* 800A874C 000A568C  4B FE 60 D1 */	bl OSSetCurrentContext
/* 800A8750 000A5690  81 8D 95 8C */	lwz r12, DrawDoneCB@sda21(r13)
/* 800A8754 000A5694  7D 88 03 A6 */	mtlr r12
/* 800A8758 000A5698  4E 80 00 21 */	blrl 
/* 800A875C 000A569C  38 61 00 10 */	addi r3, r1, 0x10
/* 800A8760 000A56A0  4B FE 62 85 */	bl OSClearContext
/* 800A8764 000A56A4  7F E3 FB 78 */	mr r3, r31
/* 800A8768 000A56A8  4B FE 60 B5 */	bl OSSetCurrentContext
lbl_800A876C:
/* 800A876C 000A56AC  38 6D 95 94 */	addi r3, r13, FinishQueue@sda21
/* 800A8770 000A56B0  4B FE B5 7D */	bl OSWakeupThread
/* 800A8774 000A56B4  80 01 02 E4 */	lwz r0, 0x2e4(r1)
/* 800A8778 000A56B8  83 E1 02 DC */	lwz r31, 0x2dc(r1)
/* 800A877C 000A56BC  38 21 02 E0 */	addi r1, r1, 0x2e0
/* 800A8780 000A56C0  7C 08 03 A6 */	mtlr r0
/* 800A8784 000A56C4  4E 80 00 20 */	blr 

.global __GXPEInit
__GXPEInit:
/* 800A8788 000A56C8  7C 08 02 A6 */	mflr r0
/* 800A878C 000A56CC  3C 60 80 0B */	lis r3, GXTokenInterruptHandler@ha
/* 800A8790 000A56D0  90 01 00 04 */	stw r0, 4(r1)
/* 800A8794 000A56D4  38 83 86 7C */	addi r4, r3, GXTokenInterruptHandler@l
/* 800A8798 000A56D8  38 60 00 12 */	li r3, 0x12
/* 800A879C 000A56DC  94 21 FF F8 */	stwu r1, -8(r1)
/* 800A87A0 000A56E0  4B FE 7A 79 */	bl __OSSetInterruptHandler
/* 800A87A4 000A56E4  3C 60 80 0B */	lis r3, GXFinishInterruptHandler@ha
/* 800A87A8 000A56E8  38 83 87 04 */	addi r4, r3, GXFinishInterruptHandler@l
/* 800A87AC 000A56EC  38 60 00 13 */	li r3, 0x13
/* 800A87B0 000A56F0  4B FE 7A 69 */	bl __OSSetInterruptHandler
/* 800A87B4 000A56F4  38 6D 95 94 */	addi r3, r13, FinishQueue@sda21
/* 800A87B8 000A56F8  4B FE A4 C1 */	bl OSInitThreadQueue
/* 800A87BC 000A56FC  38 60 20 00 */	li r3, 0x2000
/* 800A87C0 000A5700  4B FE 7E 5D */	bl __OSUnmaskInterrupts
/* 800A87C4 000A5704  38 60 10 00 */	li r3, 0x1000
/* 800A87C8 000A5708  4B FE 7E 55 */	bl __OSUnmaskInterrupts
/* 800A87CC 000A570C  80 6D 95 60 */	lwz r3, __peReg@sda21(r13)
/* 800A87D0 000A5710  A4 03 00 0A */	lhzu r0, 0xa(r3)
/* 800A87D4 000A5714  54 00 07 B8 */	rlwinm r0, r0, 0, 0x1e, 0x1c
/* 800A87D8 000A5718  60 00 00 04 */	ori r0, r0, 4
/* 800A87DC 000A571C  54 00 07 76 */	rlwinm r0, r0, 0, 0x1d, 0x1b
/* 800A87E0 000A5720  60 00 00 08 */	ori r0, r0, 8
/* 800A87E4 000A5724  54 00 00 3C */	rlwinm r0, r0, 0, 0, 0x1e
/* 800A87E8 000A5728  60 00 00 01 */	ori r0, r0, 1
/* 800A87EC 000A572C  54 00 07 FA */	rlwinm r0, r0, 0, 0x1f, 0x1d
/* 800A87F0 000A5730  60 00 00 02 */	ori r0, r0, 2
/* 800A87F4 000A5734  B0 03 00 00 */	sth r0, 0(r3)
/* 800A87F8 000A5738  80 01 00 0C */	lwz r0, 0xc(r1)
/* 800A87FC 000A573C  38 21 00 08 */	addi r1, r1, 8
/* 800A8800 000A5740  7C 08 03 A6 */	mtlr r0
/* 800A8804 000A5744  4E 80 00 20 */	blr 

.section .sbss, "wa"  # 0x804097C0 - 0x8040B45C
TokenCB:
	.skip 0x4
DrawDoneCB:
	.skip 0x4
DrawDone:
	.skip 0x4
FinishQueue:
	.skip 0xC