prime/asm/Dolphin/GX/GXGeometry.s

288 lines
14 KiB
ArmAsm
Raw Normal View History

2022-04-02 21:03:04 +00:00
.include "macros.inc"
.section .text, "ax"
.global __GXSetDirtyState
__GXSetDirtyState:
/* 80378854 003757B4 7C 08 02 A6 */ mflr r0
/* 80378858 003757B8 90 01 00 04 */ stw r0, 4(r1)
/* 8037885C 003757BC 94 21 FF F8 */ stwu r1, -8(r1)
/* 80378860 003757C0 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 80378864 003757C4 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 80378868 003757C8 54 00 07 FF */ clrlwi. r0, r0, 0x1f
/* 8037886C 003757CC 41 82 00 08 */ beq lbl_80378874
/* 80378870 003757D0 48 00 22 01 */ bl __GXSetSUTexRegs
lbl_80378874:
/* 80378874 003757D4 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 80378878 003757D8 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 8037887C 003757DC 54 00 07 BD */ rlwinm. r0, r0, 0, 0x1e, 0x1e
/* 80378880 003757E0 41 82 00 08 */ beq lbl_80378888
/* 80378884 003757E4 48 00 2A A5 */ bl __GXUpdateBPMask
lbl_80378888:
/* 80378888 003757E8 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 8037888C 003757EC 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 80378890 003757F0 54 00 07 7B */ rlwinm. r0, r0, 0, 0x1d, 0x1d
/* 80378894 003757F4 41 82 00 08 */ beq lbl_8037889C
/* 80378898 003757F8 48 00 03 49 */ bl __GXSetGenMode
lbl_8037889C:
/* 8037889C 003757FC 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 803788A0 00375800 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 803788A4 00375804 54 00 07 39 */ rlwinm. r0, r0, 0, 0x1c, 0x1c
/* 803788A8 00375808 41 82 00 08 */ beq lbl_803788B0
/* 803788AC 0037580C 4B FF ED 31 */ bl __GXSetVCD
lbl_803788B0:
/* 803788B0 00375810 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 803788B4 00375814 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 803788B8 00375818 54 00 06 F7 */ rlwinm. r0, r0, 0, 0x1b, 0x1b
/* 803788BC 0037581C 41 82 00 08 */ beq lbl_803788C4
/* 803788C0 00375820 4B FF F5 9D */ bl __GXSetVAT
lbl_803788C4:
/* 803788C4 00375824 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 803788C8 00375828 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 803788CC 0037582C 54 00 06 F9 */ rlwinm. r0, r0, 0, 0x1b, 0x1c
/* 803788D0 00375830 41 82 00 08 */ beq lbl_803788D8
/* 803788D4 00375834 4B FF ED 5D */ bl __GXCalculateVLim
lbl_803788D8:
/* 803788D8 00375838 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 803788DC 0037583C 38 00 00 00 */ li r0, 0
/* 803788E0 00375840 90 03 04 F4 */ stw r0, 0x4f4(r3)
/* 803788E4 00375844 80 01 00 0C */ lwz r0, 0xc(r1)
/* 803788E8 00375848 38 21 00 08 */ addi r1, r1, 8
/* 803788EC 0037584C 7C 08 03 A6 */ mtlr r0
/* 803788F0 00375850 4E 80 00 20 */ blr
.global GXBegin
GXBegin:
/* 803788F4 00375854 7C 08 02 A6 */ mflr r0
/* 803788F8 00375858 90 01 00 04 */ stw r0, 4(r1)
/* 803788FC 0037585C 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 80378900 00375860 93 E1 00 24 */ stw r31, 0x24(r1)
/* 80378904 00375864 3B E5 00 00 */ addi r31, r5, 0
/* 80378908 00375868 93 C1 00 20 */ stw r30, 0x20(r1)
/* 8037890C 0037586C 3B C4 00 00 */ addi r30, r4, 0
/* 80378910 00375870 93 A1 00 1C */ stw r29, 0x1c(r1)
/* 80378914 00375874 3B A3 00 00 */ addi r29, r3, 0
/* 80378918 00375878 80 C2 CE 08 */ lwz r6, lbl_805AEB28@sda21(r2)
/* 8037891C 0037587C 80 06 04 F4 */ lwz r0, 0x4f4(r6)
/* 80378920 00375880 28 00 00 00 */ cmplwi r0, 0
/* 80378924 00375884 41 82 00 80 */ beq lbl_803789A4
/* 80378928 00375888 54 00 07 FF */ clrlwi. r0, r0, 0x1f
/* 8037892C 0037588C 41 82 00 08 */ beq lbl_80378934
/* 80378930 00375890 48 00 21 41 */ bl __GXSetSUTexRegs
lbl_80378934:
/* 80378934 00375894 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 80378938 00375898 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 8037893C 0037589C 54 00 07 BD */ rlwinm. r0, r0, 0, 0x1e, 0x1e
/* 80378940 003758A0 41 82 00 08 */ beq lbl_80378948
/* 80378944 003758A4 48 00 29 E5 */ bl __GXUpdateBPMask
lbl_80378948:
/* 80378948 003758A8 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 8037894C 003758AC 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 80378950 003758B0 54 00 07 7B */ rlwinm. r0, r0, 0, 0x1d, 0x1d
/* 80378954 003758B4 41 82 00 08 */ beq lbl_8037895C
/* 80378958 003758B8 48 00 02 89 */ bl __GXSetGenMode
lbl_8037895C:
/* 8037895C 003758BC 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 80378960 003758C0 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 80378964 003758C4 54 00 07 39 */ rlwinm. r0, r0, 0, 0x1c, 0x1c
/* 80378968 003758C8 41 82 00 08 */ beq lbl_80378970
/* 8037896C 003758CC 4B FF EC 71 */ bl __GXSetVCD
lbl_80378970:
/* 80378970 003758D0 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 80378974 003758D4 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 80378978 003758D8 54 00 06 F7 */ rlwinm. r0, r0, 0, 0x1b, 0x1b
/* 8037897C 003758DC 41 82 00 08 */ beq lbl_80378984
/* 80378980 003758E0 4B FF F4 DD */ bl __GXSetVAT
lbl_80378984:
/* 80378984 003758E4 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 80378988 003758E8 80 03 04 F4 */ lwz r0, 0x4f4(r3)
/* 8037898C 003758EC 54 00 06 F9 */ rlwinm. r0, r0, 0, 0x1b, 0x1c
/* 80378990 003758F0 41 82 00 08 */ beq lbl_80378998
/* 80378994 003758F4 4B FF EC 9D */ bl __GXCalculateVLim
lbl_80378998:
/* 80378998 003758F8 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 8037899C 003758FC 38 00 00 00 */ li r0, 0
/* 803789A0 00375900 90 03 04 F4 */ stw r0, 0x4f4(r3)
lbl_803789A4:
/* 803789A4 00375904 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 803789A8 00375908 80 03 00 00 */ lwz r0, 0(r3)
/* 803789AC 0037590C 28 00 00 00 */ cmplwi r0, 0
/* 803789B0 00375910 40 82 00 08 */ bne lbl_803789B8
/* 803789B4 00375914 48 00 00 31 */ bl __GXSendFlushPrim
lbl_803789B8:
/* 803789B8 00375918 7F C0 EB 78 */ or r0, r30, r29
/* 803789BC 0037591C 3C 60 CC 01 */ lis r3, 0xCC008000@ha
/* 803789C0 00375920 98 03 80 00 */ stb r0, 0xCC008000@l(r3)
/* 803789C4 00375924 B3 E3 80 00 */ sth r31, 0xCC008000@l(r3)
/* 803789C8 00375928 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 803789CC 0037592C 83 E1 00 24 */ lwz r31, 0x24(r1)
/* 803789D0 00375930 83 C1 00 20 */ lwz r30, 0x20(r1)
/* 803789D4 00375934 83 A1 00 1C */ lwz r29, 0x1c(r1)
/* 803789D8 00375938 38 21 00 28 */ addi r1, r1, 0x28
/* 803789DC 0037593C 7C 08 03 A6 */ mtlr r0
/* 803789E0 00375940 4E 80 00 20 */ blr
.global __GXSendFlushPrim
__GXSendFlushPrim:
/* 803789E4 00375944 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 803789E8 00375948 38 00 00 98 */ li r0, 0x98
/* 803789EC 0037594C 3C A0 CC 01 */ lis r5, 0xCC008000@ha
/* 803789F0 00375950 A0 C3 00 04 */ lhz r6, 4(r3)
/* 803789F4 00375954 38 80 00 00 */ li r4, 0
/* 803789F8 00375958 A0 63 00 06 */ lhz r3, 6(r3)
/* 803789FC 0037595C 7C E6 19 D6 */ mullw r7, r6, r3
/* 80378A00 00375960 98 05 80 00 */ stb r0, 0xCC008000@l(r5)
/* 80378A04 00375964 B0 C5 80 00 */ sth r6, 0xCC008000@l(r5)
/* 80378A08 00375968 38 67 00 03 */ addi r3, r7, 3
/* 80378A0C 0037596C 28 07 00 00 */ cmplwi r7, 0
/* 80378A10 00375970 54 63 F0 BE */ srwi r3, r3, 2
/* 80378A14 00375974 40 81 00 48 */ ble lbl_80378A5C
/* 80378A18 00375978 54 60 E8 FF */ rlwinm. r0, r3, 0x1d, 3, 0x1f
/* 80378A1C 0037597C 7C 09 03 A6 */ mtctr r0
/* 80378A20 00375980 41 82 00 30 */ beq lbl_80378A50
lbl_80378A24:
/* 80378A24 00375984 90 85 80 00 */ stw r4, 0xCC008000@l(r5)
/* 80378A28 00375988 90 85 80 00 */ stw r4, 0xCC008000@l(r5)
/* 80378A2C 0037598C 90 85 80 00 */ stw r4, 0xCC008000@l(r5)
/* 80378A30 00375990 90 85 80 00 */ stw r4, 0xCC008000@l(r5)
/* 80378A34 00375994 90 85 80 00 */ stw r4, 0xCC008000@l(r5)
/* 80378A38 00375998 90 85 80 00 */ stw r4, 0xCC008000@l(r5)
/* 80378A3C 0037599C 90 85 80 00 */ stw r4, 0xCC008000@l(r5)
/* 80378A40 003759A0 90 85 80 00 */ stw r4, 0xCC008000@l(r5)
/* 80378A44 003759A4 42 00 FF E0 */ bdnz lbl_80378A24
/* 80378A48 003759A8 70 63 00 07 */ andi. r3, r3, 7
/* 80378A4C 003759AC 41 82 00 10 */ beq lbl_80378A5C
lbl_80378A50:
/* 80378A50 003759B0 7C 69 03 A6 */ mtctr r3
lbl_80378A54:
/* 80378A54 003759B4 90 85 80 00 */ stw r4, 0xCC008000@l(r5)
/* 80378A58 003759B8 42 00 FF FC */ bdnz lbl_80378A54
lbl_80378A5C:
/* 80378A5C 003759BC 80 62 CE 08 */ lwz r3, lbl_805AEB28@sda21(r2)
/* 80378A60 003759C0 38 00 00 01 */ li r0, 1
/* 80378A64 003759C4 B0 03 00 02 */ sth r0, 2(r3)
/* 80378A68 003759C8 4E 80 00 20 */ blr
.global GXSetLineWidth
GXSetLineWidth:
/* 80378A6C 003759CC 80 E2 CE 08 */ lwz r7, lbl_805AEB28@sda21(r2)
/* 80378A70 003759D0 54 86 80 1E */ slwi r6, r4, 0x10
/* 80378A74 003759D4 38 A0 00 61 */ li r5, 0x61
/* 80378A78 003759D8 80 07 00 7C */ lwz r0, 0x7c(r7)
/* 80378A7C 003759DC 3C 80 CC 01 */ lis r4, 0xCC008000@ha
/* 80378A80 003759E0 54 00 00 2E */ rlwinm r0, r0, 0, 0, 0x17
/* 80378A84 003759E4 50 60 06 3E */ rlwimi r0, r3, 0, 0x18, 0x1f
/* 80378A88 003759E8 90 07 00 7C */ stw r0, 0x7c(r7)
/* 80378A8C 003759EC 38 00 00 00 */ li r0, 0
/* 80378A90 003759F0 80 67 00 7C */ lwz r3, 0x7c(r7)
/* 80378A94 003759F4 54 63 04 18 */ rlwinm r3, r3, 0, 0x10, 0xc
/* 80378A98 003759F8 7C 63 33 78 */ or r3, r3, r6
/* 80378A9C 003759FC 90 67 00 7C */ stw r3, 0x7c(r7)
/* 80378AA0 00375A00 98 A4 80 00 */ stb r5, 0xCC008000@l(r4)
/* 80378AA4 00375A04 80 67 00 7C */ lwz r3, 0x7c(r7)
/* 80378AA8 00375A08 90 64 80 00 */ stw r3, 0xCC008000@l(r4)
/* 80378AAC 00375A0C B0 07 00 02 */ sth r0, 2(r7)
/* 80378AB0 00375A10 4E 80 00 20 */ blr
.global GXSetPointSize
GXSetPointSize:
/* 80378AB4 00375A14 80 E2 CE 08 */ lwz r7, lbl_805AEB28@sda21(r2)
/* 80378AB8 00375A18 54 86 98 18 */ slwi r6, r4, 0x13
/* 80378ABC 00375A1C 38 A0 00 61 */ li r5, 0x61
/* 80378AC0 00375A20 80 07 00 7C */ lwz r0, 0x7c(r7)
/* 80378AC4 00375A24 3C 80 CC 01 */ lis r4, 0xCC008000@ha
/* 80378AC8 00375A28 54 00 06 1E */ rlwinm r0, r0, 0, 0x18, 0xf
/* 80378ACC 00375A2C 50 60 44 2E */ rlwimi r0, r3, 8, 0x10, 0x17
/* 80378AD0 00375A30 90 07 00 7C */ stw r0, 0x7c(r7)
/* 80378AD4 00375A34 38 00 00 00 */ li r0, 0
/* 80378AD8 00375A38 80 67 00 7C */ lwz r3, 0x7c(r7)
/* 80378ADC 00375A3C 54 63 03 52 */ rlwinm r3, r3, 0, 0xd, 9
/* 80378AE0 00375A40 7C 63 33 78 */ or r3, r3, r6
/* 80378AE4 00375A44 90 67 00 7C */ stw r3, 0x7c(r7)
/* 80378AE8 00375A48 98 A4 80 00 */ stb r5, 0xCC008000@l(r4)
/* 80378AEC 00375A4C 80 67 00 7C */ lwz r3, 0x7c(r7)
/* 80378AF0 00375A50 90 64 80 00 */ stw r3, 0xCC008000@l(r4)
/* 80378AF4 00375A54 B0 07 00 02 */ sth r0, 2(r7)
/* 80378AF8 00375A58 4E 80 00 20 */ blr
.global GXEnableTexOffsets
GXEnableTexOffsets:
/* 80378AFC 00375A5C 80 C2 CE 08 */ lwz r6, lbl_805AEB28@sda21(r2)
/* 80378B00 00375A60 54 68 10 3A */ slwi r8, r3, 2
/* 80378B04 00375A64 7C E6 42 14 */ add r7, r6, r8
/* 80378B08 00375A68 80 07 00 B8 */ lwz r0, 0xb8(r7)
/* 80378B0C 00375A6C 7D 26 42 14 */ add r9, r6, r8
/* 80378B10 00375A70 54 03 03 98 */ rlwinm r3, r0, 0, 0xe, 0xc
/* 80378B14 00375A74 54 80 91 9A */ rlwinm r0, r4, 0x12, 6, 0xd
/* 80378B18 00375A78 7C 60 03 78 */ or r0, r3, r0
/* 80378B1C 00375A7C 90 07 00 B8 */ stw r0, 0xb8(r7)
/* 80378B20 00375A80 54 A0 99 58 */ rlwinm r0, r5, 0x13, 5, 0xc
/* 80378B24 00375A84 38 A0 00 61 */ li r5, 0x61
/* 80378B28 00375A88 80 69 00 B8 */ lwz r3, 0xb8(r9)
/* 80378B2C 00375A8C 3C 80 CC 01 */ lis r4, 0xCC008000@ha
/* 80378B30 00375A90 54 63 03 56 */ rlwinm r3, r3, 0, 0xd, 0xb
/* 80378B34 00375A94 7C 60 03 78 */ or r0, r3, r0
/* 80378B38 00375A98 90 09 00 B8 */ stw r0, 0xb8(r9)
/* 80378B3C 00375A9C 7C 66 42 14 */ add r3, r6, r8
/* 80378B40 00375AA0 38 00 00 00 */ li r0, 0
/* 80378B44 00375AA4 98 A4 80 00 */ stb r5, 0xCC008000@l(r4)
/* 80378B48 00375AA8 80 63 00 B8 */ lwz r3, 0xb8(r3)
/* 80378B4C 00375AAC 90 64 80 00 */ stw r3, 0xCC008000@l(r4)
/* 80378B50 00375AB0 B0 06 00 02 */ sth r0, 2(r6)
/* 80378B54 00375AB4 4E 80 00 20 */ blr
.global GXSetCullMode
GXSetCullMode:
/* 80378B58 00375AB8 2C 03 00 02 */ cmpwi r3, 2
/* 80378B5C 00375ABC 41 82 00 1C */ beq lbl_80378B78
/* 80378B60 00375AC0 40 80 00 1C */ bge lbl_80378B7C
/* 80378B64 00375AC4 2C 03 00 01 */ cmpwi r3, 1
/* 80378B68 00375AC8 40 80 00 08 */ bge lbl_80378B70
/* 80378B6C 00375ACC 48 00 00 10 */ b lbl_80378B7C
lbl_80378B70:
/* 80378B70 00375AD0 38 60 00 02 */ li r3, 2
/* 80378B74 00375AD4 48 00 00 08 */ b lbl_80378B7C
lbl_80378B78:
/* 80378B78 00375AD8 38 60 00 01 */ li r3, 1
lbl_80378B7C:
/* 80378B7C 00375ADC 80 82 CE 08 */ lwz r4, lbl_805AEB28@sda21(r2)
/* 80378B80 00375AE0 54 60 70 22 */ slwi r0, r3, 0xe
/* 80378B84 00375AE4 80 64 02 04 */ lwz r3, 0x204(r4)
/* 80378B88 00375AE8 54 63 04 9E */ rlwinm r3, r3, 0, 0x12, 0xf
/* 80378B8C 00375AEC 7C 60 03 78 */ or r0, r3, r0
/* 80378B90 00375AF0 90 04 02 04 */ stw r0, 0x204(r4)
/* 80378B94 00375AF4 80 04 04 F4 */ lwz r0, 0x4f4(r4)
/* 80378B98 00375AF8 60 00 00 04 */ ori r0, r0, 4
/* 80378B9C 00375AFC 90 04 04 F4 */ stw r0, 0x4f4(r4)
/* 80378BA0 00375B00 4E 80 00 20 */ blr
.global GXSetCoPlanar
GXSetCoPlanar:
/* 80378BA4 00375B04 80 C2 CE 08 */ lwz r6, lbl_805AEB28@sda21(r2)
/* 80378BA8 00375B08 54 60 99 58 */ rlwinm r0, r3, 0x13, 5, 0xc
/* 80378BAC 00375B0C 38 80 00 61 */ li r4, 0x61
/* 80378BB0 00375B10 80 A6 02 04 */ lwz r5, 0x204(r6)
/* 80378BB4 00375B14 3C 60 CC 01 */ lis r3, 0xCC008000@ha
/* 80378BB8 00375B18 54 A5 03 56 */ rlwinm r5, r5, 0, 0xd, 0xb
/* 80378BBC 00375B1C 7C A0 03 78 */ or r0, r5, r0
/* 80378BC0 00375B20 90 06 02 04 */ stw r0, 0x204(r6)
/* 80378BC4 00375B24 3C 00 FE 08 */ lis r0, 0xfe08
/* 80378BC8 00375B28 98 83 80 00 */ stb r4, 0xCC008000@l(r3)
/* 80378BCC 00375B2C 90 03 80 00 */ stw r0, 0xCC008000@l(r3)
/* 80378BD0 00375B30 98 83 80 00 */ stb r4, 0xCC008000@l(r3)
/* 80378BD4 00375B34 80 06 02 04 */ lwz r0, 0x204(r6)
/* 80378BD8 00375B38 90 03 80 00 */ stw r0, 0xCC008000@l(r3)
/* 80378BDC 00375B3C 4E 80 00 20 */ blr
.global __GXSetGenMode
__GXSetGenMode:
/* 80378BE0 00375B40 38 00 00 61 */ li r0, 0x61
/* 80378BE4 00375B44 80 82 CE 08 */ lwz r4, lbl_805AEB28@sda21(r2)
/* 80378BE8 00375B48 3C A0 CC 01 */ lis r5, 0xCC008000@ha
/* 80378BEC 00375B4C 98 05 80 00 */ stb r0, 0xCC008000@l(r5)
/* 80378BF0 00375B50 38 00 00 00 */ li r0, 0
/* 80378BF4 00375B54 80 64 02 04 */ lwz r3, 0x204(r4)
/* 80378BF8 00375B58 90 65 80 00 */ stw r3, 0xCC008000@l(r5)
/* 80378BFC 00375B5C B0 04 00 02 */ sth r0, 2(r4)
/* 80378C00 00375B60 4E 80 00 20 */ blr