splat64 0.34.3__py3-none-any.whl → 0.35.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,702 @@
1
+ """
2
+ Utilities to write assembly-related macros.
3
+ This includes writing files like:
4
+ - include/include_asm.h
5
+ - include/macro.inc
6
+ - include/labels.inc
7
+ - include/gte_macros.inc
8
+ """
9
+
10
+ from pathlib import Path
11
+ import os
12
+
13
+ from . import options, log
14
+
15
+
16
+ def write_all_files():
17
+ write_include_asm_h()
18
+ write_assembly_inc_files()
19
+
20
+
21
+ def _write(filepath: str, contents: str):
22
+ p = Path(os.path.normpath(options.opts.base_path / filepath))
23
+ p.parent.mkdir(parents=True, exist_ok=True)
24
+ with p.open("w", encoding="UTF-8", newline="\n") as f:
25
+ f.write(contents)
26
+
27
+
28
+ def write_include_asm_h():
29
+ if not options.opts.compiler.uses_include_asm:
30
+ # These compilers do not use the `INCLUDE_ASM` macro.
31
+ return
32
+
33
+ file_data = """\
34
+ #ifndef INCLUDE_ASM_H
35
+ #define INCLUDE_ASM_H
36
+
37
+ #if !defined(M2CTX) && !defined(PERMUTER)
38
+
39
+ #ifndef INCLUDE_ASM
40
+ #define INCLUDE_ASM(FOLDER, NAME) \\
41
+ __asm__( \\
42
+ ".section .text\\n" \\
43
+ " .set noat\\n" \\
44
+ " .set noreorder\\n" \\
45
+ " .include \\"" FOLDER "/" #NAME ".s\\"\\n" \\
46
+ " .set reorder\\n" \\
47
+ " .set at\\n" \\
48
+ )
49
+ #endif
50
+ #ifndef INCLUDE_RODATA
51
+ #define INCLUDE_RODATA(FOLDER, NAME) \\
52
+ __asm__( \\
53
+ ".section .rodata\\n" \\
54
+ " .include \\"" FOLDER "/" #NAME ".s\\"\\n" \\
55
+ ".section .text" \\
56
+ )
57
+ #endif
58
+ __asm__(".include \\"include/labels.inc\\"\\n");
59
+
60
+ #else
61
+
62
+ #ifndef INCLUDE_ASM
63
+ #define INCLUDE_ASM(FOLDER, NAME)
64
+ #endif
65
+ #ifndef INCLUDE_RODATA
66
+ #define INCLUDE_RODATA(FOLDER, NAME)
67
+ #endif
68
+
69
+ #endif /* !defined(M2CTX) && !defined(PERMUTER) */
70
+
71
+ #endif /* INCLUDE_ASM_H */
72
+ """
73
+ _write("include/include_asm.h", file_data)
74
+
75
+
76
+ def write_assembly_inc_files():
77
+ func_macros = f"""\
78
+ # A function symbol.
79
+ .macro {options.opts.asm_function_macro} label, visibility=global
80
+ .\\visibility \\label
81
+ .type \\label, @function
82
+ \\label:
83
+ .ent \\label
84
+ .endm
85
+ """
86
+ if options.opts.asm_end_label != "":
87
+ func_macros += f"""
88
+ # The end of a function symbol.
89
+ .macro {options.opts.asm_end_label} label
90
+ .size \\label, . - \\label
91
+ .end \\label
92
+ .endm
93
+ """
94
+ if (
95
+ options.opts.asm_function_alt_macro != ""
96
+ and options.opts.asm_function_alt_macro != options.opts.asm_function_macro
97
+ ):
98
+ func_macros += f"""
99
+ # An alternative entry to a function.
100
+ .macro {options.opts.asm_function_alt_macro} label, visibility=global
101
+ .\\visibility \\label
102
+ .type \\label, @function
103
+ \\label:
104
+ .aent \\label
105
+ .endm
106
+ """
107
+ if (
108
+ options.opts.asm_ehtable_label_macro != ""
109
+ and options.opts.asm_ehtable_label_macro != options.opts.asm_function_macro
110
+ ):
111
+ func_macros += f"""
112
+ # A label referenced by an error handler table.
113
+ .macro {options.opts.asm_ehtable_label_macro} label, visibility=global
114
+ .\\visibility \\label
115
+ \\label:
116
+ .endm
117
+ """
118
+
119
+ jlabel_macro_labelsinc = ""
120
+ jlabel_macro_macroinc = ""
121
+ if (
122
+ options.opts.asm_jtbl_label_macro != ""
123
+ and options.opts.asm_jtbl_label_macro != options.opts.asm_function_macro
124
+ ):
125
+ jlabel_macro_labelsinc = f"""
126
+ # A label referenced by a jumptable.
127
+ .macro {options.opts.asm_jtbl_label_macro} label, visibility=global
128
+ \\label:
129
+ .endm
130
+ """
131
+ jlabel_macro_macroinc = f"""
132
+ # A label referenced by a jumptable.
133
+ .macro {options.opts.asm_jtbl_label_macro} label, visibility=global
134
+ .\\visibility \\label
135
+ .type \\label, @function
136
+ \\label:
137
+ .endm
138
+ """
139
+
140
+ data_macros = ""
141
+ if (
142
+ options.opts.asm_data_macro != ""
143
+ and options.opts.asm_data_macro != options.opts.asm_function_macro
144
+ ):
145
+ data_macros += f"""
146
+ # A data symbol.
147
+ .macro {options.opts.asm_data_macro} label, visibility=global
148
+ .\\visibility \\label
149
+ .type \\label, @object
150
+ \\label:
151
+ .endm
152
+ """
153
+ if options.opts.asm_data_end_label != "":
154
+ data_macros += f"""
155
+ # End of a data symbol.
156
+ .macro {options.opts.asm_data_end_label} label
157
+ .size \\label, . - \\label
158
+ .endm
159
+ """
160
+
161
+ nm_macros = ""
162
+ if options.opts.asm_nonmatching_label_macro != "":
163
+ nm_macros = f"""
164
+ # Label to signal the symbol haven't been matched yet.
165
+ .macro {options.opts.asm_nonmatching_label_macro} label, size=1
166
+ .global \\label\\().NON_MATCHING
167
+ .type \\label\\().NON_MATCHING, @object
168
+ .size \\label\\().NON_MATCHING, \\size
169
+ \\label\\().NON_MATCHING:
170
+ .endm
171
+ """
172
+
173
+ labels_inc = f"""\
174
+ {func_macros}
175
+ {jlabel_macro_labelsinc}
176
+ {data_macros}
177
+ {nm_macros}\
178
+ """
179
+ macros_inc = f"""\
180
+ {func_macros}
181
+ {jlabel_macro_macroinc}
182
+ {data_macros}
183
+ {nm_macros}\
184
+ """
185
+
186
+ if options.opts.compiler.uses_include_asm:
187
+ # File used by original assembler
188
+ preamble = "# This file is used by the original compiler/assembler.\n# Defines the expected assembly macros.\n"
189
+ _write("include/labels.inc", f"{preamble}\n{labels_inc}")
190
+
191
+ if options.opts.platform in {"n64", "psx"}:
192
+ gas = macros_inc
193
+ elif options.opts.platform in {"ps2", "psp"}:
194
+ # ps2 and psp usually use c++ mangled names, so we need to quote those
195
+ # names when using modern gas to avoid build errors.
196
+ # This means we can't reuse the labels.inc file.
197
+ gas = macros_inc.replace("\\label", '"\\label"').replace(
198
+ '"\\label"\\().NON_MATCHING', '"\\label\\().NON_MATCHING"'
199
+ )
200
+ elif not options.opts.is_unsupported_platform:
201
+ log.error(f"Unknown platform '{options.opts.platform}'")
202
+ else:
203
+ gas = macros_inc
204
+
205
+ if options.opts.platform == "n64":
206
+ gas += """
207
+ # COP0 register aliases
208
+
209
+ .set Index, $0
210
+ .set Random, $1
211
+ .set EntryLo0, $2
212
+ .set EntryLo1, $3
213
+ .set Context, $4
214
+ .set PageMask, $5
215
+ .set Wired, $6
216
+ .set Reserved07, $7
217
+ .set BadVaddr, $8
218
+ .set Count, $9
219
+ .set EntryHi, $10
220
+ .set Compare, $11
221
+ .set Status, $12
222
+ .set Cause, $13
223
+ .set EPC, $14
224
+ .set PRevID, $15
225
+ .set Config, $16
226
+ .set LLAddr, $17
227
+ .set WatchLo, $18
228
+ .set WatchHi, $19
229
+ .set XContext, $20
230
+ .set Reserved21, $21
231
+ .set Reserved22, $22
232
+ .set Reserved23, $23
233
+ .set Reserved24, $24
234
+ .set Reserved25, $25
235
+ .set PErr, $26
236
+ .set CacheErr, $27
237
+ .set TagLo, $28
238
+ .set TagHi, $29
239
+ .set ErrorEPC, $30
240
+ .set Reserved31, $31
241
+
242
+ # Float register aliases
243
+
244
+ .set $fv0, $f0
245
+ .set $fv0f, $f1
246
+ .set $fv1, $f2
247
+ .set $fv1f, $f3
248
+ .set $ft0, $f4
249
+ .set $ft0f, $f5
250
+ .set $ft1, $f6
251
+ .set $ft1f, $f7
252
+ .set $ft2, $f8
253
+ .set $ft2f, $f9
254
+ .set $ft3, $f10
255
+ .set $ft3f, $f11
256
+ .set $fa0, $f12
257
+ .set $fa0f, $f13
258
+ .set $fa1, $f14
259
+ .set $fa1f, $f15
260
+ .set $ft4, $f16
261
+ .set $ft4f, $f17
262
+ .set $ft5, $f18
263
+ .set $ft5f, $f19
264
+ .set $fs0, $f20
265
+ .set $fs0f, $f21
266
+ .set $fs1, $f22
267
+ .set $fs1f, $f23
268
+ .set $fs2, $f24
269
+ .set $fs2f, $f25
270
+ .set $fs3, $f26
271
+ .set $fs3f, $f27
272
+ .set $fs4, $f28
273
+ .set $fs4f, $f29
274
+ .set $fs5, $f30
275
+ .set $fs5f, $f31
276
+ """
277
+ elif options.opts.platform == "psx":
278
+ gas += '\ninclude "gte_macros.inc"\n'
279
+ write_gte_macros()
280
+
281
+ if options.opts.generated_macro_inc_content is not None:
282
+ gas += f"\n{options.opts.generated_macro_inc_content}\n"
283
+
284
+ # File used by modern gas
285
+ preamble = (
286
+ "# This file is used by modern gas.\n# Defines the expected assembly macros\n"
287
+ )
288
+ _write("include/macro.inc", f"{preamble}\n{gas}")
289
+
290
+
291
+ def write_gte_macros():
292
+ # Taken directly from https://github.com/Decompollaborate/rabbitizer/blob/develop/docs/r3000gte/gte_macros.s
293
+ # Please try to upstream any fix/update done here.
294
+ gte_macros = """
295
+ ## GTE instructions macros
296
+ ## This macros are meant to be used with GAS and avoid using DMPSX
297
+
298
+ /* RTPS 15 0x4A180001 Perspective transform */
299
+ .macro rtps
300
+ .word 0x4A180001
301
+ .endm
302
+
303
+ /* RTPT 23 0x4A280030 Perspective transform on 3 points */
304
+ .macro rtpt
305
+ .word 0x4A280030
306
+ .endm
307
+
308
+ /* DPCL 8 0x4A680029 Depth Cue Color light */
309
+ .macro dpcl
310
+ .word 0x4A680029
311
+ .endm
312
+
313
+ /* DPCS 8 0x4A780010 Depth Cueing */
314
+ .macro dpcs
315
+ .word 0x4A780010
316
+ .endm
317
+
318
+ /* DPCT 17 0x4AF8002A Depth cue color RGB0,RGB1,RGB2 */
319
+ .macro dpct
320
+ .word 0x4AF8002A
321
+ .endm
322
+
323
+ /* INTPL 8 0x4A980011 Interpolation of vector and far color */
324
+ .macro intpl
325
+ .word 0x4A980011
326
+ .endm
327
+
328
+ /* NCS 14 0x4AC8041E Normal color v0 */
329
+ .macro ncs
330
+ .word 0x4AC8041E
331
+ .endm
332
+
333
+ /* NCT 30 0x4AD80420 Normal color v0, v1, v2 */
334
+ .macro nct
335
+ .word 0x4AD80420
336
+ .endm
337
+
338
+ /* NCDS 19 0x4AE80413 Normal color depth cuev0 */
339
+ .macro ncds
340
+ .word 0x4AE80413
341
+ .endm
342
+
343
+ /* NCDT 44 0x4AF80416 Normal color depth cue v0, v1, v2 */
344
+ .macro ncdt
345
+ .word 0x4AF80416
346
+ .endm
347
+
348
+ /* NCCS 17 0x4B08041B Normal color col. v0 */
349
+ .macro nccs
350
+ .word 0x4B08041B
351
+ .endm
352
+
353
+ /* NCCT 39 0x4B18043F Normal color col.v0, v1, v2 */
354
+ .macro ncct
355
+ .word 0x4B18043F
356
+ .endm
357
+
358
+ /* CDP 13 0x4B280414 Color Depth Queue */
359
+ .macro cdp
360
+ .word 0x4B280414
361
+ .endm
362
+
363
+ /* CC 11 0x4B38041C Color Col. */
364
+ .macro cc
365
+ .word 0x4B38041C
366
+ .endm
367
+
368
+ /* NCLIP 8 0x4B400006 Normal clipping */
369
+ .macro nclip
370
+ .word 0x4B400006
371
+ .endm
372
+
373
+ /* AVSZ3 5 0x4B58002D Average of three Z values */
374
+ .macro avsz3
375
+ .word 0x4B58002D
376
+ .endm
377
+
378
+ /* AVSZ4 6 0x4B68002E Average of four Z values */
379
+ .macro avsz4
380
+ .word 0x4B68002E
381
+ .endm
382
+
383
+
384
+ ## Instructions which take an argument
385
+ # sf : arg is 1 bit wide
386
+ # mx : arg is 2 bit wide
387
+ # v : arg is 2 bit wide
388
+ # cv : arg is 2 bit wide
389
+ # lm : arg is 1 bit wide
390
+
391
+ /* MVMVA 8 0x4A400012 Multiply vector by matrix and vector addition. */
392
+ .macro mvmva sf, mx, v, cv, lm
393
+ .word 0x4A400012 | (\\sf & 0x1) << 19 | (\\mx & 0x3) << 17 | (\\v & 0x3) << 15 | (\\cv & 0x3) << 13 | (\\lm & 0x1) << 10
394
+ .endm
395
+
396
+ /* SQR 5 0x4AA00428 Square of vector */
397
+ .macro sqr sf
398
+ .word 0x4AA00428 | (\\sf & 0x1) << 19
399
+ .endm
400
+
401
+ /* OP 6 0x4B70000C Outer Product */
402
+ .macro op sf
403
+ .word 0x4B70000C | (\\sf & 0x1) << 19
404
+ .endm
405
+
406
+ /* GPF 6 0x4B90003D General purpose interpolation */
407
+ .macro gpf sf
408
+ .word 0x4B90003D | (\\sf & 0x1) << 19
409
+ .endm
410
+
411
+ /* GPL 5 0x4BA0003E general purpose interpolation */
412
+ .macro gpl sf
413
+ .word 0x4BA0003E | (\\sf & 0x1) << 19
414
+ .endm
415
+
416
+
417
+ ## Convenience macros
418
+
419
+ /* rtv0 - 0x4A486012 v0 * rotmatrix */
420
+ .macro rtv0
421
+ # .word 0x4A486012
422
+ MVMVA 1, 0, 0, 3, 0
423
+ .endm
424
+
425
+ /* rtv1 - 0x4A48E012 v1 * rotmatrix */
426
+ .macro rtv1
427
+ # .word 0x4A48E012
428
+ MVMVA 1, 0, 1, 3, 0
429
+ .endm
430
+
431
+ /* rtv2 - 0x4A496012 v2 * rotmatrix */
432
+ .macro rtv2
433
+ # .word 0x4A496012
434
+ MVMVA 1, 0, 2, 3, 0
435
+ .endm
436
+
437
+ /* rtir12 - 0x4A49E012 ir * rotmatrix */
438
+ .macro rtir12
439
+ # .word 0x4A49E012
440
+ MVMVA 1, 0, 3, 3, 0
441
+ .endm
442
+
443
+ /* rtir0 - 0x4A41E012 ir * rotmatrix */
444
+ .macro rtir0
445
+ # .word 0x4A41E012
446
+ MVMVA 0, 0, 3, 3, 0
447
+ .endm
448
+
449
+ /* rtv0tr - 0x4A480012 v0 * rotmatrix + tr vector */
450
+ .macro rtv0tr
451
+ # .word 0x4A480012
452
+ MVMVA 1, 0, 0, 0, 0
453
+ .endm
454
+
455
+ /* rtv1tr - 0x4A488012 v1 * rotmatrix + tr vector */
456
+ .macro rtv1tr
457
+ # .word 0x4A488012
458
+ MVMVA 1, 0, 1, 0, 0
459
+ .endm
460
+
461
+ /* rtv2tr - 0x4A490012 v2 * rotmatrix + tr vector */
462
+ .macro rtv2tr
463
+ # .word 0x4A490012
464
+ MVMVA 1, 0, 2, 0, 0
465
+ .endm
466
+
467
+ /* rtirtr - 0x4A498012 ir * rotmatrix + tr vector */
468
+ .macro rtirtr
469
+ # .word 0x4A498012
470
+ MVMVA 1, 0, 3, 0, 0
471
+ .endm
472
+
473
+ /* rtv0bk - 0x4A482012 v0 * rotmatrix + bk vector */
474
+ .macro rtv0bk
475
+ # .word 0x4A482012
476
+ MVMVA 1, 0, 0, 1, 0
477
+ .endm
478
+
479
+ /* rtv1bk - 0x4A48A012 v1 * rotmatrix + bk vector */
480
+ .macro rtv1bk
481
+ # .word 0x4A48A012
482
+ MVMVA 1, 0, 1, 1, 0
483
+ .endm
484
+
485
+ /* rtv2bk - 0x4A492012 v2 * rotmatrix + bk vector */
486
+ .macro rtv2bk
487
+ # .word 0x4A492012
488
+ MVMVA 1, 0, 2, 1, 0
489
+ .endm
490
+
491
+ /* rtirbk - 0x4A49A012 ir * rotmatrix + bk vector */
492
+ .macro rtirbk
493
+ # .word 0x4A49A012
494
+ MVMVA 1, 0, 3, 1, 0
495
+ .endm
496
+
497
+ /* ll - 0x4A4A6412 v0 * light matrix. Lower limit result to 0 */
498
+ .macro ll
499
+ # .word 0x4A4A6412
500
+ MVMVA 1, 1, 0, 3, 1
501
+ .endm
502
+
503
+ /* llv0 - 0x4A4A6012 v0 * light matrix */
504
+ .macro llv0
505
+ # .word 0x4A4A6012
506
+ MVMVA 1, 1, 0, 3, 0
507
+ .endm
508
+
509
+ /* llv1 - 0x4A4AE012 v1 * light matrix */
510
+ .macro llv1
511
+ # .word 0x4A4AE012
512
+ MVMVA 1, 1, 1, 3, 0
513
+ .endm
514
+
515
+ /* llv2 - 0x4A4B6012 v2 * light matrix */
516
+ .macro llv2
517
+ # .word 0x4A4B6012
518
+ MVMVA 1, 1, 2, 3, 0
519
+ .endm
520
+
521
+ /* llvir - 0x4A4BE012 ir * light matrix */
522
+ .macro llvir
523
+ # .word 0x4A4BE012
524
+ MVMVA 1, 1, 3, 3, 0
525
+ .endm
526
+
527
+ /* llv0tr - 0x4A4A0012 v0 * light matrix + tr vector */
528
+ .macro llv0tr
529
+ # .word 0x4A4A0012
530
+ MVMVA 1, 1, 0, 0, 0
531
+ .endm
532
+
533
+ /* llv1tr - 0x4A4A8012 v1 * light matrix + tr vector */
534
+ .macro llv1tr
535
+ # .word 0x4A4A8012
536
+ MVMVA 1, 1, 1, 0, 0
537
+ .endm
538
+
539
+ /* llv2tr - 0x4A4B0012 v2 * light matrix + tr vector */
540
+ .macro llv2tr
541
+ # .word 0x4A4B0012
542
+ MVMVA 1, 1, 2, 0, 0
543
+ .endm
544
+
545
+ /* llirtr - 0x4A4B8012 ir * light matrix + tr vector */
546
+ .macro llirtr
547
+ # .word 0x4A4B8012
548
+ MVMVA 1, 1, 3, 0, 0
549
+ .endm
550
+
551
+ /* llv0bk - 0x4A4A2012 v0 * light matrix + bk vector */
552
+ .macro llv0bk
553
+ # .word 0x4A4A2012
554
+ MVMVA 1, 1, 0, 1, 0
555
+ .endm
556
+
557
+ /* llv1bk - 0x4A4AA012 v1 * light matrix + bk vector */
558
+ .macro llv1bk
559
+ # .word 0x4A4AA012
560
+ MVMVA 1, 1, 1, 1, 0
561
+ .endm
562
+
563
+ /* llv2bk - 0x4A4B2012 v2 * light matrix + bk vector */
564
+ .macro llv2bk
565
+ # .word 0x4A4B2012
566
+ MVMVA 1, 1, 2, 1, 0
567
+ .endm
568
+
569
+ /* llirbk - 0x4A4BA012 ir * light matrix + bk vector */
570
+ .macro llirbk
571
+ # .word 0x4A4BA012
572
+ MVMVA 1, 1, 3, 1, 0
573
+ .endm
574
+
575
+ /* lc - 0x4A4DA412 v0 * color matrix, Lower limit clamped to 0 */
576
+ .macro lc
577
+ # .word 0x4A4DA412
578
+ MVMVA 1, 2, 3, 1, 1
579
+ .endm
580
+
581
+ /* lcv0 - 0x4A4C6012 v0 * color matrix */
582
+ .macro lcv0
583
+ # .word 0x4A4C6012
584
+ MVMVA 1, 2, 0, 3, 0
585
+ .endm
586
+
587
+ /* lcv1 - 0x4A4CE012 v1 * color matrix */
588
+ .macro lcv1
589
+ # .word 0x4A4CE012
590
+ MVMVA 1, 2, 1, 3, 0
591
+ .endm
592
+
593
+ /* lcv2 - 0x4A4D6012 v2 * color matrix */
594
+ .macro lcv2
595
+ # .word 0x4A4D6012
596
+ MVMVA 1, 2, 2, 3, 0
597
+ .endm
598
+
599
+ /* lcvir - 0x4A4DE012 ir * color matrix */
600
+ .macro lcvir
601
+ # .word 0x4A4DE012
602
+ MVMVA 1, 2, 3, 3, 0
603
+ .endm
604
+
605
+ /* lcv0tr - 0x4A4C0012 v0 * color matrix + tr vector */
606
+ .macro lcv0tr
607
+ # .word 0x4A4C0012
608
+ MVMVA 1, 2, 0, 0, 0
609
+ .endm
610
+
611
+ /* lcv1tr - 0x4A4C8012 v1 * color matrix + tr vector */
612
+ .macro lcv1tr
613
+ # .word 0x4A4C8012
614
+ MVMVA 1, 2, 1, 0, 0
615
+ .endm
616
+
617
+ /* lcv2tr - 0x4A4D0012 v2 * color matrix + tr vector */
618
+ .macro lcv2tr
619
+ # .word 0x4A4D0012
620
+ MVMVA 1, 2, 2, 0, 0
621
+ .endm
622
+
623
+ /* lcirtr - 0x4A4D8012 ir * color matrix + tr vector */
624
+ .macro lcirtr
625
+ # .word 0x4A4D8012
626
+ MVMVA 1, 2, 3, 0, 0
627
+ .endm
628
+
629
+ /* lev0bk - 0x4A4C2012 v0 * color matrix + bk vector */
630
+ .macro lev0bk
631
+ # .word 0x4A4C2012
632
+ MVMVA 1, 2, 0, 1, 0
633
+ .endm
634
+
635
+ /* lev1bk - 0x4A4CA012 v1 * color matrix + bk vector */
636
+ .macro lev1bk
637
+ # .word 0x4A4CA012
638
+ MVMVA 1, 2, 1, 1, 0
639
+ .endm
640
+
641
+ /* lev2bk - 0x4A4D2012 v2 * color matrix + bk vector */
642
+ .macro lev2bk
643
+ # .word 0x4A4D2012
644
+ MVMVA 1, 2, 2, 1, 0
645
+ .endm
646
+
647
+ /* leirbk - 0x4A4DA012 ir * color matrix + bk vector */
648
+ .macro leirbk
649
+ # .word 0x4A4DA012
650
+ MVMVA 1, 2, 3, 1, 0
651
+ .endm
652
+
653
+ /* sqr12 - 0x4AA80428 square of ir 1,19,12 */
654
+ # .macro sqr12
655
+ # # .word 0x4AA80428
656
+ # SQR 1
657
+ # .endm
658
+
659
+ /* sqr0 - 0x4AA80428 square of ir 1,31, 0 */
660
+ # .macro sqr0
661
+ # # .word 0x4AA80428
662
+ # SQR 1
663
+ # .endm
664
+
665
+ /* op12 - 0x4B78000C outer product 1,19,12 */
666
+ .macro op12
667
+ # .word 0x4B78000C
668
+ OP 1
669
+ .endm
670
+
671
+ /* op0 - 0x4B70000C outer product 1,31, 0 */
672
+ .macro op0
673
+ # .word 0x4B70000C
674
+ OP 0
675
+ .endm
676
+
677
+ /* gpf12 - 0x4B98003D general purpose interpolation 1,19,12 */
678
+ .macro gpf12
679
+ # .word 0x4B98003D
680
+ GPF 1
681
+ .endm
682
+
683
+ /* gpf0 - 0x4B90003D general purpose interpolation 1,31, 0 */
684
+ .macro gpf0
685
+ # .word 0x4B90003D
686
+ GPF 0
687
+ .endm
688
+
689
+ /* gpl12 - 0x4BA8003E general purpose interpolation 1,19,12 */
690
+ .macro gpl12
691
+ # .word 0x4BA8003E
692
+ GPL 1
693
+ .endm
694
+
695
+ /* gpl0 - 0x4BA0003E general purpose interpolation 1,31, 0 */
696
+ .macro gpl0
697
+ # .word 0x4BA0003E
698
+ GPL 0
699
+ .endm
700
+ """
701
+
702
+ _write("include/gte_macros.inc", gte_macros)