diff --git a/docs/r3000gte/gte_macros.h b/docs/r3000gte/gte_macros.h index 2280ad4..c16cfbe 100644 --- a/docs/r3000gte/gte_macros.h +++ b/docs/r3000gte/gte_macros.h @@ -505,3 +505,1029 @@ #define gte_ngpl0() gte_nGPL(0) #define gte_gpl0() gte_GPL(0) + + +/** + * Memory and register management + */ + +#define gte_ldv0(r0) __asm__ ( \ + "lwc2 $0, 0(%0);" \ + "lwc2 $1, 4(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldv1(r0) __asm__ ( \ + "lwc2 $2, 0(%0);" \ + "lwc2 $3, 4(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldv2(r0) __asm__ ( \ + "lwc2 $4, 0(%0);" \ + "lwc2 $5, 4(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldv3(r0, r1, r2) __asm__ ( \ + "lwc2 $0, 0(%0);" \ + "lwc2 $1, 4(%0);" \ + "lwc2 $2, 0(%1);" \ + "lwc2 $3, 4(%1);" \ + "lwc2 $4, 0(%2);" \ + "lwc2 $5, 4(%2)" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + ) + +#define gte_ldv3c(r0) __asm__ ( \ + "lwc2 $0, 0(%0);" \ + "lwc2 $1, 4(%0);" \ + "lwc2 $2, 8(%0);" \ + "lwc2 $3, 12(%0);" \ + "lwc2 $4, 16(%0);" \ + "lwc2 $5, 20(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldv3c_vertc(r0) __asm__ ( \ + "lwc2 $0, 0(%0);" \ + "lwc2 $1, 4(%0);" \ + "lwc2 $2, 12(%0);" \ + "lwc2 $3, 16(%0);" \ + "lwc2 $4, 24(%0);" \ + "lwc2 $5, 28(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldv01( r0, r1 ) __asm__ ( \ + "lwc2 $0, 0(%0);" \ + "lwc2 $1, 4(%0);" \ + "lwc2 $2, 0(%1);" \ + "lwc2 $3, 4(%1)" \ + : : "r"(r0), "r"(r1) \ + ) + +#define gte_ldv01c(r0) __asm__ ( \ + "lwc2 $0, 0(%0);" \ + "lwc2 $1, 4(%0);" \ + "lwc2 $2, 8(%0);" \ + "lwc2 $3, 12(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldrgb(r0) __asm__ ( \ + "lwc2 $6, 0(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldrgb3( r0, r1, r2 ) __asm__ ( \ + "lwc2 $20, 0(%0);" \ + "lwc2 $21, 0(%1);" \ + "lwc2 $22, 0(%2);" \ + "lwc2 $6, 0(%2)" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + ) + +#define gte_ldrgb3c(r0) __asm__ ( \ + "lwc2 $20, 0(%0);" \ + "lwc2 $21, 4(%0);" \ + "lwc2 $22, 8(%0);" \ + "lwc2 $6, 8(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldlv0(r0) __asm__ ( \ + "lhu $13, 4(%0);" \ + "lhu $12, 0(%0);" \ + "sll $13, $13, 16;" \ + "or $12, $12, $13;" \ + "mtc2 $12, $0;" \ + "lwc2 $1, 8(%0)" \ + : : "r"(r0) \ + : "$12", "$13" \ + ) + +#define gte_ldlvl(r0) __asm__ ( \ + "lwc2 $9, 0(%0);" \ + "lwc2 $10, 4(%0);" \ + "lwc2 $11, 8(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldsv(r0) __asm__ ( \ + "lhu $12, 0(%0);" \ + "lhu $13, 2(%0);" \ + "lhu $14, 4(%0);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10;" \ + "mtc2 $14, $11" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ldbv(r0) __asm__ ( \ + "lbu $12, 0(%0);" \ + "lbu $13, 1(%0);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10" \ + : : "r"(r0) \ + : "$12", "$13" \ + ) + +#define gte_ldcv(r0) __asm__ ( \ + "lbu $12, 0(%0);" \ + "lbu $13, 1(%0);" \ + "lbu $14, 2(%0);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10;" \ + "mtc2 $14, $11" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ldclmv(r0) __asm__ ( \ + "lhu $12, 0(%0);" \ + "lhu $13, 6(%0);" \ + "lhu $14, 12(%0);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10;" \ + "mtc2 $14, $11" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_lddp(r0) __asm__ ( \ + "mtc2 %0, $8" \ + : : "r"(r0) \ + ) + +#define gte_ldsxy0(r0) __asm__ ( \ + "mtc2 %0, $12" \ + : : "r"(r0) \ + ) + +#define gte_ldsxy1(r0) __asm__ ( \ + "mtc2 %0, $13" \ + : : "r"(r0) \ + ) + +#define gte_ldsxy2(r0) __asm__ ( \ + "mtc2 %0, $14" \ + : : "r"(r0) \ + ) + +#define gte_ldsxy3( r0, r1, r2 ) __asm__ ( \ + "mtc2 %0, $12;" \ + "mtc2 %2, $14;" \ + "mtc2 %1, $13" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + ) + +#define gte_ldsxy3c(r0) __asm__ ( \ + "lwc2 $12, 0(%0);" \ + "lwc2 $13, 4(%0);" \ + "lwc2 $14, 8(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldsz3( r0, r1, r2 ) __asm__ ( \ + "mtc2 %0, $17;" \ + "mtc2 %1, $18;" \ + "mtc2 %2, $19" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + ) + +#define gte_ldsz4( r0, r1, r2, r3 ) __asm__ ( \ + "mtc2 %0, $16;" \ + "mtc2 %1, $17;" \ + "mtc2 %2, $18;" \ + "mtc2 %3, $19" \ + : : "r"(r0), "r"(r1), "r"(r2), "r"(r3) \ + ) + +#define gte_ldopv1(r0) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 4(%0);" \ + "ctc2 $12, $0;" \ + "lw $14, 8(%0);" \ + "ctc2 $13, $2;" \ + "ctc2 $14, $4" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ldopv2(r0) __asm__ ( \ + "lwc2 $11, 8(%0);" \ + "lwc2 $9, 0(%0);" \ + "lwc2 $10, 4(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldlzc(r0) __asm__ ( \ + "mtc2 %0, $30" \ + : : "r"(r0) \ + ) + +#define gte_SetRGBcd(r0) __asm__ ( \ + "lwc2 $6, 0(%0)" \ + : : "r"(r0) \ + ) + +#define gte_ldbkdir( r0, r1, r2 ) __asm__ ( \ + "ctc2 %0, $13;" \ + "ctc2 %1, $14;" \ + "ctc2 %2, $15" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + ) + +#define gte_SetBackColor( r0, r1, r2 ) __asm__ ( \ + "sll $12, %0, 4;" \ + "sll $13, %1, 4;" \ + "sll $14, %2, 4;" \ + "ctc2 $12, $13;" \ + "ctc2 $13, $14;" \ + "ctc2 $14, $15" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ldfcdir( r0, r1, r2 ) __asm__ ( \ + "ctc2 %0, $21;" \ + "ctc2 %1, $22;" \ + "ctc2 %2, $23" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + ) + +#define gte_SetFarColor( r0, r1, r2 ) __asm__ ( \ + "sll $12, %0, 4;" \ + "sll $13, %1, 4;" \ + "sll $14, %2, 4;" \ + "ctc2 $12, $21;" \ + "ctc2 $13, $22;" \ + "ctc2 $14, $23" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + : "$12", "$13", "$14" \ + ) + +#define gte_SetGeomOffset( r0, r1 ) __asm__ ( \ + "sll $12, %0, 16;" \ + "sll $13, %1, 16;" \ + "ctc2 $12, $24;" \ + "ctc2 $13, $25" \ + : : "r"(r0), "r"(r1) \ + : "$12", "$13" \ + ) + +#define gte_SetGeomScreen(r0) __asm__ ( \ + "ctc2 %0, $26" \ + : : "r"(r0) \ + ) + +#define gte_ldsvrtrow0(r0) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 4(%0);" \ + "ctc2 $12, $0;" \ + "ctc2 $13, $1" \ + : : "r"(r0) \ + : "$12", "$13" \ + ) + +#define gte_SetRotMatrix(r0) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 4(%0);" \ + "ctc2 $12, $0;" \ + "ctc2 $13, $1;" \ + "lw $12, 8(%0);" \ + "lw $13, 12(%0);" \ + "lw $14, 16(%0);" \ + "ctc2 $12, $2;" \ + "ctc2 $13, $3;" \ + "ctc2 $14, $4" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ldsvllrow0(r0) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 4(%0);" \ + "ctc2 $12, $8;" \ + "ctc2 $13, $9" \ + : : "r"(r0) \ + : "$12", "$13" \ + ) + +#define gte_SetLightMatrix(r0) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 4(%0);" \ + "ctc2 $12, $8;" \ + "ctc2 $13, $9;" \ + "lw $12, 8(%0);" \ + "lw $13, 12(%0);" \ + "lw $14, 16(%0);" \ + "ctc2 $12, $10;" \ + "ctc2 $13, $11;" \ + "ctc2 $14, $12" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ldsvlcrow0(r0) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 4(%0);" \ + "ctc2 $12, $16;" \ + "ctc2 $13, $17" \ + : : "r"(r0) \ + : "$12", "$13" \ + ) + +#define gte_SetColorMatrix(r0) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 4(%0);" \ + "ctc2 $12, $16;" \ + "ctc2 $13, $17;" \ + "lw $12, 8(%0);" \ + "lw $13, 12(%0);" \ + "lw $14, 16(%0);" \ + "ctc2 $12, $18;" \ + "ctc2 $13, $19;" \ + "ctc2 $14, $20" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_SetTransMatrix(r0) __asm__ ( \ + "lw $12, 20(%0);" \ + "lw $13, 24(%0);" \ + "ctc2 $12, $5;" \ + "lw $14, 28(%0);" \ + "ctc2 $13, $6;" \ + "ctc2 $14, $7" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ldtr( r0, r1, r2 ) __asm__ ( \ + "ctc2 %0, $5;" \ + "ctc2 %1, $6;" \ + "ctc2 %2, $7" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + ) + +#define gte_SetTransVector(r0) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 4(%0);" \ + "lw $14, 8(%0);" \ + "ctc2 $12, $5;" \ + "ctc2 $13, $6;" \ + "ctc2 $14, $7" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ld_intpol_uv0(r0) __asm__ ( \ + "lbu $12, 0(%0);" \ + "lbu $13, 1(%0);" \ + "ctc2 $12, $21;" \ + "ctc2 $13, $22" \ + : : "r"(r0) \ + : "$12", "$13" \ + ) + +#define gte_ld_intpol_uv1(r0) __asm__ ( \ + "lbu $12, 0(%0);" \ + "lbu $13, 1(%0);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10" \ + : : "r"(r0) \ + : "$12", "$13" \ + ) + +#define gte_ld_intpol_bv0(r0) __asm__ ( \ + "lbu $12, 0(%0);" \ + "lbu $13, 1(%0);" \ + "ctc2 $12, $21;" \ + "ctc2 $13, $22" \ + : : "r"(r0) \ + : "$12", "$13" \ + ) + +#define gte_ld_intpol_bv1(r0) __asm__ ( \ + "lbu $12, 0(%0);" \ + "lbu $13, 1(%0);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10" \ + : : "r"(r0) \ + : "$12", "$13" \ + ) + +#define gte_ld_intpol_sv0(r0) __asm__ ( \ + "lh $12, 0(%0);" \ + "lh $13, 2(%0);" \ + "lh $14, 4(%0);" \ + "ctc2 $12, $21;" \ + "ctc2 $13, $22;" \ + "ctc2 $14, $23" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ld_intpol_sv1(r0) __asm__ ( \ + "lh $12, 0(%0);" \ + "lh $13, 2(%0);" \ + "lh $14, 4(%0);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10;" \ + "mtc2 $14, $11" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ldfc(r0) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 4(%0);" \ + "lw $14, 8(%0);" \ + "ctc2 $12, $21;" \ + "ctc2 $13, $22;" \ + "ctc2 $14, $23" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ldopv2SV(r0) __asm__ ( \ + "lh $12, 0(%0);" \ + "lh $13, 2(%0);" \ + "lh $14, 4(%0);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10;" \ + "mtc2 $14, $11" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + +#define gte_ldopv1SV(r0) __asm__ ( \ + "lh $12, 0(%0);" \ + "lh $13, 2(%0);" \ + "ctc2 $12, $0;" \ + "lh $14, 4(%0);" \ + "ctc2 $13, $2;" \ + "ctc2 $14, $4" \ + : : "r"(r0) \ + : "$12", "$13", "$14" \ + ) + + + + + +#define gte_stsxy(r0) __asm__ ( \ + "swc2 $14, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy3( r0, r1, r2 ) __asm__ ( \ + "swc2 $12, 0(%0);" \ + "swc2 $13, 0(%1);" \ + "swc2 $14, 0(%2)" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + : "memory" \ + ) + +#define gte_stsxy3c(r0) __asm__ ( \ + "swc2 $12, 0(%0);" \ + "swc2 $13, 4(%0);" \ + "swc2 $14, 8(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy2(r0) __asm__ ( \ + "swc2 $14, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy1(r0) __asm__ ( \ + "swc2 $13, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy0(r0) __asm__ ( \ + "swc2 $12, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy01( r0, r1 ) __asm__ ( \ + "swc2 $12, 0(%0);" \ + "swc2 $13, 0(%1)" \ + : : "r"(r0), "r"(r1) \ + : "memory" \ + ) + +#define gte_stsxy01c(r0) __asm__ ( \ + "swc2 $12, 0(%0);" \ + "swc2 $13, 4(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy3_f3(r0) __asm__ ( \ + "swc2 $12, 8(%0);" \ + "swc2 $13, 12(%0);" \ + "swc2 $14, 16(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy3_g3(r0) __asm__ ( \ + "swc2 $12, 8(%0);" \ + "swc2 $13, 16(%0);" \ + "swc2 $14, 24(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy3_ft3(r0) __asm__ ( \ + "swc2 $12, 8(%0);" \ + "swc2 $13, 16(%0);" \ + "swc2 $14, 24(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy3_gt3(r0) __asm__ ( \ + "swc2 $12, 8(%0);" \ + "swc2 $13, 20(%0);" \ + "swc2 $14, 32(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy3_f4(r0) __asm__ ( \ + "swc2 $12, 8(%0);" \ + "swc2 $13, 12(%0);" \ + "swc2 $14, 16(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy3_g4(r0) __asm__ ( \ + "swc2 $12, 8(%0);" \ + "swc2 $13, 16(%0);" \ + "swc2 $14, 24(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy3_ft4(r0) __asm__ ( \ + "swc2 $12, 8(%0);" \ + "swc2 $13, 16(%0);" \ + "swc2 $14, 24(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsxy3_gt4(r0) __asm__ ( \ + "swc2 $12, 8(%0);" \ + "swc2 $13, 20(%0);" \ + "swc2 $14, 32(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stdp(r0) __asm__ ( \ + "swc2 $8, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stflg(r0) __asm__ ( \ + "cfc2 $12, $31;" \ + "nop;" \ + "sw $12, 0(%0)" \ + : : "r"(r0) \ + : "$12", "memory" \ + ) + +#define gte_stflg_4(r0) __asm__ ( \ + "cfc2 $12, $31;" \ + "addi $13, $0, 4;" \ + "sll $13, $13, 16;" \ + "and $12, $12, $13;" \ + "sw $12, 0(%0)" \ + : : "r"(r0) \ + : "$12", "$13", "memory" \ + ) + +#define gte_stsz(r0) __asm__ ( \ + "swc2 $19, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsz3( r0, r1, r2 ) __asm__ ( \ + "swc2 $17, 0(%0);" \ + "swc2 $18, 0(%1);" \ + "swc2 $19, 0(%2)" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + : "memory" \ + ) + +#define gte_stsz4( r0, r1, r2, r3 ) __asm__ ( \ + "swc2 $16, 0(%0);" \ + "swc2 $17, 0(%1);" \ + "swc2 $18, 0(%2);" \ + "swc2 $19, 0(%3)" \ + : : "r"(r0), "r"(r1), "r"(r2), "r"(r3) \ + : "memory" \ + ) + +#define gte_stsz3c(r0) __asm__ ( \ + "swc2 $17, 0(%0);" \ + "swc2 $18, 4(%0);" \ + "swc2 $19, 8(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsz4c(r0) __asm__ ( \ + "swc2 $16, 0(%0);" \ + "swc2 $17, 4(%0);" \ + "swc2 $18, 8(%0);" \ + "swc2 $19, 12(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stszotz(r0) __asm__ ( \ + "mfc2 $12, $19;" \ + "nop;" \ + "sra $12, $12, 2;" \ + "sw $12, 0(%0)" \ + : : "r"(r0) \ + : "$12", "memory" \ + ) + +#define gte_stotz(r0) __asm__ ( \ + "swc2 $7, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stopz(r0) __asm__ ( \ + "swc2 $24, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stlvl(r0) __asm__ ( \ + "swc2 $9, 0(%0);" \ + "swc2 $10, 4(%0);" \ + "swc2 $11, 8(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stlvnl(r0) __asm__ ( \ + "swc2 $25, 0(%0);" \ + "swc2 $26, 4(%0);" \ + "swc2 $27, 8(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stlvnl0(r0) __asm__ ( \ + "swc2 $25, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stlvnl1(r0) __asm__ ( \ + "swc2 $26, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stlvnl2(r0) __asm__ ( \ + "swc2 $27, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stsv(r0) __asm__ ( \ + "mfc2 $12, $9;" \ + "mfc2 $13, $10;" \ + "mfc2 $14, $11;" \ + "sh $12, 0(%0);" \ + "sh $13, 2(%0);" \ + "sh $14, 4(%0)" \ + : : "r"(r0) \ + : "$12", "$13", "$14", "memory" \ + ) + +#define gte_stclmv(r0) __asm__ ( \ + "mfc2 $12, $9;" \ + "mfc2 $13, $10;" \ + "mfc2 $14, $11;" \ + "sh $12, 0(%0);" \ + "sh $13, 6(%0);" \ + "sh $14, 12(%0)" \ + : : "r"(r0) \ + : "$12", "$13", "$14", "memory" \ + ) + +#define gte_stbv(r0) __asm__ ( \ + "mfc2 $12, $9;" \ + "mfc2 $13, $10;" \ + "sb $12, 0(%0);" \ + "sb $13, 1(%0)" \ + : : "r"(r0) \ + : "$12", "$13", "memory" \ + ) + +#define gte_stcv(r0) __asm__ ( \ + "mfc2 $12, $9;" \ + "mfc2 $13, $10;" \ + "mfc2 $14, $11;" \ + "sb $12, 0(%0);" \ + "sb $13, 1(%0);" \ + "sb $14, 2(%0)" \ + : : "r"(r0) \ + : "$12", "$13", "$14", "memory" \ + ) + +#define gte_strgb(r0) __asm__ ( \ + "swc2 $22, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_strgb3( r0, r1, r2 ) __asm__ ( \ + "swc2 $20, 0(%0);" \ + "swc2 $21, 0(%1);" \ + "swc2 $22, 0(%2)" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + : "memory" \ + ) + +#define gte_strgb3_g3(r0) __asm__ ( \ + "swc2 $20, 4(%0);" \ + "swc2 $21, 12(%0);" \ + "swc2 $22, 20(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_strgb3_gt3(r0) __asm__ ( \ + "swc2 $20, 4(%0);" \ + "swc2 $21, 16(%0);" \ + "swc2 $22, 28(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_strgb3_g4(r0) __asm__ ( \ + "swc2 $20, 4(%0);" \ + "swc2 $21, 12(%0);" \ + "swc2 $22, 20(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_strgb3_gt4(r0) __asm__ ( \ + "swc2 $20, 4(%0);" \ + "swc2 $21, 16(%0);" \ + "swc2 $22, 28(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_ReadGeomOffset( r0, r1 ) __asm__ ( \ + "cfc2 $12, $24;" \ + "cfc2 $13, $25;" \ + "sra $12, $12, 16;" \ + "sra $13, $13, 16;" \ + "sw $12, 0(%0);" \ + "sw $13, 0(%1)" \ + : : "r"(r0), "r"(r1) \ + : "$12", "$13", "memory" \ + ) + +#define gte_ReadGeomScreen(r0) __asm__ ( \ + "cfc2 $12, $26;" \ + "nop;" \ + "sw $12, 0(%0)" \ + : : "r"(r0) \ + : "$12", "memory" \ + ) + +#define gte_ReadRotMatrix(r0) __asm__ ( \ + "cfc2 $12, $0;" \ + "cfc2 $13, $1;" \ + "sw $12, 0(%0);" \ + "sw $13, 4(%0);" \ + "cfc2 $12, $2;" \ + "cfc2 $13, $3;" \ + "cfc2 $14, $4;" \ + "sw $12, 8(%0);" \ + "sw $13, 12(%0);" \ + "sw $14, 16(%0);" \ + "cfc2 $12, $5;" \ + "cfc2 $13, $6;" \ + "cfc2 $14, $7;" \ + "sw $12, 20(%0);" \ + "sw $13, 24(%0);" \ + "sw $14, 28(%0)" \ + : : "r"(r0) \ + : "$12", "$13", "$14", "memory" \ + ) + +#define gte_sttr(r0) __asm__ ( \ + "cfc2 $12, $5;" \ + "cfc2 $13, $6;" \ + "cfc2 $14, $7;" \ + "sw $12, 0(%0);" \ + "sw $13, 4(%0);" \ + "sw $14, 8(%0)" \ + : : "r"(r0) \ + : "$12", "$13", "$14", "memory" \ + ) + +#define gte_ReadLightMatrix(r0) __asm__ ( \ + "cfc2 $12, $8;" \ + "cfc2 $13, $9;" \ + "sw $12, 0(%0);" \ + "sw $13, 4(%0);" \ + "cfc2 $12, $10;" \ + "cfc2 $13, $11;" \ + "cfc2 $14, $12;" \ + "sw $12, 8(%0);" \ + "sw $13, 12(%0);" \ + "sw $14, 16(%0);" \ + "cfc2 $12, $13;" \ + "cfc2 $13, $14;" \ + "cfc2 $14, $15;" \ + "sw $12, 20(%0);" \ + "sw $13, 24(%0);" \ + "sw $14, 28(%0)" \ + : : "r"(r0) \ + : "$12", "$13", "$14", "memory" \ + ) + +#define gte_ReadColorMatrix(r0) __asm__ ( \ + "cfc2 $12, $16;" \ + "cfc2 $13, $17;" \ + "sw $12, 0(%0);" \ + "sw $13, 4(%0);" \ + "cfc2 $12, $18;" \ + "cfc2 $13, $19;" \ + "cfc2 $14, $20;" \ + "sw $12, 8(%0);" \ + "sw $13, 12(%0);" \ + "sw $14, 16(%0);" \ + "cfc2 $12, $21;" \ + "cfc2 $13, $22;" \ + "cfc2 $14, $23;" \ + "sw $12, 20(%0);" \ + "sw $13, 24(%0);" \ + "sw $14, 28(%0)" \ + : : "r"(r0) \ + : "$12", "$13", "$14", "memory" \ + ) + +#define gte_stlzc(r0) __asm__ ( \ + "swc2 $31, 0(%0)" \ + : : "r"(r0) \ + : "memory" \ + ) + +#define gte_stfc(r0) __asm__ ( \ + "cfc2 $12, $21;" \ + "cfc2 $13, $22;" \ + "cfc2 $14, $23;" \ + "sw $12, 0(%0);" \ + "sw $13, 4(%0);" \ + "sw $14, 8(%0)" \ + : : "r"(r0) \ + : "$12", "$13", "$14", "memory" \ + ) + +#define gte_mvlvtr() __asm__ ( \ + "mfc2 $12, $25;" \ + "mfc2 $13, $26;" \ + "mfc2 $14, $27;" \ + "ctc2 $12, $5;" \ + "ctc2 $13, $6;" \ + "ctc2 $14, $7" \ + : : \ + : "$12", "$13", "$14" \ + ) + +#define gte_nop() __asm__ ( \ + "nop" \ + ) + +#define gte_subdvl( r0, r1, r2 ) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 0(%1);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10;" \ + "sra $12, $12, 16;" \ + "sra $13, $13, 16;" \ + "subu $15, $12, $13;" \ + "mfc2 $12, $9;" \ + "mfc2 $13, $10;" \ + "sw $15, 4(%2);" \ + "subu $12, $12, $13;" \ + "sw $12, 0(%2)" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + : "$12", "$13", "$14", "$15", "memory" \ + ) + +#define gte_subdvd( r0, r1, r2 ) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 0(%1);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10;" \ + "sra $12, $12, 16;" \ + "sra $13, $13, 16;" \ + "subu $15, $12, $13;" \ + "mfc2 $12, $9;" \ + "mfc2 $13, $10;" \ + "sh $15, 2(%2);" \ + "subu $12, $12, $13;" \ + "sh $12, 0(%2)" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + : "$12", "$13", "$14", "$15", "memory" \ + ) + +#define gte_adddvl( r0, r1, r2 ) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 0(%1);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10;" \ + "sra $12, $12, 16;" \ + "sra $13, $13, 16;" \ + "addu $15, $12, $13;" \ + "mfc2 $12, $9;" \ + "mfc2 $13, $10;" \ + "sw $15, 4(%2);" \ + "addu $12, $12, $13;" \ + "sw $12, 0(%2)" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + : "$12", "$13", "$14", "$15", "memory" \ + ) + +#define gte_adddvd( r0, r1, r2 ) __asm__ ( \ + "lw $12, 0(%0);" \ + "lw $13, 0(%1);" \ + "mtc2 $12, $9;" \ + "mtc2 $13, $10;" \ + "sra $12, $12, 16;" \ + "sra $13, $13, 16;" \ + "addu $15, $12, $13;" \ + "mfc2 $12, $9;" \ + "mfc2 $13, $10;" \ + "sh $15, 2(%2);" \ + "addu $12, $12, $13;" \ + "sh $12, 0(%2)" \ + : : "r"(r0), "r"(r1), "r"(r2) \ + : "$12", "$13", "$14", "$15", "memory" \ + ) + +#define gte_FlipRotMatrixX() __asm__ ( \ + "cfc2 $12, $0;" \ + "cfc2 $13, $1;" \ + "sll $14, $12, 16;" \ + "sra $14, $14, 16;" \ + "subu $14, $0, $14;" \ + "sra $15, $12, 16;" \ + "subu $15, $0, $15;" \ + "sll $15, $15, 16;" \ + "sll $14, $14, 16;" \ + "srl $14, $14, 16;" \ + "or $14, $14, $15;" \ + "ctc2 $14, $0;" \ + "sll $14, $13, 16;" \ + "sra $14, $14, 16;" \ + "subu $14, $0, $14;" \ + "sra $15, $13, 16;" \ + "sll $15, $15, 16;" \ + "sll $14, $14, 16;" \ + "srl $14, $14, 16;" \ + "or $14, $14, $15;" \ + "ctc2 $14, $1" \ + : : \ + : "$12", "$13", "$14", "$15" \ + ) + +#define gte_FlipTRX() __asm__ ( \ + "cfc2 $12, $5;" \ + "nop;" \ + "subu $12, $0, $12;" \ + "ctc2 $12, $5" \ + : : \ + : "$12" \ + ) diff --git a/docs/r3000gte/gte_macros_volatile.h b/docs/r3000gte/gte_macros_volatile.h index 1b99dde..8ac1987 100644 --- a/docs/r3000gte/gte_macros_volatile.h +++ b/docs/r3000gte/gte_macros_volatile.h @@ -497,3 +497,858 @@ #define gte_ngpl0() gte_nGPL(0) #define gte_gpl0() gte_GPL(0) + + +/** + * Memory and register management + */ + +#define gte_ldv0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $0,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $1,4($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldv1(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $2,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $3,4($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldv2(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $4,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $5,4($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldv3(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $0,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $1,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $2,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $3,4($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $4,($14)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $5,4($14)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldv3c(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $0,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $1,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $2,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $3,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $4,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $5,20($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldv3c_vertc(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $0,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $1,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $2,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $3,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $4,24($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $5,28($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldv01(r1,r2) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $0,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $1,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $2,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $3,4($13)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldv01c(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $0,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $1,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $2,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $3,12($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldrgb(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $6,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldrgb3(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $20,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $21,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $22,($14)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $6,($14)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldrgb3c(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $20,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $21,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $22,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $6,8($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldlv0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lhu $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lhu $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $14,$14,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("or $13,$13,$14": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$0": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $1,8($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldlvl(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $9,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $10,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $11,8($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsv(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lhu $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lhu $14,2($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lhu $15,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $15,$11": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldbv(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $14,1($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldcv(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $14,1($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $15,2($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $15,$11": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldclmv(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lhu $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lhu $14,6($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lhu $15,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $15,$11": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_lddp(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$8": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsxy0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$12": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsxy1(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$13": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsxy2(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$14": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsxy3(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$12": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $14,$14": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$13": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsxy3c(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $12,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $13,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $14,8($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsz3(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$17": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$18": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $14,$19": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsz4(r1,r2,r3,r4) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $15,%0": :"r"(r4):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$17": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $14,$18": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $15,$19": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldopv1(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$0": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $15,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$2": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $15,$4": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldopv2(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $11,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $9,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $10,4($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldlzc(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$30": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_SetRGBcd(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lwc2 $6,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldbkdir(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $12,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$14": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$15": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_SetBackColor(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $12,$12,4": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $13,$13,4": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $14,$14,4": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $12,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$14": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$15": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldfcdir(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $12,$21": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$22": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$23": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_SetFarColor(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $12,$12,4": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $13,$13,4": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $14,$14,4": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $12,$21": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$22": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$23": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_SetGeomOffset(r1,r2) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $12,$12,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $13,$13,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $12,$24": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$25": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_SetGeomScreen(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $12,$26": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsvrtrow0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$0": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$1": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_SetRotMatrix(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$0": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$1": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $15,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$2": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$3": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $15,$4": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsvllrow0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$8": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$9": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_SetLightMatrix(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$8": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $15,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$11": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $15,$12": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldsvlcrow0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$17": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_SetColorMatrix(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$17": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $15,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$18": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$19": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $15,$20": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_SetTransMatrix(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,20($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,24($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$5": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $15,28($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$6": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $15,$7": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldtr(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $12,$5": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$6": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$7": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_SetTransVector(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $15,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$5": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$6": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $15,$7": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ld_intpol_uv0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $14,1($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$21": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$22": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ld_intpol_uv1(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $14,1($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ld_intpol_bv0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $14,1($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$21": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$22": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ld_intpol_bv1(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lbu $14,1($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ld_intpol_sv0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lh $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lh $14,2($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lh $15,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$21": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$22": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $15,$23": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ld_intpol_sv1(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lh $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lh $14,2($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lh $15,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $15,$11": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ldfc(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $15,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$21": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$22": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $15,$23": : :"$12","$13","$14","$15","memory"); \ +} + + + + + +#define gte_stsxy(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy3(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,($14)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy3c(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,8($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy2(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy1(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy01(r1,r2) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,($13)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy01c(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,4($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy3_f3(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,16($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy3_g3(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,24($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy3_ft3(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,24($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy3_gt3(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,20($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,32($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy3_f4(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,16($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy3_g4(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,24($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy3_ft4(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,24($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsxy3_gt4(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $12,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $13,20($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $14,32($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stdp(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $8,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stflg(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$31": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stflg_4(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$31": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("addi $14,$0,4": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $14,$14,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("and $13,$13,$14": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsz(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $19,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsz3(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $17,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $18,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $19,($14)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsz4(r1,r2,r3,r4) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $15,%0": :"r"(r4):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $16,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $17,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $18,($14)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $19,($15)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsz3c(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $17,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $18,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $19,8($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsz4c(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $16,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $17,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $18,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $19,12($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stszotz(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $13,$19": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $13,$13,2": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stotz(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $7,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stopz(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $24,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stlvl(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $9,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $10,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $11,8($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stlvnl(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $25,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $26,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $27,8($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stlvnl0(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $25,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stlvnl1(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $26,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stlvnl2(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $27,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stsv(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $15,$11": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sh $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sh $14,2($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sh $15,4($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stclmv(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $15,$11": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sh $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sh $14,6($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sh $15,12($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stbv(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sb $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sb $14,1($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stcv(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $13,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $14,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $15,$11": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sb $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sb $14,1($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sb $15,2($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_strgb(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $22,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_strgb3(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $20,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $21,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $22,($14)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_strgb3_g3(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $20,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $21,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $22,20($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_strgb3_gt3(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $20,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $21,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $22,28($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_strgb3_g4(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $20,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $21,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $22,20($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_strgb3_gt4(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $20,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $21,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $22,28($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ReadGeomOffset(r1,r2) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$24": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $15,$25": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $14,$14,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $15,$15,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,($13)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ReadGeomScreen(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$26": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ReadRotMatrix(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$0": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$1": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$2": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$3": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $15,$4": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$5": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$6": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $15,$7": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,20($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,24($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,28($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_sttr(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$5": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$6": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $15,$7": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,8($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ReadLightMatrix(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$8": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$11": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $15,$12": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$14": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $15,$15": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,20($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,24($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,28($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_ReadColorMatrix(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$17": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$18": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$19": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $15,$20": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,8($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,12($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,16($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$21": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$22": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $15,$23": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,20($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,24($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,28($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stlzc(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("swc2 $31,($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_stfc(r1) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$21": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $14,$22": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $15,$23": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $13,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $14,4($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,8($12)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_mvlvtr() { \ + __asm__ volatile ("mfc2 $12,$25": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $13,$26": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $14,$27": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $12,$5": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $13,$6": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$7": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_nop() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_subdvl(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $12,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $12,$12,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $13,$13,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("subu $15,$12,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $12,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $13,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,4($14)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("subu $12,$12,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $12,($14)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_subdvd(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $12,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $12,$12,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $13,$13,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("subu $15,$12,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $12,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $13,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sh $15,2($14)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("subu $12,$12,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sh $12,($14)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_adddvl(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $12,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $12,$12,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $13,$13,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("addu $15,$12,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $12,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $13,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $15,4($14)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("addu $12,$12,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sw $12,($14)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_adddvd(r1,r2,r3) { \ + __asm__ volatile ("move $12,%0": :"r"(r1):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $13,%0": :"r"(r2):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("move $14,%0": :"r"(r3):"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $12,($12)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("lw $13,($13)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $12,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mtc2 $13,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $12,$12,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $13,$13,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("addu $15,$12,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $12,$9": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("mfc2 $13,$10": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sh $15,2($14)": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("addu $12,$12,$13": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sh $12,($14)": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_FlipRotMatrixX() { \ + __asm__ volatile ("cfc2 $12,$0": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("cfc2 $13,$1": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $14,$12,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $14,$14,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("subu $14,$0,$14": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $15,$12,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("subu $15,$0,$15": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $15,$15,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $14,$14,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("srl $14,$14,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("or $14,$14,$15": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$0": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $14,$13,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $14,$14,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("subu $14,$0,$14": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sra $15,$13,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $15,$15,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("sll $14,$14,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("srl $14,$14,16": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("or $14,$14,$15": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $14,$1": : :"$12","$13","$14","$15","memory"); \ +} +#define gte_FlipTRX() { \ + __asm__ volatile ("cfc2 $12,$5": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("subu $12,$0,$12": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("ctc2 $12,$5": : :"$12","$13","$14","$15","memory"); \ +}