.include "macros.inc"
.section .text, "ax"
.global GXSetTevOp
GXSetTevOp:
mflr r0
li r6, 0xa
stw r0, 4(r1)
stwu r1, -0x18(r1)
stw r31, 0x14(r1)
li r31, 5
stw r30, 0x10(r1)
or. r30, r3, r3
beq lbl_800ABA34
li r6, 0
li r31, 0
lbl_800ABA34:
cmpwi r4, 2
beq lbl_800ABAC4
bge lbl_800ABA50
cmpwi r4, 0
beq lbl_800ABA60
bge lbl_800ABA90
b lbl_800ABB5C
lbl_800ABA50:
cmpwi r4, 4
beq lbl_800ABB2C
bge lbl_800ABB5C
b lbl_800ABAF8
lbl_800ABA60:
addi r3, r30, 0
li r4, 0xf
li r5, 8
li r7, 0xf
bl GXSetTevColorIn
addi r3, r30, 0
addi r6, r31, 0
li r4, 7
li r5, 4
li r7, 7
bl GXSetTevAlphaIn
b lbl_800ABB5C
lbl_800ABA90:
addi r3, r30, 0
addi r4, r6, 0
li r5, 8
li r6, 9
li r7, 0xf
bl GXSetTevColorIn
addi r3, r30, 0
addi r7, r31, 0
li r4, 7
li r5, 7
li r6, 7
bl GXSetTevAlphaIn
b lbl_800ABB5C
lbl_800ABAC4:
addi r3, r30, 0
addi r4, r6, 0
li r5, 0xc
li r6, 8
li r7, 0xf
bl GXSetTevColorIn
addi r3, r30, 0
addi r6, r31, 0
li r4, 7
li r5, 4
li r7, 7
bl GXSetTevAlphaIn
b lbl_800ABB5C
lbl_800ABAF8:
addi r3, r30, 0
li r4, 0xf
li r5, 0xf
li r6, 0xf
li r7, 8
bl GXSetTevColorIn
addi r3, r30, 0
li r4, 7
li r5, 7
li r6, 7
li r7, 4
bl GXSetTevAlphaIn
b lbl_800ABB5C
lbl_800ABB2C:
addi r3, r30, 0
addi r7, r6, 0
li r4, 0xf
li r5, 0xf
li r6, 0xf
bl GXSetTevColorIn
addi r3, r30, 0
addi r7, r31, 0
li r4, 7
li r5, 7
li r6, 7
bl GXSetTevAlphaIn
lbl_800ABB5C:
addi r3, r30, 0
li r4, 0
li r5, 0
li r6, 0
li r7, 1
li r8, 0
bl GXSetTevColorOp
addi r3, r30, 0
li r4, 0
li r5, 0
li r6, 0
li r7, 1
li r8, 0
bl GXSetTevAlphaOp
lwz r0, 0x1c(r1)
lwz r31, 0x14(r1)
lwz r30, 0x10(r1)
addi r1, r1, 0x18
mtlr r0
blr
.global GXSetTevColorIn
GXSetTevColorIn:
slwi r3, r3, 2
lwz r0, gx@sda21(r13)
addi r9, r3, 0x130
add r9, r0, r9
lwz r3, 0(r9)
slwi r0, r4, 0xc
slwi r8, r5, 8
rlwinm r3, r3, 0, 0x14, 0xf
or r0, r3, r0
stw r0, 0(r9)
slwi r4, r6, 4
li r3, 0x61
lwz r6, 0(r9)
lis r5, 0xCC008000@ha
li r0, 0
rlwinm r6, r6, 0, 0x18, 0x13
or r6, r6, r8
stw r6, 0(r9)
lwz r6, 0(r9)
rlwinm r6, r6, 0, 0x1c, 0x17
or r4, r6, r4
stw r4, 0(r9)
lwz r4, 0(r9)
rlwinm r4, r4, 0, 0, 0x1b
or r4, r4, r7
stw r4, 0(r9)
stb r3, 0xCC008000@l(r5)
lwz r3, gx@sda21(r13)
lwz r4, 0(r9)
stw r4, -0x8000(r5)
sth r0, 2(r3)
blr
.global GXSetTevAlphaIn
GXSetTevAlphaIn:
slwi r3, r3, 2
lwz r0, gx@sda21(r13)
addi r9, r3, 0x170
add r9, r0, r9
lwz r8, 0(r9)
slwi r3, r4, 0xd
slwi r0, r5, 0xa
rlwinm r4, r8, 0, 0x13, 0xf
or r3, r4, r3
stw r3, 0(r9)
slwi r6, r6, 7
slwi r4, r7, 4
lwz r7, 0(r9)
li r3, 0x61
lis r5, 0xCC008000@ha
rlwinm r7, r7, 0, 0x16, 0x12
or r0, r7, r0
stw r0, 0(r9)
li r0, 0
lwz r7, 0(r9)
rlwinm r7, r7, 0, 0x19, 0x15
or r6, r7, r6
stw r6, 0(r9)
lwz r6, 0(r9)
rlwinm r6, r6, 0, 0x1c, 0x18
or r4, r6, r4
stw r4, 0(r9)
stb r3, 0xCC008000@l(r5)
lwz r3, gx@sda21(r13)
lwz r4, 0(r9)
stw r4, -0x8000(r5)
sth r0, 2(r3)
blr
.global GXSetTevColorOp
GXSetTevColorOp:
slwi r3, r3, 2
lwz r0, gx@sda21(r13)
addi r3, r3, 0x130
add r3, r0, r3
lwz r0, 0(r3)
cmpwi r4, 1
rlwinm r0, r0, 0, 0xe, 0xc
rlwimi r0, r4, 0x12, 0xd, 0xd
stw r0, 0(r3)
bgt lbl_800ABD04
lwz r9, 0(r3)
slwi r4, r6, 0x14
slwi r0, r5, 0x10
rlwinm r5, r9, 0, 0xc, 9
or r4, r5, r4
stw r4, 0(r3)
lwz r4, 0(r3)
rlwinm r4, r4, 0, 0x10, 0xd
or r0, r4, r0
stw r0, 0(r3)
b lbl_800ABD24
lbl_800ABD04:
lwz r0, 0(r3)
rlwinm r0, r0, 0, 0xc, 9
rlwimi r0, r4, 0x13, 0xa, 0xb
stw r0, 0(r3)
lwz r0, 0(r3)
rlwinm r0, r0, 0, 0x10, 0xd
oris r0, r0, 3
stw r0, 0(r3)
lbl_800ABD24:
lwz r4, 0(r3)
rlwinm r0, r7, 0x13, 5, 0xc
slwi r6, r8, 0x16
rlwinm r4, r4, 0, 0xd, 0xb
or r0, r4, r0
stw r0, 0(r3)
li r4, 0x61
lis r5, 0xCC008000@ha
lwz r7, 0(r3)
li r0, 0
rlwinm r7, r7, 0, 0xa, 7
or r6, r7, r6
stw r6, 0(r3)
stb r4, 0xCC008000@l(r5)
lwz r4, gx@sda21(r13)
lwz r3, 0(r3)
stw r3, -0x8000(r5)
sth r0, 2(r4)
blr
.global GXSetTevAlphaOp
GXSetTevAlphaOp:
slwi r3, r3, 2
lwz r0, gx@sda21(r13)
addi r3, r3, 0x170
add r3, r0, r3
lwz r0, 0(r3)
cmpwi r4, 1
rlwinm r0, r0, 0, 0xe, 0xc
rlwimi r0, r4, 0x12, 0xd, 0xd
stw r0, 0(r3)
bgt lbl_800ABDC4
lwz r9, 0(r3)
slwi r4, r6, 0x14
slwi r0, r5, 0x10
rlwinm r5, r9, 0, 0xc, 9
or r4, r5, r4
stw r4, 0(r3)
lwz r4, 0(r3)
rlwinm r4, r4, 0, 0x10, 0xd
or r0, r4, r0
stw r0, 0(r3)
b lbl_800ABDE4
lbl_800ABDC4:
lwz r0, 0(r3)
rlwinm r0, r0, 0, 0xc, 9
rlwimi r0, r4, 0x13, 0xa, 0xb
stw r0, 0(r3)
lwz r0, 0(r3)
rlwinm r0, r0, 0, 0x10, 0xd
oris r0, r0, 3
stw r0, 0(r3)
lbl_800ABDE4:
lwz r4, 0(r3)
rlwinm r0, r7, 0x13, 5, 0xc
slwi r6, r8, 0x16
rlwinm r4, r4, 0, 0xd, 0xb
or r0, r4, r0
stw r0, 0(r3)
li r4, 0x61
lis r5, 0xCC008000@ha
lwz r7, 0(r3)
li r0, 0
rlwinm r7, r7, 0, 0xa, 7
or r6, r7, r6
stw r6, 0(r3)
stb r4, 0xCC008000@l(r5)
lwz r4, gx@sda21(r13)
lwz r3, 0(r3)
stw r3, -0x8000(r5)
sth r0, 2(r4)
blr
.global GXSetTevColor
GXSetTevColor:
lbz r0, 3(r4)
slwi r8, r3, 1
lbz r5, 0(r4)
addi r7, r8, 0xe0
slwi r9, r0, 0xc
rlwimi r9, r5, 0, 0x18, 0x1f
lbz r10, 2(r4)
lbz r6, 1(r4)
slwi r7, r7, 0x18
li r5, 0x61
lwz r3, gx@sda21(r13)
lis r4, 0xCC008000@ha
stb r5, 0xCC008000@l(r4)
rlwimi r7, r9, 0, 0xc, 0x1f
addi r0, r8, 0xe1
stw r7, -0x8000(r4)
slwi r7, r6, 0xc
slwi r6, r0, 0x18
rlwimi r7, r10, 0, 0x18, 0x1f
stb r5, -0x8000(r4)
rlwimi r6, r7, 0, 0xc, 0x1f
stw r6, -0x8000(r4)
li r0, 0
stb r5, -0x8000(r4)
stw r6, -0x8000(r4)
stb r5, -0x8000(r4)
stw r6, -0x8000(r4)
sth r0, 2(r3)
blr
.global GXSetTevColorS10
GXSetTevColorS10:
lha r0, 6(r4)
slwi r9, r3, 1
lha r5, 0(r4)
addi r8, r9, 0xe0
rlwinm r10, r0, 0xc, 9, 0x13
rlwimi r10, r5, 0, 0x15, 0x1f
lha r7, 4(r4)
lha r6, 2(r4)
slwi r8, r8, 0x18
li r5, 0x61
lwz r3, gx@sda21(r13)
lis r4, 0xCC008000@ha
stb r5, 0xCC008000@l(r4)
rlwimi r8, r10, 0, 9, 0x1f
addi r0, r9, 0xe1
stw r8, -0x8000(r4)
rlwinm r8, r6, 0xc, 9, 0x13
slwi r6, r0, 0x18
rlwimi r8, r7, 0, 0x15, 0x1f
stb r5, -0x8000(r4)
rlwimi r6, r8, 0, 9, 0x1f
stw r6, -0x8000(r4)
li r0, 0
stb r5, -0x8000(r4)
stw r6, -0x8000(r4)
stb r5, -0x8000(r4)
stw r6, -0x8000(r4)
sth r0, 2(r3)
blr
.global GXSetTevKColor
GXSetTevKColor:
lbz r0, 3(r4)
slwi r5, r3, 1
lbz r6, 0(r4)
addi r7, r5, 0xe0
slwi r0, r0, 0xc
rlwimi r0, r6, 0, 0x18, 0x1f
lbz r6, 1(r4)
lbz r9, 2(r4)
rlwinm r0, r0, 0, 0xc, 7
oris r8, r0, 0x80
lwz r3, gx@sda21(r13)
slwi r7, r7, 0x18
li r0, 0x61
lis r4, 0xCC008000@ha
slwi r6, r6, 0xc
stb r0, 0xCC008000@l(r4)
rlwimi r7, r8, 0, 8, 0x1f
stw r7, -0x8000(r4)
rlwimi r6, r9, 0, 0x18, 0x1f
addi r5, r5, 0xe1
stb r0, -0x8000(r4)
rlwinm r0, r6, 0, 0xc, 7
oris r6, r0, 0x80
slwi r0, r5, 0x18
rlwimi r0, r6, 0, 8, 0x1f
stw r0, -0x8000(r4)
li r0, 0
sth r0, 2(r3)
blr
.global GXSetTevKColorSel
GXSetTevKColorSel:
srawi r5, r3, 1
lwz r6, gx@sda21(r13)
clrlwi. r0, r3, 0x1f
slwi r3, r5, 2
addi r7, r3, 0x1b0
add r7, r6, r7
beq lbl_800ABFC0
lwz r3, 0(r7)
slwi r0, r4, 0xe
rlwinm r3, r3, 0, 0x12, 0xc
or r0, r3, r0
stw r0, 0(r7)
b lbl_800ABFD4
lbl_800ABFC0:
lwz r3, 0(r7)
slwi r0, r4, 4
rlwinm r3, r3, 0, 0x1c, 0x16
or r0, r3, r0
stw r0, 0(r7)
lbl_800ABFD4:
li r0, 0x61
lwz r3, gx@sda21(r13)
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
li r0, 0
lwz r4, 0(r7)
stw r4, -0x8000(r5)
sth r0, 2(r3)
blr
.global GXSetTevKAlphaSel
GXSetTevKAlphaSel:
srawi r5, r3, 1
lwz r6, gx@sda21(r13)
clrlwi. r0, r3, 0x1f
slwi r3, r5, 2
addi r7, r3, 0x1b0
add r7, r6, r7
beq lbl_800AC02C
lwz r3, 0(r7)
slwi r0, r4, 0x13
rlwinm r3, r3, 0, 0xd, 7
or r0, r3, r0
stw r0, 0(r7)
b lbl_800AC040
lbl_800AC02C:
lwz r3, 0(r7)
slwi r0, r4, 9
rlwinm r3, r3, 0, 0x17, 0x11
or r0, r3, r0
stw r0, 0(r7)
lbl_800AC040:
li r0, 0x61
lwz r3, gx@sda21(r13)
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
li r0, 0
lwz r4, 0(r7)
stw r4, -0x8000(r5)
sth r0, 2(r3)
blr
.global GXSetTevSwapMode
GXSetTevSwapMode:
slwi r3, r3, 2
lwz r0, gx@sda21(r13)
addi r7, r3, 0x170
add r7, r0, r7
lwz r0, 0(r7)
slwi r6, r5, 2
li r3, 0x61
rlwinm r0, r0, 0, 0, 0x1d
or r0, r0, r4
stw r0, 0(r7)
lis r5, 0xCC008000@ha
li r0, 0
lwz r4, 0(r7)
rlwinm r4, r4, 0, 0x1e, 0x1b
or r4, r4, r6
stw r4, 0(r7)
stb r3, 0xCC008000@l(r5)
lwz r3, gx@sda21(r13)
lwz r4, 0(r7)
stw r4, -0x8000(r5)
sth r0, 2(r3)
blr
.global GXSetTevSwapModeTable
GXSetTevSwapModeTable:
slwi r9, r3, 1
lwz r0, gx@sda21(r13)
slwi r3, r3, 3
addi r11, r3, 0x1b0
add r11, r0, r11
lwz r8, 0(r11)
addi r0, r9, 1
slwi r3, r0, 2
rlwinm r0, r8, 0, 0, 0x1d
or r0, r0, r4
stw r0, 0(r11)
slwi r0, r5, 2
li r9, 0x61
lwz r4, 0(r11)
lis r8, 0xCC008000@ha
addi r10, r3, 0x1b0
rlwinm r3, r4, 0, 0x1e, 0x1b
or r0, r3, r0
stw r0, 0(r11)
slwi r3, r7, 2
li r0, 0
stb r9, 0xCC008000@l(r8)
lwz r4, gx@sda21(r13)
lwz r5, 0(r11)
add r10, r4, r10
stw r5, -0x8000(r8)
lwz r4, 0(r10)
rlwinm r4, r4, 0, 0, 0x1d
or r4, r4, r6
stw r4, 0(r10)
lwz r4, 0(r10)
rlwinm r4, r4, 0, 0x1e, 0x1b
or r3, r4, r3
stw r3, 0(r10)
stb r9, -0x8000(r8)
lwz r3, gx@sda21(r13)
lwz r4, 0(r10)
stw r4, -0x8000(r8)
sth r0, 2(r3)
blr
.global GXSetAlphaCompare
GXSetAlphaCompare:
rlwinm r7, r7, 8, 0x10, 0x17
lwz r8, gx@sda21(r13)
rlwimi r7, r4, 0, 0x18, 0x1f
slwi r0, r3, 0x10
rlwimi r0, r7, 0, 0x10, 0x1f
rlwinm r3, r0, 0, 0xd, 9
slwi r0, r6, 0x13
or r0, r3, r0
rlwinm r3, r0, 0, 0xa, 7
slwi r0, r5, 0x16
or r0, r3, r0
clrlwi r4, r0, 8
li r0, 0x61
lis r3, 0xCC008000@ha
stb r0, 0xCC008000@l(r3)
oris r4, r4, 0xf300
li r0, 0
stw r4, -0x8000(r3)
sth r0, 2(r8)
blr
.global GXSetZTexture
GXSetZTexture:
cmpwi r4, 0x13
clrlwi r0, r5, 8
oris r7, r0, 0xf400
beq lbl_800AC1E0
bge lbl_800AC1CC
cmpwi r4, 0x11
beq lbl_800AC1D8
b lbl_800AC1F0
lbl_800AC1CC:
cmpwi r4, 0x16
beq lbl_800AC1E8
b lbl_800AC1F0
lbl_800AC1D8:
li r6, 0
b lbl_800AC1F4
lbl_800AC1E0:
li r6, 1
b lbl_800AC1F4
lbl_800AC1E8:
li r6, 2
b lbl_800AC1F4
lbl_800AC1F0:
li r6, 2
lbl_800AC1F4:
li r0, 0x61
lwz r4, gx@sda21(r13)
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
rlwinm r6, r6, 0, 0x1e, 0x1b
slwi r3, r3, 2
stw r7, -0x8000(r5)
or r3, r6, r3
clrlwi r3, r3, 8
stb r0, -0x8000(r5)
oris r3, r3, 0xf500
li r0, 0
stw r3, -0x8000(r5)
sth r0, 2(r4)
blr
.global GXSetTevOrder
GXSetTevOrder:
srawi r7, r3, 1
lwz r9, gx@sda21(r13)
rlwinm r10, r5, 0, 0x18, 0x16
addze r7, r7
slwi r0, r3, 2
add r8, r9, r0
slwi r7, r7, 2
stw r5, 0x49c(r8)
addi r7, r7, 0x100
cmplwi r10, 8
addi r0, r10, 0
add r7, r9, r7
blt lbl_800AC26C
li r9, 0
b lbl_800AC270
lbl_800AC26C:
mr r9, r0
lbl_800AC270:
cmpwi r4, 8
blt lbl_800AC29C
lwz r4, gx@sda21(r13)
li r0, 1
slw r0, r0, r3
lwz r8, 0x4e0(r4)
addi r10, r4, 0x4e0
li r4, 0
andc r0, r8, r0
stw r0, 0(r10)
b lbl_800AC2B8
lbl_800AC29C:
lwz r8, gx@sda21(r13)
li r0, 1
slw r0, r0, r3
addi r10, r8, 0x4e0
lwz r8, 0x4e0(r8)
or r0, r8, r0
stw r0, 0(r10)
lbl_800AC2B8:
clrlwi. r0, r3, 0x1f
beq lbl_800AC350
lwz r8, 0(r7)
slwi r3, r9, 0xc
slwi r0, r4, 0xf
rlwinm r4, r8, 0, 0x14, 0x10
or r3, r4, r3
stw r3, 0(r7)
cmpwi r6, 0xff
lwz r3, 0(r7)
rlwinm r3, r3, 0, 0x11, 0xd
or r0, r3, r0
stw r0, 0(r7)
bne lbl_800AC2F8
li r0, 7
b lbl_800AC30C
lbl_800AC2F8:
lis r3, c2r$71@ha
slwi r4, r6, 2
addi r0, r3, c2r$71@l
add r3, r0, r4
lwz r0, 0(r3)
lbl_800AC30C:
lwz r3, 0(r7)
slwi r0, r0, 0x13
cmpwi r5, 0xff
rlwinm r3, r3, 0, 0xd, 9
or r0, r3, r0
stw r0, 0(r7)
li r4, 0
beq lbl_800AC338
rlwinm. r0, r5, 0, 0x17, 0x17
bne lbl_800AC338
li r4, 1
lbl_800AC338:
lwz r3, 0(r7)
slwi r0, r4, 0x12
rlwinm r3, r3, 0, 0xe, 0xc
or r0, r3, r0
stw r0, 0(r7)
b lbl_800AC3D8
lbl_800AC350:
lwz r3, 0(r7)
slwi r0, r4, 3
cmpwi r6, 0xff
rlwinm r3, r3, 0, 0, 0x1c
or r3, r3, r9
stw r3, 0(r7)
lwz r3, 0(r7)
rlwinm r3, r3, 0, 0x1d, 0x19
or r0, r3, r0
stw r0, 0(r7)
bne lbl_800AC384
li r0, 7
b lbl_800AC398
lbl_800AC384:
lis r3, c2r$71@ha
slwi r4, r6, 2
addi r0, r3, c2r$71@l
add r3, r0, r4
lwz r0, 0(r3)
lbl_800AC398:
lwz r3, 0(r7)
slwi r0, r0, 7
cmpwi r5, 0xff
rlwinm r3, r3, 0, 0x19, 0x15
or r0, r3, r0
stw r0, 0(r7)
li r4, 0
beq lbl_800AC3C4
rlwinm. r0, r5, 0, 0x17, 0x17
bne lbl_800AC3C4
li r4, 1
lbl_800AC3C4:
lwz r3, 0(r7)
slwi r0, r4, 6
rlwinm r3, r3, 0, 0x1a, 0x18
or r0, r3, r0
stw r0, 0(r7)
lbl_800AC3D8:
li r0, 0x61
lwz r3, gx@sda21(r13)
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
li r0, 0
lwz r4, 0(r7)
stw r4, -0x8000(r5)
sth r0, 2(r3)
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
ori r0, r0, 1
stw r0, 0x4f4(r3)
blr
.global GXSetNumTevStages
GXSetNumTevStages:
clrlwi r3, r3, 0x18
lwz r4, gx@sda21(r13)
addi r0, r3, -1
lwzu r3, 0x204(r4)
slwi r0, r0, 0xa
rlwinm r3, r3, 0, 0x16, 0x11
or r0, r3, r0
stw r0, 0(r4)
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
ori r0, r0, 4
stw r0, 0x4f4(r3)
blr
.section .data, "wa"
.balign 8
c2r$71:
.4byte 0
.4byte 0x00000001
.4byte 0
.4byte 0x00000001
.4byte 0
.4byte 0x00000001
.4byte 0x00000007
.4byte 0x00000005
.4byte 0x00000006
.4byte 0