.include "macros.inc"
.section .text, "ax"
.global GDSetTevOp
GDSetTevOp:
mflr r0
li r6, 0xa
stw r0, 4(r1)
stwu r1, -0x30(r1)
stw r31, 0x2c(r1)
stw r30, 0x28(r1)
stw r29, 0x24(r1)
li r29, 5
stw r28, 0x20(r1)
or. r28, r3, r3
beq lbl_800B1ED8
li r6, 0
li r29, 0
lbl_800B1ED8:
cmpwi r4, 2
beq lbl_800B1FD8
bge lbl_800B1EF4
cmpwi r4, 0
beq lbl_800B1F04
bge lbl_800B1F6C
b lbl_800B2118
lbl_800B1EF4:
cmpwi r4, 4
beq lbl_800B20B0
bge lbl_800B2118
b lbl_800B2044
lbl_800B1F04:
li r31, 1
stw r31, 8(r1)
li r30, 0
addi r3, r28, 0
stw r30, 0xc(r1)
li r4, 0xf
li r5, 8
li r7, 0xf
li r8, 0
li r9, 0
li r10, 0
bl GDSetTevColorCalc
stw r31, 8(r1)
addi r3, r28, 0
addi r6, r29, 0
stw r30, 0xc(r1)
li r4, 7
li r5, 4
stw r30, 0x10(r1)
li r7, 7
li r8, 0
stw r30, 0x14(r1)
li r9, 0
li r10, 0
bl GDSetTevAlphaCalcAndSwap
b lbl_800B2118
lbl_800B1F6C:
li r31, 1
stw r31, 8(r1)
li r30, 0
addi r3, r28, 0
stw r30, 0xc(r1)
addi r4, r6, 0
li r5, 8
li r6, 9
li r7, 0xf
li r8, 0
li r9, 0
li r10, 0
bl GDSetTevColorCalc
stw r31, 8(r1)
addi r3, r28, 0
addi r7, r29, 0
stw r30, 0xc(r1)
li r4, 7
li r5, 7
stw r30, 0x10(r1)
li r6, 7
li r8, 0
stw r30, 0x14(r1)
li r9, 0
li r10, 0
bl GDSetTevAlphaCalcAndSwap
b lbl_800B2118
lbl_800B1FD8:
li r31, 1
stw r31, 8(r1)
li r30, 0
addi r3, r28, 0
stw r30, 0xc(r1)
addi r4, r6, 0
li r5, 0xc
li r6, 8
li r7, 0xf
li r8, 0
li r9, 0
li r10, 0
bl GDSetTevColorCalc
stw r31, 8(r1)
addi r3, r28, 0
addi r6, r29, 0
stw r30, 0xc(r1)
li r4, 7
li r5, 4
stw r30, 0x10(r1)
li r7, 7
li r8, 0
stw r30, 0x14(r1)
li r9, 0
li r10, 0
bl GDSetTevAlphaCalcAndSwap
b lbl_800B2118
lbl_800B2044:
li r31, 1
stw r31, 8(r1)
li r30, 0
addi r3, r28, 0
stw r30, 0xc(r1)
li r4, 0xf
li r5, 0xf
li r6, 0xf
li r7, 8
li r8, 0
li r9, 0
li r10, 0
bl GDSetTevColorCalc
stw r31, 8(r1)
addi r3, r28, 0
li r4, 7
stw r30, 0xc(r1)
li r5, 7
li r6, 7
stw r30, 0x10(r1)
li r7, 4
li r8, 0
stw r30, 0x14(r1)
li r9, 0
li r10, 0
bl GDSetTevAlphaCalcAndSwap
b lbl_800B2118
lbl_800B20B0:
li r30, 1
stw r30, 8(r1)
li r31, 0
addi r3, r28, 0
stw r31, 0xc(r1)
addi r7, r6, 0
li r4, 0xf
li r5, 0xf
li r6, 0xf
li r8, 0
li r9, 0
li r10, 0
bl GDSetTevColorCalc
stw r30, 8(r1)
addi r3, r28, 0
addi r7, r29, 0
stw r31, 0xc(r1)
li r4, 7
li r5, 7
stw r31, 0x10(r1)
li r6, 7
li r8, 0
stw r31, 0x14(r1)
li r9, 0
li r10, 0
bl GDSetTevAlphaCalcAndSwap
lbl_800B2118:
lwz r0, 0x34(r1)
lwz r31, 0x2c(r1)
lwz r30, 0x28(r1)
lwz r29, 0x24(r1)
lwz r28, 0x20(r1)
addi r1, r1, 0x30
mtlr r0
blr
.global GDSetTevColorCalc
GDSetTevColorCalc:
mflr r0
stw r0, 4(r1)
stwu r1, -0x50(r1)
stmw r22, 0x28(r1)
mr r27, r8
cmpwi r27, 1
lbz r30, 0x5b(r1)
lwz r31, 0x5c(r1)
addi r22, r3, 0
addi r23, r4, 0
addi r24, r5, 0
addi r25, r6, 0
addi r26, r7, 0
addi r28, r9, 0
addi r29, r10, 0
bgt lbl_800B2278
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B2194
bl GDOverflowed
lbl_800B2194:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B21C8
bl GDOverflowed
lbl_800B21C8:
lwz r4, __GDCurrentDL@sda21(r13)
slwi r0, r25, 4
slwi r5, r24, 8
lwz r3, 8(r4)
or r0, r26, r0
or r6, r5, r0
addi r0, r3, 1
stw r0, 8(r4)
slwi r7, r23, 0xc
or r0, r7, r6
slwi r8, r28, 0x10
slwi r5, r22, 1
rlwinm r4, r27, 0x12, 0xd, 0xd
or r0, r8, r0
or r0, r4, r0
slwi r6, r30, 0x13
or r0, r6, r0
slwi r4, r29, 0x14
addi r5, r5, 0xc0
slwi r6, r31, 0x16
or r0, r4, r0
or r4, r6, r0
slwi r0, r5, 0x18
or r7, r4, r0
srwi r0, r7, 0x18
stb r0, 0(r3)
rlwinm r6, r7, 0x10, 0x18, 0x1f
rlwinm r5, r7, 0x18, 0x18, 0x1f
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r7, 0(r3)
b lbl_800B2370
lbl_800B2278:
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B2294
bl GDOverflowed
lbl_800B2294:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B22C8
bl GDOverflowed
lbl_800B22C8:
lwz r4, __GDCurrentDL@sda21(r13)
slwi r0, r25, 4
slwi r5, r24, 8
or r0, r26, r0
lwz r3, 8(r4)
or r0, r5, r0
slwi r6, r23, 0xc
or r6, r6, r0
addi r0, r3, 1
stw r0, 8(r4)
oris r0, r6, 3
rlwinm r7, r27, 0x12, 0xd, 0xd
slwi r5, r22, 1
slwi r4, r30, 0x13
or r0, r7, r0
or r0, r4, r0
rlwinm r6, r27, 0x13, 0xa, 0xb
addi r5, r5, 0xc0
slwi r4, r31, 0x16
or r0, r6, r0
or r4, r4, r0
slwi r0, r5, 0x18
or r7, r4, r0
srwi r0, r7, 0x18
stb r0, 0(r3)
rlwinm r6, r7, 0x10, 0x18, 0x1f
rlwinm r5, r7, 0x18, 0x18, 0x1f
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r7, 0(r3)
lbl_800B2370:
lmw r22, 0x28(r1)
lwz r0, 0x54(r1)
addi r1, r1, 0x50
mtlr r0
blr
.global GDSetTevAlphaCalcAndSwap
GDSetTevAlphaCalcAndSwap:
mflr r0
stw r0, 4(r1)
stwu r1, -0x58(r1)
stmw r20, 0x28(r1)
mr r25, r8
cmpwi r25, 1
lbz r28, 0x63(r1)
lwz r29, 0x64(r1)
lwz r30, 0x68(r1)
mr r20, r3
lwz r31, 0x6c(r1)
addi r21, r4, 0
addi r22, r5, 0
addi r23, r6, 0
addi r24, r7, 0
addi r26, r9, 0
addi r27, r10, 0
bgt lbl_800B24DC
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B23E8
bl GDOverflowed
lbl_800B23E8:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B241C
bl GDOverflowed
lbl_800B241C:
lwz r4, __GDCurrentDL@sda21(r13)
slwi r0, r31, 2
slwi r5, r24, 4
or r0, r30, r0
lwz r3, 8(r4)
or r0, r5, r0
slwi r6, r23, 7
or r6, r6, r0
addi r0, r3, 1
stw r0, 8(r4)
slwi r7, r22, 0xa
or r0, r7, r6
slwi r8, r21, 0xd
slwi r5, r20, 1
slwi r4, r26, 0x10
or r0, r8, r0
or r0, r4, r0
rlwinm r6, r25, 0x12, 0xd, 0xd
or r0, r6, r0
slwi r4, r28, 0x13
or r0, r4, r0
slwi r6, r27, 0x14
addi r5, r5, 0xc1
slwi r4, r29, 0x16
or r0, r6, r0
or r4, r4, r0
slwi r0, r5, 0x18
or r7, r4, r0
srwi r0, r7, 0x18
stb r0, 0(r3)
rlwinm r6, r7, 0x10, 0x18, 0x1f
rlwinm r5, r7, 0x18, 0x18, 0x1f
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r7, 0(r3)
b lbl_800B25E4
lbl_800B24DC:
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B24F8
bl GDOverflowed
lbl_800B24F8:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B252C
bl GDOverflowed
lbl_800B252C:
lwz r4, __GDCurrentDL@sda21(r13)
slwi r0, r31, 2
slwi r5, r24, 4
or r0, r30, r0
lwz r3, 8(r4)
or r0, r5, r0
slwi r6, r23, 7
or r6, r6, r0
addi r0, r3, 1
stw r0, 8(r4)
slwi r7, r22, 0xa
or r0, r7, r6
slwi r8, r21, 0xd
or r0, r8, r0
slwi r5, r20, 1
rlwinm r4, r25, 0x12, 0xd, 0xd
oris r0, r0, 3
or r0, r4, r0
slwi r6, r28, 0x13
or r0, r6, r0
rlwinm r4, r25, 0x13, 0xa, 0xb
addi r5, r5, 0xc1
slwi r6, r29, 0x16
or r0, r4, r0
or r4, r6, r0
slwi r0, r5, 0x18
or r7, r4, r0
srwi r0, r7, 0x18
stb r0, 0(r3)
rlwinm r6, r7, 0x10, 0x18, 0x1f
rlwinm r5, r7, 0x18, 0x18, 0x1f
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r7, 0(r3)
lbl_800B25E4:
lmw r20, 0x28(r1)
lwz r0, 0x5c(r1)
addi r1, r1, 0x58
mtlr r0
blr
.global GDSetAlphaCompare
GDSetAlphaCompare:
mflr r0
stw r0, 4(r1)
stwu r1, -0x38(r1)
stmw r27, 0x24(r1)
addi r28, r3, 0
addi r29, r4, 0
mr r30, r5
addi r31, r6, 0
addi r27, r7, 0
lwz r8, __GDCurrentDL@sda21(r13)
lwz r3, 8(r8)
lwz r0, 0xc(r8)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B2638
bl GDOverflowed
lbl_800B2638:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B266C
bl GDOverflowed
lbl_800B266C:
lwz r4, __GDCurrentDL@sda21(r13)
rlwinm r5, r27, 8, 0x10, 0x17
rlwimi r5, r29, 0, 0x18, 0x1f
lwz r3, 8(r4)
slwi r6, r31, 0x13
rlwimi r5, r28, 0x10, 0, 0xf
addi r0, r3, 1
stw r0, 8(r4)
slwi r4, r30, 0x16
or r0, r6, r5
or r0, r4, r0
oris r7, r0, 0xf300
srwi r0, r7, 0x18
stb r0, 0(r3)
rlwinm r6, r7, 0x10, 0x18, 0x1f
rlwinm r5, r7, 0x18, 0x18, 0x1f
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r7, 0(r3)
lmw r27, 0x24(r1)
lwz r0, 0x3c(r1)
addi r1, r1, 0x38
mtlr r0
blr
.global GDSetTevOrder
GDSetTevOrder:
mflr r0
cmpwi r5, 0xff
stw r0, 4(r1)
stwu r1, -0x30(r1)
stw r31, 0x2c(r1)
li r31, 0
stw r30, 0x28(r1)
beq lbl_800B2728
rlwinm. r0, r5, 0, 0x17, 0x17
bne lbl_800B2728
li r31, 1
lbl_800B2728:
cmpwi r8, 0xff
li r0, 0
beq lbl_800B2740
rlwinm. r10, r8, 0, 0x17, 0x17
bne lbl_800B2740
li r0, 1
lbl_800B2740:
lis r10, c2r$382@ha
lwz r30, __GDCurrentDL@sda21(r13)
addi r12, r10, c2r$382@l
clrlwi r6, r6, 0x1c
lwz r10, 8(r30)
add r11, r12, r6
lwz r6, 0xc(r30)
lbz r11, 0(r11)
clrlwi r9, r9, 0x1c
rlwinm r4, r4, 3, 0x1a, 0x1c
rlwimi r4, r5, 0, 0x1d, 0x1f
add r9, r12, r9
srawi r12, r3, 1
lbz r9, 0(r9)
addi r3, r10, 1
addze r12, r12
cmplw r3, r6
slwi r5, r11, 7
rlwimi r4, r31, 6, 0, 0x19
or r4, r5, r4
rlwinm r8, r8, 0xc, 0x11, 0x13
rlwinm r5, r7, 0xf, 0xe, 0x10
or r4, r8, r4
slwi r7, r0, 0x12
or r0, r5, r4
addi r10, r12, 0x28
slwi r3, r9, 0x13
or r0, r7, r0
slwi r4, r10, 0x18
or r0, r3, r0
or r31, r4, r0
ble lbl_800B27C4
bl GDOverflowed
lbl_800B27C4:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x61
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B27F8
bl GDOverflowed
lbl_800B27F8:
lwz r4, __GDCurrentDL@sda21(r13)
srwi r7, r31, 0x18
rlwinm r6, r31, 0x10, 0x18, 0x1f
lwz r3, 8(r4)
rlwinm r5, r31, 0x18, 0x18, 0x1f
addi r0, r3, 1
stw r0, 8(r4)
stb r7, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r31, 0(r3)
lwz r0, 0x34(r1)
lwz r31, 0x2c(r1)
lwz r30, 0x28(r1)
addi r1, r1, 0x30
mtlr r0
blr
.section .data, "wa"
.balign 8
c2r$382:
.4byte 0x00010001
.4byte 0x00010705
.4byte 0x06000000
.4byte 0x00000007