librw/tests/ps2/skinpipe.dsm

96 lines
2.2 KiB
Plaintext
Raw Normal View History

2015-01-18 18:35:23 +00:00
.global skinPipe
.equ vertexTop, 0x2d0
.equ numInAttribs, 5
.equ numOutAttribs, 3
.equ numOutBuf, 2
.equ vertCount, ((vertexTop-numOutBuf)/(numInAttribs*2+numOutAttribs*numOutBuf))
.equ offset, (vertCount*numInAttribs)
.equ outBuf1, (2*offset)
.equ outSize, ((vertexTop-outBuf1-2)/2)
.equ outBuf2, (outBuf1+outSize)
.equ lightMat, 0x3d0
.equ lightDir, 0x3d4
2015-01-18 18:35:23 +00:00
.equ matrix, 0x3f0
.equ screenOffset, 0x3f9
.equ gifTag, 0x3fa
.equ matColor, 0x3fb
.equ ambientLight, 0x3fd
.balign 16,0
skinPipe:
DMAret *
MPG 0, *
.vu
Start:
NOP LQ VF25, screenOffset(VI00)
NOP LQ VF28, matrix(VI00)
NOP LQ VF29, matrix+1(VI00)
NOP LQ VF30, matrix+2(VI00)
NOP LQ VF31, matrix+3(VI00)
NOP IADDIU VI12, VI00, outBuf1
NOP IADDIU VI13, VI00, outBuf2
Cnt:
NOP XTOP VI02 ; input pointer
NOP LQ VF01, gifTag(VI00)
NOP XITOP VI01 ; vertex count
NOP IADDIU VI05, VI00, 0x4000
NOP IADD VI05, VI05, VI05
NOP IOR VI05, VI05, VI01
NOP SQ VF01, 0(VI12)
NOP ISW.x VI05, 0(VI12)
NOP IADDIU VI03, VI12, 1 ; output pointer
NOP LQ VF18, lightMat(VI00)
NOP LQ VF19, lightMat+1(VI00)
NOP LQ VF20, lightMat+2(VI00)
2015-01-18 18:35:23 +00:00
Loop:
NOP LQI VF01, (VI02++) ; vertex
NOP LQI VF02, (VI02++) ; UV - skip
NOP LQI VF02, (VI02++) ; color
NOP LQI VF03, (VI02++) ; normal
NOP IADDIU VI02, VI02, 1 ; skip weights
MULAw.xyzw ACC, VF31, VF00w NOP
MADDAx.xyzw ACC, VF28, VF01x NOP
MADDAy.xyzw ACC, VF29, VF01y NOP
MADDz.xyzw VF01, VF30, VF01z NOP
ITOF0 VF02, VF02 NOP
ITOF0[I] VF03, VF03 LOI 0.0078125 ; - normal scale
NOP NOP
NOP DIV Q, VF00w, VF01w
NOP WAITQ
MULq VF01, VF01, Q NOP ; perspective division
MULi VF03, VF03, I NOP ; scale normal
NOP NOP
NOP NOP
SUB.w VF01, VF01, VF01 NOP
MULAx.xyz ACC, VF18, VF03x NOP ; transform normal
MADDAy.xyz ACC, VF19, VF03y NOP
MADDz.xyz VF03, VF20, VF03z NOP
2015-01-18 18:35:23 +00:00
ADD.xy VF01, VF01, VF25 NOP
NOP NOP
NOP NOP
FTOI0 VF02, VF02 NOP
FTOI4 VF01, VF01 NOP
NOP SQ VF03, -2(VI02) ; store normal
2015-01-18 18:35:23 +00:00
NOP IADDI VI01, VI01, -1
NOP SQI VF02, (VI03++) ; color
NOP SQI VF01, (VI03++) ; vertex
NOP IBNE VI01, VI00, Loop
NOP NOP
.include "light.vu"
NOP XGKICK VI12
NOP IADD VI15,VI00,VI12
NOP IADD VI12,VI00,VI13
NOP[E] IADD VI13,VI00,VI15
NOP NOP
NOP B Cnt
NOP NOP
.EndMPG
.EndDmaData