summaryrefslogtreecommitdiff
path: root/3dlib/tpl_ext.S
blob: 9bfa71b1f6145cdf9abbcf109455ac3638570a76 (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
# fuck nintendo

.text

#ifndef __MWERKS__
.set r0,0;   .set r1,1;   .set r2,2; .set r3,3;   .set r4,4
.set r5,5;   .set r6,6;   .set r7,7;   .set r8,8;   .set r9,9
.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3
.set f1,1
#endif

.set sp, 1
.extern GXInitTexObj
.extern GXInitTexObjLOD

.globl TPLGetGXTexObjFromPalette
TPLGetGXTexObjFromPalette:
.set var_28, -0x28
.set var_20, -0x20
.set var_C, -0xC
.set var_8, -8
.set var_4, -4
.set arg_4, 4
stwu    sp, -0x30(sp)
mflr    r0
stw     r0, 0x30+arg_4(sp)
stw     r31, 0x30+var_4(sp)
stw     r30, 0x30+var_8(sp)
stw     r29, 0x30+var_C(sp)
mr      r29, r4
lwz     r6, 4(r3)
lwz     r30, 8(r3)
mr      r3, r29
divwu   r0, r5, r6
mullw   r0, r0, r6
subf    r0, r0, r5
slwi    r31, r0, 3
lwzx    r9, r30, r31
lbz     r6, 0x21(r9)
lbz     r0, 0x22(r9)
lwz     r4, 8(r9)
subf    r5, r6, r0
subf    r0, r0, r6
or      r0, r5, r0
lhz     r5, 2(r9)
lhz     r6, 0(r9)
srwi    r10, r0, 31
lwz     r7, 4(r9)
lwz     r8, 0xC(r9)
lwz     r9, 0x10(r9)
bl      GXInitTexObj
lwzx    r7, r30, r31
lis     r5, 0x4330
stw     r5, 0x30+var_28(sp)
mr      r3, r29
lbz     r4, 0x21(r7)
li      r6, 0
lbz     r0, 0x22(r7)
li      r8, 0
stw     r4, 0x30+var_28+4(sp)
lfd     f0, 0x30+var_28(sp)
stw     r5, 0x30+var_20(sp)
lis     r5, blah@h
ori     r5, r5, blah@l
lfd     f2, 0(r5)
fsubs   f1, f0, f2
lwz     r4, 0x14(r7)
stw     r0, 0x30+var_20+4(sp)
lwz     r5, 0x18(r7)
lfd     f0, 0x30+var_20(sp)
lfs     f3, 0x1C(r7)
fsubs   f2, f0, f2
lbz     r7, 0x20(r7)
bl      GXInitTexObjLOD
lwz     r0, 0x30+arg_4(sp)
lwz     r31, 0x30+var_4(sp)
lwz     r30, 0x30+var_8(sp)
lwz     r29, 0x30+var_C(sp)
mtlr    r0
addi    sp, sp, 0x30
blr

blah:
.long 0x43300000,0x00000000