.include "macros.inc"
.section .text, "ax"
.global GXDrawSphere
GXDrawSphere:
mflr r0
stw r0, 4(r1)
clrlwi r0, r4, 0x18
stwu r1, -0xd0(r1)
stfd f31, 0xc8(r1)
stfd f30, 0xc0(r1)
stfd f29, 0xb8(r1)
stfd f28, 0xb0(r1)
stfd f27, 0xa8(r1)
stfd f26, 0xa0(r1)
stfd f25, 0x98(r1)
stfd f24, 0x90(r1)
stfd f23, 0x88(r1)
stfd f22, 0x80(r1)
stfd f21, 0x78(r1)
stfd f20, 0x70(r1)
stfd f19, 0x68(r1)
stmw r21, 0x3c(r1)
mr r22, r3
clrlwi r3, r3, 0x18
stw r3, 0x34(r1)
lis r3, 0x4330
mr r21, r4
stw r0, 0x2c(r1)
lis r4, vcd@ha
addi r26, r4, vcd@l
stw r3, 0x30(r1)
addi r4, r1, 0x10
stw r3, 0x28(r1)
li r3, 0xd
lfd f2, 0x30(r1)
lfd f0, 0x28(r1)
lfd f3, "@364"@sda21(r2)
lfs f4, "@358"@sda21(r2)
fsubs f2, f2, f3
lfs f1, "@405"@sda21(r2)
fsubs f0, f0, f3
fdivs f25, f4, f2
fdivs f24, f1, f0
bl GXGetVtxDesc
mr r3, r26
bl GXGetVtxDescv
li r3, 3
addi r4, r26, 0xd8
bl GXGetVtxAttrFmtv
bl GXClearVtxDesc
li r3, 9
li r4, 1
bl GXSetVtxDesc
li r3, 0xa
li r4, 1
bl GXSetVtxDesc
li r3, 3
li r4, 9
li r5, 1
li r6, 4
li r7, 0
bl GXSetVtxAttrFmt
li r3, 3
li r4, 0xa
li r5, 0
li r6, 4
li r7, 0
bl GXSetVtxAttrFmt
lwz r0, 0x10(r1)
cmpwi r0, 0
beq lbl_800ACCB8
li r3, 0xd
li r4, 1
bl GXSetVtxDesc
li r3, 3
li r4, 0xd
li r5, 1
li r6, 4
li r7, 0
bl GXSetVtxAttrFmt
lbl_800ACCB8:
clrlwi r23, r21, 0x18
lfd f26, "@362"@sda21(r2)
addi r0, r23, 1
lfs f28, "@357"@sda21(r2)
lfd f30, "@364"@sda21(r2)
slwi r25, r0, 1
clrlwi r24, r22, 0x18
li r22, 0
lis r29, 0x4330
lis r30, 0xcc01
b lbl_800ACEA0
lbl_800ACCE4:
xoris r27, r22, 0x8000
stw r27, 0x2c(r1)
stw r29, 0x28(r1)
lfd f0, 0x28(r1)
fsubs f0, f0, f26
fmuls f20, f0, f25
fmr f1, f20
fadds f27, f20, f25
bl sinf
fmuls f23, f28, f1
fmr f1, f27
bl sinf
fmuls f22, f28, f1
fmr f1, f20
bl cosf
fmuls f21, f28, f1
fmr f1, f27
bl cosf
fmuls f20, f28, f1
clrlwi r5, r25, 0x10
li r3, 0x98
li r4, 3
bl GXBegin
fdivs f29, f20, f28
addi r0, r22, 1
xoris r31, r0, 0x8000
li r21, 0
fdivs f31, f21, f28
b lbl_800ACE94
lbl_800ACD58:
xoris r28, r21, 0x8000
stw r28, 0x2c(r1)
stw r29, 0x28(r1)
lfd f0, 0x28(r1)
fsubs f0, f0, f26
fmuls f19, f0, f24
fmr f1, f19
bl cosf
fmr f27, f1
fmr f1, f19
bl sinf
fmuls f0, f27, f22
lwz r0, 0x10(r1)
fmuls f3, f1, f22
cmpwi r0, 0
fdivs f2, f0, f28
stfs f0, -0x8000(r30)
stfs f3, -0x8000(r30)
stfs f20, -0x8000(r30)
fdivs f0, f3, f28
stfs f2, -0x8000(r30)
stfs f0, -0x8000(r30)
stfs f29, -0x8000(r30)
beq lbl_800ACE08
stw r28, 0x2c(r1)
stw r23, 0x34(r1)
stw r29, 0x28(r1)
stw r29, 0x30(r1)
lfd f2, 0x28(r1)
stw r31, 0x24(r1)
lfd f0, 0x30(r1)
fsubs f2, f2, f26
stw r24, 0x1c(r1)
fsubs f0, f0, f30
stw r29, 0x20(r1)
stw r29, 0x18(r1)
fdivs f3, f2, f0
lfd f2, 0x20(r1)
lfd f0, 0x18(r1)
fsubs f2, f2, f26
stfs f3, -0x8000(r30)
fsubs f0, f0, f30
fdivs f0, f2, f0
stfs f0, -0x8000(r30)
lbl_800ACE08:
fmuls f0, f27, f23
lwz r0, 0x10(r1)
fmuls f2, f1, f23
cmpwi r0, 0
fdivs f1, f0, f28
stfs f0, -0x8000(r30)
stfs f2, -0x8000(r30)
stfs f21, -0x8000(r30)
fdivs f0, f2, f28
stfs f1, -0x8000(r30)
stfs f0, -0x8000(r30)
stfs f31, -0x8000(r30)
beq lbl_800ACE90
xoris r0, r21, 0x8000
stw r23, 0x24(r1)
stw r0, 0x1c(r1)
stw r29, 0x18(r1)
stw r29, 0x20(r1)
lfd f1, 0x18(r1)
stw r27, 0x2c(r1)
lfd f0, 0x20(r1)
fsubs f1, f1, f26
stw r24, 0x34(r1)
fsubs f0, f0, f30
stw r29, 0x28(r1)
stw r29, 0x30(r1)
fdivs f2, f1, f0
lfd f1, 0x28(r1)
lfd f0, 0x30(r1)
fsubs f1, f1, f26
stfs f2, -0x8000(r30)
fsubs f0, f0, f30
fdivs f0, f1, f0
stfs f0, -0x8000(r30)
lbl_800ACE90:
addi r21, r21, 1
lbl_800ACE94:
cmpw r21, r23
ble lbl_800ACD58
addi r22, r22, 1
lbl_800ACEA0:
cmpw r22, r24
blt lbl_800ACCE4
mr r3, r26
bl GXSetVtxDescv
li r3, 3
addi r4, r26, 0xd8
bl GXSetVtxAttrFmtv
lmw r21, 0x3c(r1)
lwz r0, 0xd4(r1)
lfd f31, 0xc8(r1)
lfd f30, 0xc0(r1)
lfd f29, 0xb8(r1)
lfd f28, 0xb0(r1)
lfd f27, 0xa8(r1)
lfd f26, 0xa0(r1)
lfd f25, 0x98(r1)
lfd f24, 0x90(r1)
lfd f23, 0x88(r1)
lfd f22, 0x80(r1)
lfd f21, 0x78(r1)
lfd f20, 0x70(r1)
lfd f19, 0x68(r1)
addi r1, r1, 0xd0
mtlr r0
blr
.global GXDrawCubeFace
GXDrawCubeFace:
stwu r1, -0x58(r1)
fadds f9, f2, f5
fadds f0, f1, f4
lis r5, 0xCC008000@ha
stfd f31, 0x50(r1)
fadds f10, f3, f6
stfd f30, 0x48(r1)
lfs f11, 0x60(r1)
fadds f30, f7, f0
stfd f29, 0x40(r1)
fadds f13, f8, f9
cmpwi r3, 0
stfd f28, 0x38(r1)
fadds f12, f11, f10
stfd f27, 0x30(r1)
lfs f31, "@493"@sda21(r2)
fmuls f30, f31, f30
fmuls f13, f31, f13
fmuls f12, f31, f12
stfs f30, 0xCC008000@l(r5)
stfs f13, -0x8000(r5)
stfs f12, -0x8000(r5)
stfs f1, -0x8000(r5)
stfs f2, -0x8000(r5)
stfs f3, -0x8000(r5)
beq lbl_800ACF84
stfs f4, -0x8000(r5)
stfs f5, -0x8000(r5)
stfs f6, -0x8000(r5)
stfs f7, -0x8000(r5)
stfs f8, -0x8000(r5)
stfs f11, -0x8000(r5)
lbl_800ACF84:
cmpwi r4, 0
beq lbl_800ACF9C
li r0, 1
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
stb r0, -0x8000(r5)
lbl_800ACF9C:
fsubs f29, f1, f4
lfs f31, "@493"@sda21(r2)
fsubs f28, f2, f5
lis r5, 0xCC008000@ha
fsubs f27, f3, f6
fadds f30, f7, f29
cmpwi r3, 0
fadds f13, f8, f28
fadds f12, f11, f27
fmuls f30, f31, f30
fmuls f13, f31, f13
fmuls f12, f31, f12
stfs f30, 0xCC008000@l(r5)
stfs f13, -0x8000(r5)
stfs f12, -0x8000(r5)
stfs f1, -0x8000(r5)
stfs f2, -0x8000(r5)
stfs f3, -0x8000(r5)
beq lbl_800AD000
stfs f4, -0x8000(r5)
stfs f5, -0x8000(r5)
stfs f6, -0x8000(r5)
stfs f7, -0x8000(r5)
stfs f8, -0x8000(r5)
stfs f11, -0x8000(r5)
lbl_800AD000:
cmpwi r4, 0
beq lbl_800AD01C
li r0, 0
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
li r0, 1
stb r0, -0x8000(r5)
lbl_800AD01C:
fsubs f31, f29, f7
lfs f30, "@493"@sda21(r2)
fsubs f13, f28, f8
lis r5, 0xCC008000@ha
fsubs f12, f27, f11
fmuls f31, f30, f31
cmpwi r3, 0
fmuls f13, f30, f13
fmuls f12, f30, f12
stfs f31, 0xCC008000@l(r5)
stfs f13, -0x8000(r5)
stfs f12, -0x8000(r5)
stfs f1, -0x8000(r5)
stfs f2, -0x8000(r5)
stfs f3, -0x8000(r5)
beq lbl_800AD074
stfs f4, -0x8000(r5)
stfs f5, -0x8000(r5)
stfs f6, -0x8000(r5)
stfs f7, -0x8000(r5)
stfs f8, -0x8000(r5)
stfs f11, -0x8000(r5)
lbl_800AD074:
cmpwi r4, 0
beq lbl_800AD08C
li r0, 0
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
stb r0, -0x8000(r5)
lbl_800AD08C:
fsubs f12, f0, f7
lfs f13, "@493"@sda21(r2)
fsubs f9, f9, f8
lis r5, 0xCC008000@ha
fsubs f0, f10, f11
fmuls f10, f13, f12
cmpwi r3, 0
fmuls f9, f13, f9
fmuls f0, f13, f0
stfs f10, 0xCC008000@l(r5)
stfs f9, -0x8000(r5)
stfs f0, -0x8000(r5)
stfs f1, -0x8000(r5)
stfs f2, -0x8000(r5)
stfs f3, -0x8000(r5)
beq lbl_800AD0E4
stfs f4, -0x8000(r5)
stfs f5, -0x8000(r5)
stfs f6, -0x8000(r5)
stfs f7, -0x8000(r5)
stfs f8, -0x8000(r5)
stfs f11, -0x8000(r5)
lbl_800AD0E4:
cmpwi r4, 0
beq lbl_800AD100
li r0, 1
lis r3, 0xCC008000@ha
stb r0, 0xCC008000@l(r3)
li r0, 0
stb r0, -0x8000(r3)
lbl_800AD100:
lfd f31, 0x50(r1)
lfd f30, 0x48(r1)
lfd f29, 0x40(r1)
lfd f28, 0x38(r1)
lfd f27, 0x30(r1)
addi r1, r1, 0x58
blr
.global GXDrawCube
GXDrawCube:
mflr r0
lis r3, vcd@ha
stw r0, 4(r1)
stwu r1, -0x20(r1)
stw r31, 0x1c(r1)
addi r31, r3, vcd@l
addi r4, r1, 0x14
li r3, 0x19
bl GXGetVtxDesc
li r3, 0xd
addi r4, r1, 0x10
bl GXGetVtxDesc
mr r3, r31
bl GXGetVtxDescv
li r3, 3
addi r4, r31, 0xd8
bl GXGetVtxAttrFmtv
bl GXClearVtxDesc
li r3, 9
li r4, 1
bl GXSetVtxDesc
li r3, 0xa
li r4, 1
bl GXSetVtxDesc
li r3, 3
li r4, 9
li r5, 1
li r6, 4
li r7, 0
bl GXSetVtxAttrFmt
li r3, 3
li r4, 0xa
li r5, 0
li r6, 4
li r7, 0
bl GXSetVtxAttrFmt
lwz r0, 0x14(r1)
cmpwi r0, 0
beq lbl_800AD1DC
li r3, 0x19
li r4, 1
bl GXSetVtxDesc
li r3, 3
li r4, 0x19
li r5, 1
li r6, 4
li r7, 0
bl GXSetVtxAttrFmt
lbl_800AD1DC:
lwz r0, 0x10(r1)
cmpwi r0, 0
beq lbl_800AD20C
li r3, 0xd
li r4, 1
bl GXSetVtxDesc
li r3, 3
li r4, 0xd
li r5, 1
li r6, 1
li r7, 0
bl GXSetVtxAttrFmt
lbl_800AD20C:
li r3, 0x80
li r4, 3
li r5, 0x18
bl GXBegin
lfs f2, "@133"@sda21(r2)
stfs f2, 8(r1)
fmr f3, f2
fmr f4, f2
lfs f1, "@360"@sda21(r2)
fmr f5, f2
fmr f7, f2
fmr f6, f1
lfs f8, "@357"@sda21(r2)
lwz r3, 0x14(r1)
lwz r4, 0x10(r1)
bl GXDrawCubeFace
lfs f0, "@360"@sda21(r2)
stfs f0, 8(r1)
lfs f2, "@133"@sda21(r2)
lfs f1, "@357"@sda21(r2)
fmr f3, f2
lwz r3, 0x14(r1)
fmr f4, f2
lwz r4, 0x10(r1)
fmr f5, f1
fmr f6, f2
fmr f7, f2
fmr f8, f2
bl GXDrawCubeFace
lfs f0, "@357"@sda21(r2)
stfs f0, 8(r1)
lfs f1, "@133"@sda21(r2)
lfs f2, "@360"@sda21(r2)
fmr f3, f1
lwz r3, 0x14(r1)
fmr f4, f2
lwz r4, 0x10(r1)
fmr f5, f1
fmr f6, f1
fmr f7, f1
fmr f8, f1
bl GXDrawCubeFace
lfs f1, "@133"@sda21(r2)
stfs f1, 8(r1)
fmr f3, f1
fmr f4, f1
lfs f2, "@357"@sda21(r2)
fmr f5, f1
fmr f8, f1
fmr f6, f2
lfs f7, "@360"@sda21(r2)
lwz r3, 0x14(r1)
lwz r4, 0x10(r1)
bl GXDrawCubeFace
lfs f1, "@133"@sda21(r2)
stfs f1, 8(r1)
fmr f2, f1
fmr f4, f1
lfs f3, "@360"@sda21(r2)
fmr f6, f1
fmr f8, f1
fmr f5, f3
lfs f7, "@357"@sda21(r2)
lwz r3, 0x14(r1)
lwz r4, 0x10(r1)
bl GXDrawCubeFace
lfs f1, "@133"@sda21(r2)
stfs f1, 8(r1)
fmr f2, f1
fmr f5, f1
lfs f3, "@357"@sda21(r2)
fmr f6, f1
fmr f7, f1
fmr f4, f3
lfs f8, "@360"@sda21(r2)
lwz r3, 0x14(r1)
lwz r4, 0x10(r1)
bl GXDrawCubeFace
mr r3, r31
bl GXSetVtxDescv
li r3, 3
addi r4, r31, 0xd8
bl GXSetVtxAttrFmtv
lwz r0, 0x24(r1)
lwz r31, 0x1c(r1)
addi r1, r1, 0x20
mtlr r0
blr
.section .sdata2, "a"
.balign 8
"@133":
.4byte 0
"@357":
.4byte 0x3F800000
"@358":
.4byte 0x40490FDB
"@360":
.4byte 0xBF800000
"@362":
.4byte 0x43300000
.4byte 0x80000000
"@364":
.4byte 0x43300000
.4byte 0
"@405":
.4byte 0x40C90FDB
"@493":
.4byte 0x3F13CD3A
.section .bss, "wa"
vcd:
.skip 0xD8
vat:
.skip 0x1B0