diff --git a/Cargo.toml b/Cargo.toml index ddd41590..b65f0708 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "rabbitizer" # Version should be synced with include/common/RabbitizerVersion.h -version = "1.7.3" +version = "1.7.4" edition = "2021" authors = ["Anghelo Carvajal "] description = "MIPS instruction decoder" diff --git a/docs/r3000gte/gte_macros.h b/docs/r3000gte/gte_macros.h new file mode 100644 index 00000000..c16cfbe0 --- /dev/null +++ b/docs/r3000gte/gte_macros.h @@ -0,0 +1,1533 @@ +/** + * GTE macros + * This file is meant to be used as an alternative to DMPSX + */ + + +/* RTPS 15 0x4A180001 Perspective transform */ +#define gte_nRTPS() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4A180001" \ + ) + +#define gte_RTPS() __asm__ ( \ + ".word 0x4A180001" \ + ) + +/* RTPT 23 0x4A280030 Perspective transform on 3 points */ +#define gte_nRTPT() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4A280030" \ + ) + +#define gte_RTPT() __asm__ ( \ + ".word 0x4A280030" \ + ) + +/* DPCL 8 0x4A680029 Depth Cue Color light */ +#define gte_nDPCL() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4A680029" \ + ) + +#define gte_DPCL() __asm__ ( \ + ".word 0x4A680029" \ + ) + +/* DPCS 8 0x4A780010 Depth Cueing */ +#define gte_nDPCS() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4A780010" \ + ) + +#define gte_DPCS() __asm__ ( \ + ".word 0x4A780010" \ + ) + +/* DPCT 17 0x4AF8002A Depth cue color RGB0,RGB1,RGB2 */ +#define gte_nDPCT() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4AF8002A" \ + ) + +#define gte_DPCT() __asm__ ( \ + ".word 0x4AF8002A" \ + ) + +/* INTPL 8 0x4A980011 Interpolation of vector and far color */ +#define gte_nINTPL() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4A980011" \ + ) + +#define gte_INTPL() __asm__ ( \ + ".word 0x4A980011" \ + ) + +/* NCS 14 0x4AC8041E Normal color v0 */ +#define gte_nNCS() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4AC8041E" \ + ) + +#define gte_NCS() __asm__ ( \ + ".word 0x4AC8041E" \ + ) + +/* NCT 30 0x4AD80420 Normal color v0, v1, v2 */ +#define gte_nNCT() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4AD80420" \ + ) + +#define gte_NCT() __asm__ ( \ + ".word 0x4AD80420" \ + ) + +/* NCDS 19 0x4AE80413 Normal color depth cuev0 */ +#define gte_nNCDS() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4AE80413" \ + ) + +#define gte_NCDS() __asm__ ( \ + ".word 0x4AE80413" \ + ) + +/* NCDT 44 0x4AF80416 Normal color depth cue v0, v1, v2 */ +#define gte_nNCDT() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4AF80416" \ + ) + +#define gte_NCDT() __asm__ ( \ + ".word 0x4AF80416" \ + ) + +/* NCCS 17 0x4B08041B Normal color col. v0 */ +#define gte_nNCCS() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4B08041B" \ + ) + +#define gte_NCCS() __asm__ ( \ + ".word 0x4B08041B" \ + ) + +/* NCCT 39 0x4B18043F Normal color col.v0, v1, v2 */ +#define gte_nNCCT() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4B18043F" \ + ) + +#define gte_NCCT() __asm__ ( \ + ".word 0x4B18043F" \ + ) + +/* CDP 13 0x4B280414 Color Depth Queue */ +#define gte_nCDP() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4B280414" \ + ) + +#define gte_CDP() __asm__ ( \ + ".word 0x4B280414" \ + ) + +/* CC 11 0x4B38041C Color Col. */ +#define gte_CC() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4B38041C" \ + ) + +#define gte_CC() __asm__ ( \ + ".word 0x4B38041C" \ + ) + +/* NCLIP 8 0x4B400006 Normal clipping */ +#define gte_nNCLIP() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4B400006" \ + ) + +#define gte_NCLIP() __asm__ ( \ + ".word 0x4B400006" \ + ) + +/* AVSZ3 5 0x4B58002D Average of three Z values */ +#define gte_nAVSZ3() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4B58002D" \ + ) + +#define gte_AVSZ3() __asm__ ( \ + ".word 0x4B58002D" \ + ) + +/* AVSZ4 6 0x4B68002E Average of four Z values */ +#define gte_nAVSZ4() __asm__ ( \ + "nop;" \ + "nop;" \ + ".word 0x4B68002E" \ + ) + +#define gte_AVSZ4() __asm__ ( \ + ".word 0x4B68002E" \ + ) + +/** + * Instructions which take an argument + * + * sf : arg is 1 bit wide + * mx : arg is 2 bit wide + * v : arg is 2 bit wide + * cv : arg is 2 bit wide + * lm : arg is 1 bit wide + */ + +/* MVMVA 8 0x4A400012 Multiply vector by matrix and vector addition. */ +#define gte_nMVMVA(sf, mx, v, cv, lm) __asm__ ( \ + "nop;" \ + "nop;" \ + ".word %0" \ + : : "g"(0x4A400012 | ((sf) & 0x1) << 19 | ((mx) & 0x3) << 17 | ((v) & 0x3) << 15 | ((cv) & 0x3) << 13 | ((lm) & 0x1) << 10) \ + ) + +#define gte_MVMVA(sf, mx, v, cv, lm) __asm__ ( \ + ".word %0" \ + : : "g"(0x4A400012 | ((sf) & 0x1) << 19 | ((mx) & 0x3) << 17 | ((v) & 0x3) << 15 | ((cv) & 0x3) << 13 | ((lm) & 0x1) << 10) \ + ) + +/* SQR 5 0x4AA00428 Square of vector */ +#define gte_nSQR(sf) __asm__ ( \ + "nop;" \ + "nop;" \ + ".word %0" \ + : : "g"(0x4AA00428 | ((sf) & 0x1) << 19) \ + ) + +#define gte_SQR(sf) __asm__ ( \ + ".word %0" \ + : : "g"(0x4AA00428 | ((sf) & 0x1) << 19) \ + ) + +/* OP 6 0x4B70000C Outer Product */ +#define gte_nOP(sf) __asm__ ( \ + "nop;" \ + "nop;" \ + ".word %0" \ + : : "g"(0x4B70000C | ((sf) & 0x1) << 19) \ + ) + +#define gte_OP(sf) __asm__ ( \ + ".word %0" \ + : : "g"(0x4B70000C | ((sf) & 0x1) << 19) \ + ) + +/* GPF 6 0x4B90003D General purpose interpolation */ +#define gte_nGPF(sf) __asm__ ( \ + "nop;" \ + "nop;" \ + ".word %0" \ + : : "g"(0x4B90003D | ((sf) & 0x1) << 19) \ + ) + +#define gte_GPF(sf) __asm__ ( \ + ".word %0" \ + : : "g"(0x4B90003D | ((sf) & 0x1) << 19) \ + ) + +/* GPL 5 0x4BA0003E general purpose interpolation */ +#define gte_nGPL(sf) __asm__ ( \ + "nop;" \ + "nop;" \ + ".word %0" \ + : : "g"(0x4BA0003E | ((sf) & 0x1) << 19) \ + ) + +#define gte_GPL(sf) __asm__ ( \ + ".word %0" \ + : : "g"(0x4BA0003E | ((sf) & 0x1) << 19) \ + ) + + +/** + * Convenience macros + */ + +/* rtv0 - 0x4A486012 v0 * rotmatrix */ +#define gte_nrtv0() gte_nMVMVA(1, 0, 0, 3, 0) + +#define gte_rtv0() gte_MVMVA(1, 0, 0, 3, 0) + +/* rtv1 - 0x4A48E012 v1 * rotmatrix */ +#define gte_nrtv1() gte_nMVMVA(1, 0, 1, 3, 0) + +#define gte_rtv1() gte_MVMVA(1, 0, 1, 3, 0) + +/* rtv2 - 0x4A496012 v2 * rotmatrix */ +#define gte_nrtv2() gte_nMVMVA(1, 0, 2, 3, 0) + +#define gte_rtv2() gte_MVMVA(1, 0, 2, 3, 0) + +/* rtir12 - 0x4A49E012 ir * rotmatrix */ +#define gte_nrtir12() gte_nMVMVA(1, 0, 3, 3, 0) + +#define gte_rtir12() gte_MVMVA(1, 0, 3, 3, 0) + +/* rtir0 - 0x4A41E012 ir * rotmatrix */ +#define gte_nrtir0() gte_nMVMVA(0, 0, 3, 3, 0) + +#define gte_rtir0() gte_MVMVA(0, 0, 3, 3, 0) + +/* rtv0tr - 0x4A480012 v0 * rotmatrix + tr vector */ +#define gte_nrtv0tr() gte_nMVMVA(1, 0, 0, 0, 0) + +#define gte_rtv0tr() gte_MVMVA(1, 0, 0, 0, 0) + +/* rtv1tr - 0x4A488012 v1 * rotmatrix + tr vector */ +#define gte_nrtv1tr() gte_nMVMVA(1, 0, 1, 0, 0) + +#define gte_rtv1tr() gte_MVMVA(1, 0, 1, 0, 0) + +/* rtv2tr - 0x4A490012 v2 * rotmatrix + tr vector */ +#define gte_nrtv2tr() gte_nMVMVA(1, 0, 2, 0, 0) + +#define gte_rtv2tr() gte_MVMVA(1, 0, 2, 0, 0) + +/* rtirtr - 0x4A498012 ir * rotmatrix + tr vector */ +#define gte_nrtirtr() gte_nMVMVA(1, 0, 3, 0, 0) + +#define gte_rtirtr() gte_MVMVA(1, 0, 3, 0, 0) + +/* rtv0bk - 0x4A482012 v0 * rotmatrix + bk vector */ +#define gte_nrtv0bk() gte_nMVMVA(1, 0, 0, 1, 0) + +#define gte_rtv0bk() gte_MVMVA(1, 0, 0, 1, 0) + +/* rtv1bk - 0x4A48A012 v1 * rotmatrix + bk vector */ +#define gte_nrtv1bk() gte_nMVMVA(1, 0, 1, 1, 0) + +#define gte_rtv1bk() gte_MVMVA(1, 0, 1, 1, 0) + +/* rtv2bk - 0x4A492012 v2 * rotmatrix + bk vector */ +#define gte_nrtv2bk() gte_nMVMVA(1, 0, 2, 1, 0) + +#define gte_rtv2bk() gte_MVMVA(1, 0, 2, 1, 0) + +/* rtirbk - 0x4A49A012 ir * rotmatrix + bk vector */ +#define gte_nrtirbk() gte_nMVMVA(1, 0, 3, 1, 0) + +#define gte_rtirbk() gte_MVMVA(1, 0, 3, 1, 0) + +/* ll - 0x4A4A6412 v0 * light matrix. Lower limit result to 0 */ +#define gte_nll() gte_nMVMVA(1, 1, 0, 3, 1) + +#define gte_ll() gte_MVMVA(1, 1, 0, 3, 1) + +/* llv0 - 0x4A4A6012 v0 * light matrix */ +#define gte_nllv0() gte_nMVMVA(1, 1, 0, 3, 0) + +#define gte_llv0() gte_MVMVA(1, 1, 0, 3, 0) + +/* llv1 - 0x4A4AE012 v1 * light matrix */ +#define gte_nllv1() gte_nMVMVA(1, 1, 1, 3, 0) + +#define gte_llv1() gte_MVMVA(1, 1, 1, 3, 0) + +/* llv2 - 0x4A4B6012 v2 * light matrix */ +#define gte_nllv2() gte_nMVMVA(1, 1, 2, 3, 0) + +#define gte_llv2() gte_MVMVA(1, 1, 2, 3, 0) + +/* llvir - 0x4A4BE012 ir * light matrix */ +#define gte_nllvir() gte_nMVMVA(1, 1, 3, 3, 0) + +#define gte_llvir() gte_MVMVA(1, 1, 3, 3, 0) + +/* llv0tr - 0x4A4A0012 v0 * light matrix + tr vector */ +#define gte_nllv0tr() gte_nMVMVA(1, 1, 0, 0, 0) + +#define gte_llv0tr() gte_MVMVA(1, 1, 0, 0, 0) + +/* llv1tr - 0x4A4A8012 v1 * light matrix + tr vector */ +#define gte_nllv1tr() gte_nMVMVA(1, 1, 1, 0, 0) + +#define gte_llv1tr() gte_MVMVA(1, 1, 1, 0, 0) + +/* llv2tr - 0x4A4B0012 v2 * light matrix + tr vector */ +#define gte_nllv2tr() gte_nMVMVA(1, 1, 2, 0, 0) + +#define gte_llv2tr() gte_MVMVA(1, 1, 2, 0, 0) + +/* llirtr - 0x4A4B8012 ir * light matrix + tr vector */ +#define gte_nllirtr() gte_nMVMVA(1, 1, 3, 0, 0) + +#define gte_llirtr() gte_MVMVA(1, 1, 3, 0, 0) + +/* llv0bk - 0x4A4A2012 v0 * light matrix + bk vector */ +#define gte_nllv0bk() gte_nMVMVA(1, 1, 0, 1, 0) + +#define gte_llv0bk() gte_MVMVA(1, 1, 0, 1, 0) + +/* llv1bk - 0x4A4AA012 v1 * light matrix + bk vector */ +#define gte_nllv1bk() gte_nMVMVA(1, 1, 1, 1, 0) + +#define gte_llv1bk() gte_MVMVA(1, 1, 1, 1, 0) + +/* llv2bk - 0x4A4B2012 v2 * light matrix + bk vector */ +#define gte_nllv2bk() gte_nMVMVA(1, 1, 2, 1, 0) + +#define gte_llv2bk() gte_MVMVA(1, 1, 2, 1, 0) + +/* llirbk - 0x4A4BA012 ir * light matrix + bk vector */ +#define gte_nllirbk() gte_nMVMVA(1, 1, 3, 1, 0) + +#define gte_llirbk() gte_MVMVA(1, 1, 3, 1, 0) + +/* lc - 0x4A4DA412 v0 * color matrix, Lower limit clamped to 0 */ +#define gte_nlc() gte_nMVMVA(1, 2, 3, 1, 1) + +#define gte_lc() gte_MVMVA(1, 2, 3, 1, 1) + +/* lcv0 - 0x4A4C6012 v0 * color matrix */ +#define gte_nlcv0() gte_nMVMVA(1, 2, 0, 3, 0) + +#define gte_lcv0() gte_MVMVA(1, 2, 0, 3, 0) + +/* lcv1 - 0x4A4CE012 v1 * color matrix */ +#define gte_nlcv1() gte_nMVMVA(1, 2, 1, 3, 0) + +#define gte_lcv1() gte_MVMVA(1, 2, 1, 3, 0) + +/* lcv2 - 0x4A4D6012 v2 * color matrix */ +#define gte_nlcv2() gte_nMVMVA(1, 2, 2, 3, 0) + +#define gte_lcv2() gte_MVMVA(1, 2, 2, 3, 0) + +/* lcvir - 0x4A4DE012 ir * color matrix */ +#define gte_nlcvir() gte_nMVMVA(1, 2, 3, 3, 0) + +#define gte_lcvir() gte_MVMVA(1, 2, 3, 3, 0) + +/* lcv0tr - 0x4A4C0012 v0 * color matrix + tr vector */ +#define gte_nlcv0tr() gte_nMVMVA(1, 2, 0, 0, 0) + +#define gte_lcv0tr() gte_MVMVA(1, 2, 0, 0, 0) + +/* lcv1tr - 0x4A4C8012 v1 * color matrix + tr vector */ +#define gte_nlcv1tr() gte_nMVMVA(1, 2, 1, 0, 0) + +#define gte_lcv1tr() gte_MVMVA(1, 2, 1, 0, 0) + +/* lcv2tr - 0x4A4D0012 v2 * color matrix + tr vector */ +#define gte_nlcv2tr() gte_nMVMVA(1, 2, 2, 0, 0) + +#define gte_lcv2tr() gte_MVMVA(1, 2, 2, 0, 0) + +/* lcirtr - 0x4A4D8012 ir * color matrix + tr vector */ +#define gte_nlcirtr() gte_nMVMVA(1, 2, 3, 0, 0) + +#define gte_lcirtr() gte_MVMVA(1, 2, 3, 0, 0) + +/* lev0bk - 0x4A4C2012 v0 * color matrix + bk vector */ +#define gte_nlev0bk() gte_nMVMVA(1, 2, 0, 1, 0) + +#define gte_lev0bk() gte_MVMVA(1, 2, 0, 1, 0) + +/* lev1bk - 0x4A4CA012 v1 * color matrix + bk vector */ +#define gte_nlev1bk() gte_nMVMVA(1, 2, 1, 1, 0) + +#define gte_lev1bk() gte_MVMVA(1, 2, 1, 1, 0) + +/* lev2bk - 0x4A4D2012 v2 * color matrix + bk vector */ +#define gte_nlev2bk() gte_nMVMVA(1, 2, 2, 1, 0) + +#define gte_lev2bk() gte_MVMVA(1, 2, 2, 1, 0) + +/* leirbk - 0x4A4DA012 ir * color matrix + bk vector */ +#define gte_nleirbk() gte_nMVMVA(1, 2, 3, 1, 0) + +#define gte_leirbk() gte_MVMVA(1, 2, 3, 1, 0) + +/* sqr12 - 0x4AA80428 square of ir 1,19,12 */ +// #define gte_nsqr12() gte_nSQR(1) +// +// #define gte_sqr12() gte_SQR(1) + +/* sqr0 - 0x4AA80428 square of ir 1,31, 0 */ +// #define gte_nsqr0() gte_nSQR(1) +// +// #define gte_sqr0() gte_SQR(1) + +/* op12 - 0x4B78000C outer product 1,19,12 */ +#define gte_nop12() gte_nOP(1) + +#define gte_op12() gte_OP(1) + +/* op0 - 0x4B70000C outer product 1,31, 0 */ +#define gte_nop0() gte_nOP(0) + +#define gte_op0() gte_OP(0) + +/* gpf12 - 0x4B98003D general purpose interpolation 1,19,12 */ +#define gte_ngpf12() gte_nGPF(1) + +#define gte_gpf12() gte_GPF(1) + +/* gpf0 - 0x4B90003D general purpose interpolation 1,31, 0 */ +#define gte_ngpf0() gte_nGPF(0) + +#define gte_gpf0() gte_GPF(0) + +/* gpl12 - 0x4BA8003E general purpose interpolation 1,19,12 */ +#define gte_ngpl12() gte_nGPL(1) + +#define gte_gpl12() gte_GPL(1) + +/* gpl0 - 0x4BA0003E general purpose interpolation 1,31, 0 */ +#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/tests/asm/r3000gte/inline_gte_instr.inc.s b/docs/r3000gte/gte_macros.s similarity index 66% rename from tests/asm/r3000gte/inline_gte_instr.inc.s rename to docs/r3000gte/gte_macros.s index bc4c93bf..72df07fc 100644 --- a/tests/asm/r3000gte/inline_gte_instr.inc.s +++ b/docs/r3000gte/gte_macros.s @@ -1,424 +1,405 @@ +## GTE instructions macros +## This macros are meant to be used with GAS and avoid using DMPSX + +/* RTPS 15 0x4A180001 Perspective transform */ .macro RTPS .word 0x4A180001 .endm +/* RTPT 23 0x4A280030 Perspective transform on 3 points */ .macro RTPT .word 0x4A280030 .endm +/* DPCL 8 0x4A680029 Depth Cue Color light */ .macro DPCL .word 0x4A680029 .endm +/* DPCS 8 0x4A780010 Depth Cueing */ .macro DPCS .word 0x4A780010 .endm +/* DPCT 17 0x4AF8002A Depth cue color RGB0,RGB1,RGB2 */ .macro DPCT .word 0x4AF8002A .endm +/* INTPL 8 0x4A980011 Interpolation of vector and far color */ .macro INTPL .word 0x4A980011 .endm +/* NCS 14 0x4AC8041E Normal color v0 */ .macro NCS .word 0x4AC8041E .endm +/* NCT 30 0x4AD80420 Normal color v0, v1, v2 */ .macro NCT .word 0x4AD80420 .endm +/* NCDS 19 0x4AE80413 Normal color depth cuev0 */ .macro NCDS .word 0x4AE80413 .endm +/* NCDT 44 0x4AF80416 Normal color depth cue v0, v1, v2 */ .macro NCDT .word 0x4AF80416 .endm +/* NCCS 17 0x4B08041B Normal color col. v0 */ .macro NCCS .word 0x4B08041B .endm +/* NCCT 39 0x4B18043F Normal color col.v0, v1, v2 */ .macro NCCT .word 0x4B18043F .endm +/* CDP 13 0x4B280414 Color Depth Queue */ .macro CDP .word 0x4B280414 .endm +/* CC 11 0x4B38041C Color Col. */ .macro CC .word 0x4B38041C .endm +/* NCLIP 8 0x4B400006 Normal clipping */ .macro NCLIP .word 0x4B400006 .endm +/* AVSZ3 5 0x4B58002D Average of three Z values */ .macro AVSZ3 .word 0x4B58002D .endm +/* AVSZ4 6 0x4B68002E Average of four Z values */ .macro AVSZ4 .word 0x4B68002E .endm + +## Instructions which take an argument +# sf : arg is 1 bit wide +# mx : arg is 2 bit wide +# v : arg is 2 bit wide +# cv : arg is 2 bit wide +# lm : arg is 1 bit wide + +/* MVMVA 8 0x4A400012 Multiply vector by matrix and vector addition. */ .macro MVMVA sf, mx, v, cv, lm - .word 0x4A400012 + .word 0x4A400012 | (\sf & 0x1) << 19 | (\mx & 0x3) << 17 | (\v & 0x3) << 15 | (\cv & 0x3) << 13 | (\lm & 0x1) << 10 .endm +/* SQR 5 0x4AA00428 Square of vector */ .macro SQR sf - .word 0x4AA00428 + .word 0x4AA00428 | (\sf & 0x1) << 19 .endm +/* OP 6 0x4B70000C Outer Product */ .macro OP sf - .word 0x4B70000C + .word 0x4B70000C | (\sf & 0x1) << 19 .endm +/* GPF 6 0x4B90003D General purpose interpolation */ .macro GPF sf - .word 0x4B90003D + .word 0x4B90003D | (\sf & 0x1) << 19 .endm +/* GPL 5 0x4BA0003E general purpose interpolation */ .macro GPL sf - .word 0x4BA0003E + .word 0x4BA0003E | (\sf & 0x1) << 19 .endm +## Convenience macros +/* rtv0 - 0x4A486012 v0 * rotmatrix */ .macro rtv0 - .word 0x4A486012 + # .word 0x4A486012 + MVMVA 1, 0, 0, 3, 0 .endm +/* rtv1 - 0x4A48E012 v1 * rotmatrix */ .macro rtv1 - .word 0x4A48E012 + # .word 0x4A48E012 + MVMVA 1, 0, 1, 3, 0 .endm +/* rtv2 - 0x4A496012 v2 * rotmatrix */ .macro rtv2 - .word 0x4A496012 + # .word 0x4A496012 + MVMVA 1, 0, 2, 3, 0 .endm +/* rtir12 - 0x4A49E012 ir * rotmatrix */ .macro rtir12 - .word 0x4A49E012 + # .word 0x4A49E012 + MVMVA 1, 0, 3, 3, 0 .endm +/* rtir0 - 0x4A41E012 ir * rotmatrix */ .macro rtir0 - .word 0x4A41E012 + # .word 0x4A41E012 + MVMVA 0, 0, 3, 3, 0 .endm +/* rtv0tr - 0x4A480012 v0 * rotmatrix + tr vector */ .macro rtv0tr - .word 0x4A480012 + # .word 0x4A480012 + MVMVA 1, 0, 0, 0, 0 .endm +/* rtv1tr - 0x4A488012 v1 * rotmatrix + tr vector */ .macro rtv1tr - .word 0x4A488012 + # .word 0x4A488012 + MVMVA 1, 0, 1, 0, 0 .endm +/* rtv2tr - 0x4A490012 v2 * rotmatrix + tr vector */ .macro rtv2tr - .word 0x4A490012 + # .word 0x4A490012 + MVMVA 1, 0, 2, 0, 0 .endm +/* rtirtr - 0x4A498012 ir * rotmatrix + tr vector */ .macro rtirtr - .word 0x4A498012 + # .word 0x4A498012 + MVMVA 1, 0, 3, 0, 0 .endm +/* rtv0bk - 0x4A482012 v0 * rotmatrix + bk vector */ .macro rtv0bk - .word 0x4A482012 + # .word 0x4A482012 + MVMVA 1, 0, 0, 1, 0 .endm +/* rtv1bk - 0x4A48A012 v1 * rotmatrix + bk vector */ .macro rtv1bk - .word 0x4A48A012 + # .word 0x4A48A012 + MVMVA 1, 0, 1, 1, 0 .endm +/* rtv2bk - 0x4A492012 v2 * rotmatrix + bk vector */ .macro rtv2bk - .word 0x4A492012 + # .word 0x4A492012 + MVMVA 1, 0, 2, 1, 0 .endm +/* rtirbk - 0x4A49A012 ir * rotmatrix + bk vector */ .macro rtirbk - .word 0x4A49A012 + # .word 0x4A49A012 + MVMVA 1, 0, 3, 1, 0 .endm +/* ll - 0x4A4A6412 v0 * light matrix. Lower limit result to 0 */ .macro ll - .word 0x4A4A6412 + # .word 0x4A4A6412 + MVMVA 1, 1, 0, 3, 1 .endm +/* llv0 - 0x4A4A6012 v0 * light matrix */ .macro llv0 - .word 0x4A4A6012 + # .word 0x4A4A6012 + MVMVA 1, 1, 0, 3, 0 .endm +/* llv1 - 0x4A4AE012 v1 * light matrix */ .macro llv1 - .word 0x4A4AE012 + # .word 0x4A4AE012 + MVMVA 1, 1, 1, 3, 0 .endm +/* llv2 - 0x4A4B6012 v2 * light matrix */ .macro llv2 - .word 0x4A4B6012 + # .word 0x4A4B6012 + MVMVA 1, 1, 2, 3, 0 .endm +/* llvir - 0x4A4BE012 ir * light matrix */ .macro llvir - .word 0x4A4BE012 + # .word 0x4A4BE012 + MVMVA 1, 1, 3, 3, 0 .endm +/* llv0tr - 0x4A4A0012 v0 * light matrix + tr vector */ .macro llv0tr - .word 0x4A4A0012 + # .word 0x4A4A0012 + MVMVA 1, 1, 0, 0, 0 .endm +/* llv1tr - 0x4A4A8012 v1 * light matrix + tr vector */ .macro llv1tr - .word 0x4A4A8012 + # .word 0x4A4A8012 + MVMVA 1, 1, 1, 0, 0 .endm +/* llv2tr - 0x4A4B0012 v2 * light matrix + tr vector */ .macro llv2tr - .word 0x4A4B0012 + # .word 0x4A4B0012 + MVMVA 1, 1, 2, 0, 0 .endm +/* llirtr - 0x4A4B8012 ir * light matrix + tr vector */ .macro llirtr - .word 0x4A4B8012 + # .word 0x4A4B8012 + MVMVA 1, 1, 3, 0, 0 .endm +/* llv0bk - 0x4A4A2012 v0 * light matrix + bk vector */ .macro llv0bk - .word 0x4A4A2012 + # .word 0x4A4A2012 + MVMVA 1, 1, 0, 1, 0 .endm +/* llv1bk - 0x4A4AA012 v1 * light matrix + bk vector */ .macro llv1bk - .word 0x4A4AA012 + # .word 0x4A4AA012 + MVMVA 1, 1, 1, 1, 0 .endm +/* llv2bk - 0x4A4B2012 v2 * light matrix + bk vector */ .macro llv2bk - .word 0x4A4B2012 + # .word 0x4A4B2012 + MVMVA 1, 1, 2, 1, 0 .endm +/* llirbk - 0x4A4BA012 ir * light matrix + bk vector */ .macro llirbk - .word 0x4A4BA012 + # .word 0x4A4BA012 + MVMVA 1, 1, 3, 1, 0 .endm +/* lc - 0x4A4DA412 v0 * color matrix, Lower limit clamped to 0 */ .macro lc - .word 0x4A4DA412 + # .word 0x4A4DA412 + MVMVA 1, 2, 3, 1, 1 .endm +/* lcv0 - 0x4A4C6012 v0 * color matrix */ .macro lcv0 - .word 0x4A4C6012 + # .word 0x4A4C6012 + MVMVA 1, 2, 0, 3, 0 .endm +/* lcv1 - 0x4A4CE012 v1 * color matrix */ .macro lcv1 - .word 0x4A4CE012 + # .word 0x4A4CE012 + MVMVA 1, 2, 1, 3, 0 .endm +/* lcv2 - 0x4A4D6012 v2 * color matrix */ .macro lcv2 - .word 0x4A4D6012 + # .word 0x4A4D6012 + MVMVA 1, 2, 2, 3, 0 .endm +/* lcvir - 0x4A4DE012 ir * color matrix */ .macro lcvir - .word 0x4A4DE012 + # .word 0x4A4DE012 + MVMVA 1, 2, 3, 3, 0 .endm +/* lcv0tr - 0x4A4C0012 v0 * color matrix + tr vector */ .macro lcv0tr - .word 0x4A4C0012 + # .word 0x4A4C0012 + MVMVA 1, 2, 0, 0, 0 .endm +/* lcv1tr - 0x4A4C8012 v1 * color matrix + tr vector */ .macro lcv1tr - .word 0x4A4C8012 + # .word 0x4A4C8012 + MVMVA 1, 2, 1, 0, 0 .endm +/* lcv2tr - 0x4A4D0012 v2 * color matrix + tr vector */ .macro lcv2tr - .word 0x4A4D0012 + # .word 0x4A4D0012 + MVMVA 1, 2, 2, 0, 0 .endm +/* lcirtr - 0x4A4D8012 ir * color matrix + tr vector */ .macro lcirtr - .word 0x4A4D8012 + # .word 0x4A4D8012 + MVMVA 1, 2, 3, 0, 0 .endm +/* lev0bk - 0x4A4C2012 v0 * color matrix + bk vector */ .macro lev0bk - .word 0x4A4C2012 + # .word 0x4A4C2012 + MVMVA 1, 2, 0, 1, 0 .endm +/* lev1bk - 0x4A4CA012 v1 * color matrix + bk vector */ .macro lev1bk - .word 0x4A4CA012 + # .word 0x4A4CA012 + MVMVA 1, 2, 1, 1, 0 .endm +/* lev2bk - 0x4A4D2012 v2 * color matrix + bk vector */ .macro lev2bk - .word 0x4A4D2012 + # .word 0x4A4D2012 + MVMVA 1, 2, 2, 1, 0 .endm +/* leirbk - 0x4A4DA012 ir * color matrix + bk vector */ .macro leirbk - .word 0x4A4DA012 + # .word 0x4A4DA012 + MVMVA 1, 2, 3, 1, 0 .endm -.macro sqr12 - .word 0x4AA80428 -.endm +/* sqr12 - 0x4AA80428 square of ir 1,19,12 */ +# .macro sqr12 +# # .word 0x4AA80428 +# SQR 1 +# .endm -.macro sqr0 - .word 0x4AA80428 -.endm +/* sqr0 - 0x4AA80428 square of ir 1,31, 0 */ +# .macro sqr0 +# # .word 0x4AA80428 +# SQR 1 +# .endm +/* op12 - 0x4B78000C outer product 1,19,12 */ .macro op12 - .word 0x4B78000C + # .word 0x4B78000C + OP 1 .endm +/* op0 - 0x4B70000C outer product 1,31, 0 */ .macro op0 - .word 0x4B70000C + # .word 0x4B70000C + OP 0 .endm +/* gpf12 - 0x4B98003D general purpose interpolation 1,19,12 */ .macro gpf12 - .word 0x4B98003D + # .word 0x4B98003D + GPF 1 .endm +/* gpf0 - 0x4B90003D general purpose interpolation 1,31, 0 */ .macro gpf0 - .word 0x4B90003D + # .word 0x4B90003D + GPF 0 .endm +/* gpl12 - 0x4BA8003E general purpose interpolation 1,19,12 */ .macro gpl12 - .word 0x4BA8003E + # .word 0x4BA8003E + GPL 1 .endm -.macro gpl0 - .word 0x4BA0003E -.endm - -/* DPCS macro */ -/* dw $00000e3f */ -/* endm */ -/* */ -/* DPCT macro */ -/* dw $00000e7f */ -/* endm */ -/* */ -/* INTPL macro */ -/* dw $00000ebf */ -/* endm */ -/* */ -/* NCS macro */ -/* dw $00000f7f */ -/* endm */ -/* */ -/* NCT macro */ -/* dw $00000fbf */ -/* endm */ -/* */ -/* NCDS macro */ -/* dw $00000fff */ -/* endm */ -/* */ -/* NCDT macro */ -/* dw $0000103f */ -/* endm */ -/* */ -/* NCCS macro */ -/* dw $0000107f */ -/* endm */ -/* */ -/* NCCT macro */ -/* dw $000010bf */ -/* endm */ -/* */ -/* CDP macro */ -/* dw $000010ff */ -/* endm */ -/* */ -/* CC macro */ -/* dw $0000113f */ -/* endm */ -/* */ -/* NCLIP macro */ -/* dw $0000117f */ -/* endm */ -/* */ -/* AVSZ3 macro */ -/* dw $000011bf */ -/* endm */ -/* */ -/* AVSZ4 macro */ -/* dw $000011ff */ -/* endm */ -/* */ -/* MVMVA macro sf,mx,v,cv,lm */ -/* dw $000013bf|sf<<25|mx<<23|v<<21|cv<<19|lm<<18 */ -/* endm */ -/* */ -/* SQR macro sf */ -/* dw $000013ff|sf<<25 */ -/* endm */ -/* */ -/* OP macro sf */ -/* dw $0000143f|sf<<25 */ -/* endm */ -/* */ -/* GPF macro sf */ -/* dw $0000147f|sf<<25 */ -/* endm */ -/* */ -/* GPL macro sf */ -/* dw $000014bf|sf<<25 */ -/* endm */ - - -/* RTPS 15 0x4A180001 Perspective transform */ -/* RTPT 23 0x4A280030 Perspective transform on 3 points */ -/* MVMVA 8 0x4A400012 Multiply vector by matrix and vector addition. */ -/* DPCL 8 0x4A680029 Depth Cue Color light */ -/* DPCS 8 0x4A780010 Depth Cueing */ -/* DPCT 17 0x4AF8002A Depth cue color RGB0,RGB1,RGB2 */ -/* INTPL 8 0x4A980011 Interpolation of vector and far color */ -/* SQR 5 0x4AA00428 Square of vector */ -/* NCS 14 0x4AC8041E Normal color v0 */ -/* NCT 30 0x4AD80420 Normal color v0, v1, v2 */ -/* NCDS 19 0x4AE80413 Normal color depth cuev0 */ -/* NCDT 44 0x4AF80416 Normal color depth cue v0, v1, v2 */ -/* NCCS 17 0x4B08041B Normal color col. v0 */ -/* NCCT 39 0x4B18043F Normal color col.v0, v1, v2 */ -/* CDP 13 0x4B280414 Color Depth Queue */ -/* CC 11 0x4B38041C Color Col. */ -/* NCLIP 8 0x4B400006 Normal clipping */ -/* AVSZ3 5 0x4B58002D Average of three Z values */ -/* AVSZ4 6 0x4B68002E Average of four Z values */ -/* OP 6 0x4B70000C Outer Product */ -/* GPF 6 0x4B90003D General purpose interpolation */ -/* GPL 5 0x4BA0003E general purpose interpolation */ -/* rtv0 - 0x4A486012 v0 * rotmatrix */ -/* rtv1 - 0x4A48E012 v1 * rotmatrix */ -/* rtv2 - 0x4A496012 v2 * rotmatrix */ -/* rtir12 - 0x4A49E012 ir * rotmatrix */ -/* rtir0 - 0x4A41E012 ir * rotmatrix */ -/* rtv0tr - 0x4A480012 v0 * rotmatrix + tr vector */ -/* rtv1tr - 0x4A488012 v1 * rotmatrix + tr vector */ -/* rtv2tr - 0x4A490012 v2 * rotmatrix + tr vector */ -/* rtirtr - 0x4A498012 ir * rotmatrix + tr vector */ -/* rtv0bk - 0x4A482012 v0 * rotmatrix + bk vector */ -/* rtv1bk - 0x4A48A012 v1 * rotmatrix + bk vector */ -/* rtv2bk - 0x4A492012 v2 * rotmatrix + bk vector */ -/* rtirbk - 0x4A49A012 ir * rotmatrix + bk vector */ -/* ll - 0x4A4A6412 v0 * light matrix. Lower limit result to 0 */ -/* llv0 - 0x4A4A6012 v0 * light matrix */ -/* llv1 - 0x4A4AE012 v1 * light matrix */ -/* llv2 - 0x4A4B6012 v2 * light matrix */ -/* llvir - 0x4A4BE012 ir * light matrix */ -/* llv0tr - 0x4A4A0012 v0 * light matrix + tr vector */ -/* llv1tr - 0x4A4A8012 v1 * light matrix + tr vector */ -/* llv2tr - 0x4A4B0012 v2 * light matrix + tr vector */ -/* llirtr - 0x4A4B8012 ir * light matrix + tr vector */ -/* llv0bk - 0x4A4A2012 v0 * light matrix + bk vector */ -/* llv1bk - 0x4A4AA012 v1 * light matrix + bk vector */ -/* llv2bk - 0x4A4B2012 v2 * light matrix + bk vector */ -/* llirbk - 0x4A4BA012 ir * light matrix + bk vector */ -/* lc - 0x4A4DA412 v0 * color matrix, Lower limit clamped to 0 */ -/* lcv0 - 0x4A4C6012 v0 * color matrix */ -/* lcv1 - 0x4A4CE012 v1 * color matrix */ -/* lcv2 - 0x4A4D6012 v2 * color matrix */ -/* lcvir - 0x4A4DE012 ir * color matrix */ -/* lcv0tr - 0x4A4C0012 v0 * color matrix + tr vector */ -/* lcv1tr - 0x4A4C8012 v1 * color matrix + tr vector */ -/* lcv2tr - 0x4A4D0012 v2 * color matrix + tr vector */ -/* lcirtr - 0x4A4D8012 ir * color matrix + tr vector */ -/* lev0bk - 0x4A4C2012 v0 * color matrix + bk vector */ -/* lev1bk - 0x4A4CA012 v1 * color matrix + bk vector */ -/* lev2bk - 0x4A4D2012 v2 * color matrix + bk vector */ -/* leirbk - 0x4A4DA012 ir * color matrix + bk vector */ -/* sqr12 - 0x4AA80428 square of ir 1,19,12 */ -/* sqr0 - 0x4AA80428 square of ir 1,31, 0 */ -/* op12 - 0x4B78000C outer product 1,19,12 */ -/* op0 - 0x4B70000C outer product 1,31, 0 */ -/* gpf12 - 0x4B98003D general purpose interpolation 1,19,12 */ -/* gpf0 - 0x4B90003D general purpose interpolation 1,31, 0 */ -/* gpl12 - 0x4BA8003E general purpose interpolation 1,19,12 */ /* gpl0 - 0x4BA0003E general purpose interpolation 1,31, 0 */ +.macro gpl0 + # .word 0x4BA0003E + GPL 0 +.endm diff --git a/docs/r3000gte/gte_macros_volatile.h b/docs/r3000gte/gte_macros_volatile.h new file mode 100644 index 00000000..8ac19871 --- /dev/null +++ b/docs/r3000gte/gte_macros_volatile.h @@ -0,0 +1,1354 @@ +/** + * GTE macros + * This file is meant to be used as an alternative to DMPSX + * + * This file includes volatile variants and register clobber list which may affect matching + */ + + +/* RTPS 15 0x4A180001 Perspective transform */ +#define gte_nRTPS() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4A180001": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_RTPS() { \ + __asm__ volatile (".word 0x4A180001": : :"$12","$13","$14","$15","memory"); \ + } + +/* RTPT 23 0x4A280030 Perspective transform on 3 points */ +#define gte_nRTPT() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4A280030": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_RTPT() { \ + __asm__ volatile (".word 0x4A280030": : :"$12","$13","$14","$15","memory"); \ + } + +/* DPCL 8 0x4A680029 Depth Cue Color light */ +#define gte_nDPCL() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4A680029": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_DPCL() { \ + __asm__ volatile (".word 0x4A680029": : :"$12","$13","$14","$15","memory"); \ + } + +/* DPCS 8 0x4A780010 Depth Cueing */ +#define gte_nDPCS() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4A780010": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_DPCS() { \ + __asm__ volatile (".word 0x4A780010": : :"$12","$13","$14","$15","memory"); \ + } + +/* DPCT 17 0x4AF8002A Depth cue color RGB0,RGB1,RGB2 */ +#define gte_nDPCT() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4AF8002A": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_DPCT() { \ + __asm__ volatile (".word 0x4AF8002A": : :"$12","$13","$14","$15","memory"); \ + } + +/* INTPL 8 0x4A980011 Interpolation of vector and far color */ +#define gte_nINTPL() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4A980011": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_INTPL() { \ + __asm__ volatile (".word 0x4A980011": : :"$12","$13","$14","$15","memory"); \ + } + +/* NCS 14 0x4AC8041E Normal color v0 */ +#define gte_nNCS() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4AC8041E": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_NCS() { \ + __asm__ volatile (".word 0x4AC8041E": : :"$12","$13","$14","$15","memory"); \ + } + +/* NCT 30 0x4AD80420 Normal color v0, v1, v2 */ +#define gte_nNCT() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4AD80420": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_NCT() { \ + __asm__ volatile (".word 0x4AD80420": : :"$12","$13","$14","$15","memory"); \ + } + +/* NCDS 19 0x4AE80413 Normal color depth cuev0 */ +#define gte_nNCDS() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4AE80413": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_NCDS() { \ + __asm__ volatile (".word 0x4AE80413": : :"$12","$13","$14","$15","memory"); \ + } + +/* NCDT 44 0x4AF80416 Normal color depth cue v0, v1, v2 */ +#define gte_nNCDT() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4AF80416": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_NCDT() { \ + __asm__ volatile (".word 0x4AF80416": : :"$12","$13","$14","$15","memory"); \ + } + +/* NCCS 17 0x4B08041B Normal color col. v0 */ +#define gte_nNCCS() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4B08041B": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_NCCS() { \ + __asm__ volatile (".word 0x4B08041B": : :"$12","$13","$14","$15","memory"); \ + } + +/* NCCT 39 0x4B18043F Normal color col.v0, v1, v2 */ +#define gte_nNCCT() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4B18043F": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_NCCT() { \ + __asm__ volatile (".word 0x4B18043F": : :"$12","$13","$14","$15","memory"); \ + } + +/* CDP 13 0x4B280414 Color Depth Queue */ +#define gte_nCDP() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4B280414": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_CDP() { \ + __asm__ volatile (".word 0x4B280414": : :"$12","$13","$14","$15","memory"); \ + } + +/* CC 11 0x4B38041C Color Col. */ +#define gte_CC() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4B38041C": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_CC() { \ + __asm__ volatile (".word 0x4B38041C": : :"$12","$13","$14","$15","memory"); \ + } + +/* NCLIP 8 0x4B400006 Normal clipping */ +#define gte_nNCLIP() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4B400006": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_NCLIP() { \ + __asm__ volatile (".word 0x4B400006": : :"$12","$13","$14","$15","memory"); \ + } + +/* AVSZ3 5 0x4B58002D Average of three Z values */ +#define gte_nAVSZ3() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4B58002D": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_AVSZ3() { \ + __asm__ volatile (".word 0x4B58002D": : :"$12","$13","$14","$15","memory"); \ + } + +/* AVSZ4 6 0x4B68002E Average of four Z values */ +#define gte_nAVSZ4() { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word 0x4B68002E": : :"$12","$13","$14","$15","memory"); \ + } + +#define gte_AVSZ4() { \ + __asm__ volatile (".word 0x4B68002E": : :"$12","$13","$14","$15","memory"); \ + } + +/** + * Instructions which take an argument + * + * sf : arg is 1 bit wide + * mx : arg is 2 bit wide + * v : arg is 2 bit wide + * cv : arg is 2 bit wide + * lm : arg is 1 bit wide + */ + +/* MVMVA 8 0x4A400012 Multiply vector by matrix and vector addition. */ +#define gte_nMVMVA(sf, mx, v, cv, lm) { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word %0": :"g"(0x4A400012 | ((sf) & 0x1) << 19 | ((mx) & 0x3) << 17 | ((v) & 0x3) << 15 | ((cv) & 0x3) << 13 | ((lm) & 0x1) << 10) :"$12","$13","$14","$15","memory") \ + } + +#define gte_MVMVA(sf, mx, v, cv, lm) { \ + __asm__ volatile (".word %0": :"g"(0x4A400012 | ((sf) & 0x1) << 19 | ((mx) & 0x3) << 17 | ((v) & 0x3) << 15 | ((cv) & 0x3) << 13 | ((lm) & 0x1) << 10) :"$12","$13","$14","$15","memory") \ + } + +/* SQR 5 0x4AA00428 Square of vector */ +#define gte_nSQR(sf) { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word %0": :"g"(0x4AA00428 | ((sf) & 0x1) << 19):"$12","$13","$14","$15","memory") \ + } + +#define gte_SQR(sf) { \ + __asm__ volatile (".word %0": :"g"(0x4AA00428 | ((sf) & 0x1) << 19):"$12","$13","$14","$15","memory") \ + } + +/* OP 6 0x4B70000C Outer Product */ +#define gte_nOP(sf) { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word %0": :"g"(0x4B70000C | ((sf) & 0x1) << 19):"$12","$13","$14","$15","memory") \ + } + +#define gte_OP(sf) { \ + __asm__ volatile (".word %0": :"g"(0x4B70000C | ((sf) & 0x1) << 19):"$12","$13","$14","$15","memory") \ + } + +/* GPF 6 0x4B90003D General purpose interpolation */ +#define gte_nGPF(sf) { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word %0": :"g"(0x4B90003D | ((sf) & 0x1) << 19):"$12","$13","$14","$15","memory") \ + } + +#define gte_GPF(sf) { \ + __asm__ volatile (".word %0": :"g"(0x4B90003D | ((sf) & 0x1) << 19):"$12","$13","$14","$15","memory") \ + } + +/* GPL 5 0x4BA0003E general purpose interpolation */ +#define gte_nGPL(sf) { \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile ("nop ": : :"$12","$13","$14","$15","memory"); \ + __asm__ volatile (".word %0": :"g"(0x4BA0003E | ((sf) & 0x1) << 19):"$12","$13","$14","$15","memory") \ + } + +#define gte_GPL(sf) { \ + __asm__ volatile (".word %0": :"g"(0x4BA0003E | ((sf) & 0x1) << 19):"$12","$13","$14","$15","memory") \ + } + + +/** + * Convenience macros + */ + +/* rtv0 - 0x4A486012 v0 * rotmatrix */ +#define gte_nrtv0() gte_nMVMVA(1, 0, 0, 3, 0) + +#define gte_rtv0() gte_MVMVA(1, 0, 0, 3, 0) + +/* rtv1 - 0x4A48E012 v1 * rotmatrix */ +#define gte_nrtv1() gte_nMVMVA(1, 0, 1, 3, 0) + +#define gte_rtv1() gte_MVMVA(1, 0, 1, 3, 0) + +/* rtv2 - 0x4A496012 v2 * rotmatrix */ +#define gte_nrtv2() gte_nMVMVA(1, 0, 2, 3, 0) + +#define gte_rtv2() gte_MVMVA(1, 0, 2, 3, 0) + +/* rtir12 - 0x4A49E012 ir * rotmatrix */ +#define gte_nrtir12() gte_nMVMVA(1, 0, 3, 3, 0) + +#define gte_rtir12() gte_MVMVA(1, 0, 3, 3, 0) + +/* rtir0 - 0x4A41E012 ir * rotmatrix */ +#define gte_nrtir0() gte_nMVMVA(0, 0, 3, 3, 0) + +#define gte_rtir0() gte_MVMVA(0, 0, 3, 3, 0) + +/* rtv0tr - 0x4A480012 v0 * rotmatrix + tr vector */ +#define gte_nrtv0tr() gte_nMVMVA(1, 0, 0, 0, 0) + +#define gte_rtv0tr() gte_MVMVA(1, 0, 0, 0, 0) + +/* rtv1tr - 0x4A488012 v1 * rotmatrix + tr vector */ +#define gte_nrtv1tr() gte_nMVMVA(1, 0, 1, 0, 0) + +#define gte_rtv1tr() gte_MVMVA(1, 0, 1, 0, 0) + +/* rtv2tr - 0x4A490012 v2 * rotmatrix + tr vector */ +#define gte_nrtv2tr() gte_nMVMVA(1, 0, 2, 0, 0) + +#define gte_rtv2tr() gte_MVMVA(1, 0, 2, 0, 0) + +/* rtirtr - 0x4A498012 ir * rotmatrix + tr vector */ +#define gte_nrtirtr() gte_nMVMVA(1, 0, 3, 0, 0) + +#define gte_rtirtr() gte_MVMVA(1, 0, 3, 0, 0) + +/* rtv0bk - 0x4A482012 v0 * rotmatrix + bk vector */ +#define gte_nrtv0bk() gte_nMVMVA(1, 0, 0, 1, 0) + +#define gte_rtv0bk() gte_MVMVA(1, 0, 0, 1, 0) + +/* rtv1bk - 0x4A48A012 v1 * rotmatrix + bk vector */ +#define gte_nrtv1bk() gte_nMVMVA(1, 0, 1, 1, 0) + +#define gte_rtv1bk() gte_MVMVA(1, 0, 1, 1, 0) + +/* rtv2bk - 0x4A492012 v2 * rotmatrix + bk vector */ +#define gte_nrtv2bk() gte_nMVMVA(1, 0, 2, 1, 0) + +#define gte_rtv2bk() gte_MVMVA(1, 0, 2, 1, 0) + +/* rtirbk - 0x4A49A012 ir * rotmatrix + bk vector */ +#define gte_nrtirbk() gte_nMVMVA(1, 0, 3, 1, 0) + +#define gte_rtirbk() gte_MVMVA(1, 0, 3, 1, 0) + +/* ll - 0x4A4A6412 v0 * light matrix. Lower limit result to 0 */ +#define gte_nll() gte_nMVMVA(1, 1, 0, 3, 1) + +#define gte_ll() gte_MVMVA(1, 1, 0, 3, 1) + +/* llv0 - 0x4A4A6012 v0 * light matrix */ +#define gte_nllv0() gte_nMVMVA(1, 1, 0, 3, 0) + +#define gte_llv0() gte_MVMVA(1, 1, 0, 3, 0) + +/* llv1 - 0x4A4AE012 v1 * light matrix */ +#define gte_nllv1() gte_nMVMVA(1, 1, 1, 3, 0) + +#define gte_llv1() gte_MVMVA(1, 1, 1, 3, 0) + +/* llv2 - 0x4A4B6012 v2 * light matrix */ +#define gte_nllv2() gte_nMVMVA(1, 1, 2, 3, 0) + +#define gte_llv2() gte_MVMVA(1, 1, 2, 3, 0) + +/* llvir - 0x4A4BE012 ir * light matrix */ +#define gte_nllvir() gte_nMVMVA(1, 1, 3, 3, 0) + +#define gte_llvir() gte_MVMVA(1, 1, 3, 3, 0) + +/* llv0tr - 0x4A4A0012 v0 * light matrix + tr vector */ +#define gte_nllv0tr() gte_nMVMVA(1, 1, 0, 0, 0) + +#define gte_llv0tr() gte_MVMVA(1, 1, 0, 0, 0) + +/* llv1tr - 0x4A4A8012 v1 * light matrix + tr vector */ +#define gte_nllv1tr() gte_nMVMVA(1, 1, 1, 0, 0) + +#define gte_llv1tr() gte_MVMVA(1, 1, 1, 0, 0) + +/* llv2tr - 0x4A4B0012 v2 * light matrix + tr vector */ +#define gte_nllv2tr() gte_nMVMVA(1, 1, 2, 0, 0) + +#define gte_llv2tr() gte_MVMVA(1, 1, 2, 0, 0) + +/* llirtr - 0x4A4B8012 ir * light matrix + tr vector */ +#define gte_nllirtr() gte_nMVMVA(1, 1, 3, 0, 0) + +#define gte_llirtr() gte_MVMVA(1, 1, 3, 0, 0) + +/* llv0bk - 0x4A4A2012 v0 * light matrix + bk vector */ +#define gte_nllv0bk() gte_nMVMVA(1, 1, 0, 1, 0) + +#define gte_llv0bk() gte_MVMVA(1, 1, 0, 1, 0) + +/* llv1bk - 0x4A4AA012 v1 * light matrix + bk vector */ +#define gte_nllv1bk() gte_nMVMVA(1, 1, 1, 1, 0) + +#define gte_llv1bk() gte_MVMVA(1, 1, 1, 1, 0) + +/* llv2bk - 0x4A4B2012 v2 * light matrix + bk vector */ +#define gte_nllv2bk() gte_nMVMVA(1, 1, 2, 1, 0) + +#define gte_llv2bk() gte_MVMVA(1, 1, 2, 1, 0) + +/* llirbk - 0x4A4BA012 ir * light matrix + bk vector */ +#define gte_nllirbk() gte_nMVMVA(1, 1, 3, 1, 0) + +#define gte_llirbk() gte_MVMVA(1, 1, 3, 1, 0) + +/* lc - 0x4A4DA412 v0 * color matrix, Lower limit clamped to 0 */ +#define gte_nlc() gte_nMVMVA(1, 2, 3, 1, 1) + +#define gte_lc() gte_MVMVA(1, 2, 3, 1, 1) + +/* lcv0 - 0x4A4C6012 v0 * color matrix */ +#define gte_nlcv0() gte_nMVMVA(1, 2, 0, 3, 0) + +#define gte_lcv0() gte_MVMVA(1, 2, 0, 3, 0) + +/* lcv1 - 0x4A4CE012 v1 * color matrix */ +#define gte_nlcv1() gte_nMVMVA(1, 2, 1, 3, 0) + +#define gte_lcv1() gte_MVMVA(1, 2, 1, 3, 0) + +/* lcv2 - 0x4A4D6012 v2 * color matrix */ +#define gte_nlcv2() gte_nMVMVA(1, 2, 2, 3, 0) + +#define gte_lcv2() gte_MVMVA(1, 2, 2, 3, 0) + +/* lcvir - 0x4A4DE012 ir * color matrix */ +#define gte_nlcvir() gte_nMVMVA(1, 2, 3, 3, 0) + +#define gte_lcvir() gte_MVMVA(1, 2, 3, 3, 0) + +/* lcv0tr - 0x4A4C0012 v0 * color matrix + tr vector */ +#define gte_nlcv0tr() gte_nMVMVA(1, 2, 0, 0, 0) + +#define gte_lcv0tr() gte_MVMVA(1, 2, 0, 0, 0) + +/* lcv1tr - 0x4A4C8012 v1 * color matrix + tr vector */ +#define gte_nlcv1tr() gte_nMVMVA(1, 2, 1, 0, 0) + +#define gte_lcv1tr() gte_MVMVA(1, 2, 1, 0, 0) + +/* lcv2tr - 0x4A4D0012 v2 * color matrix + tr vector */ +#define gte_nlcv2tr() gte_nMVMVA(1, 2, 2, 0, 0) + +#define gte_lcv2tr() gte_MVMVA(1, 2, 2, 0, 0) + +/* lcirtr - 0x4A4D8012 ir * color matrix + tr vector */ +#define gte_nlcirtr() gte_nMVMVA(1, 2, 3, 0, 0) + +#define gte_lcirtr() gte_MVMVA(1, 2, 3, 0, 0) + +/* lev0bk - 0x4A4C2012 v0 * color matrix + bk vector */ +#define gte_nlev0bk() gte_nMVMVA(1, 2, 0, 1, 0) + +#define gte_lev0bk() gte_MVMVA(1, 2, 0, 1, 0) + +/* lev1bk - 0x4A4CA012 v1 * color matrix + bk vector */ +#define gte_nlev1bk() gte_nMVMVA(1, 2, 1, 1, 0) + +#define gte_lev1bk() gte_MVMVA(1, 2, 1, 1, 0) + +/* lev2bk - 0x4A4D2012 v2 * color matrix + bk vector */ +#define gte_nlev2bk() gte_nMVMVA(1, 2, 2, 1, 0) + +#define gte_lev2bk() gte_MVMVA(1, 2, 2, 1, 0) + +/* leirbk - 0x4A4DA012 ir * color matrix + bk vector */ +#define gte_nleirbk() gte_nMVMVA(1, 2, 3, 1, 0) + +#define gte_leirbk() gte_MVMVA(1, 2, 3, 1, 0) + +/* sqr12 - 0x4AA80428 square of ir 1,19,12 */ +// #define gte_nsqr12() gte_nSQR(1) +// +// #define gte_sqr12() gte_SQR(1) + +/* sqr0 - 0x4AA80428 square of ir 1,31, 0 */ +// #define gte_nsqr0() gte_nSQR(1) +// +// #define gte_sqr0() gte_SQR(1) + +/* op12 - 0x4B78000C outer product 1,19,12 */ +#define gte_nop12() gte_nOP(1) + +#define gte_op12() gte_OP(1) + +/* op0 - 0x4B70000C outer product 1,31, 0 */ +#define gte_nop0() gte_nOP(0) + +#define gte_op0() gte_OP(0) + +/* gpf12 - 0x4B98003D general purpose interpolation 1,19,12 */ +#define gte_ngpf12() gte_nGPF(1) + +#define gte_gpf12() gte_GPF(1) + +/* gpf0 - 0x4B90003D general purpose interpolation 1,31, 0 */ +#define gte_ngpf0() gte_nGPF(0) + +#define gte_gpf0() gte_GPF(0) + +/* gpl12 - 0x4BA8003E general purpose interpolation 1,19,12 */ +#define gte_ngpl12() gte_nGPL(1) + +#define gte_gpl12() gte_GPL(1) + +/* gpl0 - 0x4BA0003E general purpose interpolation 1,31, 0 */ +#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"); \ +} diff --git a/include/common/RabbitizerVersion.h b/include/common/RabbitizerVersion.h index f1613790..45702407 100644 --- a/include/common/RabbitizerVersion.h +++ b/include/common/RabbitizerVersion.h @@ -14,7 +14,7 @@ extern "C" { // Header version #define RAB_VERSION_MAJOR 1 #define RAB_VERSION_MINOR 7 -#define RAB_VERSION_PATCH 3 +#define RAB_VERSION_PATCH 4 #define RAB_VERSION_STR RAB_STRINGIFY(RAB_VERSION_MAJOR) "." RAB_STRINGIFY(RAB_VERSION_MINOR) "." RAB_STRINGIFY(RAB_VERSION_PATCH) diff --git a/include/generated/Registers_Names_arrays.h b/include/generated/Registers_Names_arrays.h index 7c12bda4..46f8f95d 100644 --- a/include/generated/Registers_Names_arrays.h +++ b/include/generated/Registers_Names_arrays.h @@ -433,38 +433,38 @@ const char *RabbitizerRegister_RspVector_Names[][2] = { [RABBITIZER_REG_RSP_VECTOR_v31] = { "$" "31", "$" "v31" }, }; const char *RabbitizerRegister_R5900VF_Names[][2] = { - [RABBITIZER_REG_R5900_VF_vf0] = { "$" "0", "$" "vf0" }, - [RABBITIZER_REG_R5900_VF_vf1] = { "$" "1", "$" "vf1" }, - [RABBITIZER_REG_R5900_VF_vf2] = { "$" "2", "$" "vf2" }, - [RABBITIZER_REG_R5900_VF_vf3] = { "$" "3", "$" "vf3" }, - [RABBITIZER_REG_R5900_VF_vf4] = { "$" "4", "$" "vf4" }, - [RABBITIZER_REG_R5900_VF_vf5] = { "$" "5", "$" "vf5" }, - [RABBITIZER_REG_R5900_VF_vf6] = { "$" "6", "$" "vf6" }, - [RABBITIZER_REG_R5900_VF_vf7] = { "$" "7", "$" "vf7" }, - [RABBITIZER_REG_R5900_VF_vf8] = { "$" "8", "$" "vf8" }, - [RABBITIZER_REG_R5900_VF_vf9] = { "$" "9", "$" "vf9" }, - [RABBITIZER_REG_R5900_VF_vf10] = { "$" "10", "$" "vf10" }, - [RABBITIZER_REG_R5900_VF_vf11] = { "$" "11", "$" "vf11" }, - [RABBITIZER_REG_R5900_VF_vf12] = { "$" "12", "$" "vf12" }, - [RABBITIZER_REG_R5900_VF_vf13] = { "$" "13", "$" "vf13" }, - [RABBITIZER_REG_R5900_VF_vf14] = { "$" "14", "$" "vf14" }, - [RABBITIZER_REG_R5900_VF_vf15] = { "$" "15", "$" "vf15" }, - [RABBITIZER_REG_R5900_VF_vf16] = { "$" "16", "$" "vf16" }, - [RABBITIZER_REG_R5900_VF_vf17] = { "$" "17", "$" "vf17" }, - [RABBITIZER_REG_R5900_VF_vf18] = { "$" "18", "$" "vf18" }, - [RABBITIZER_REG_R5900_VF_vf19] = { "$" "19", "$" "vf19" }, - [RABBITIZER_REG_R5900_VF_vf20] = { "$" "20", "$" "vf20" }, - [RABBITIZER_REG_R5900_VF_vf21] = { "$" "21", "$" "vf21" }, - [RABBITIZER_REG_R5900_VF_vf22] = { "$" "22", "$" "vf22" }, - [RABBITIZER_REG_R5900_VF_vf23] = { "$" "23", "$" "vf23" }, - [RABBITIZER_REG_R5900_VF_vf24] = { "$" "24", "$" "vf24" }, - [RABBITIZER_REG_R5900_VF_vf25] = { "$" "25", "$" "vf25" }, - [RABBITIZER_REG_R5900_VF_vf26] = { "$" "26", "$" "vf26" }, - [RABBITIZER_REG_R5900_VF_vf27] = { "$" "27", "$" "vf27" }, - [RABBITIZER_REG_R5900_VF_vf28] = { "$" "28", "$" "vf28" }, - [RABBITIZER_REG_R5900_VF_vf29] = { "$" "29", "$" "vf29" }, - [RABBITIZER_REG_R5900_VF_vf30] = { "$" "30", "$" "vf30" }, - [RABBITIZER_REG_R5900_VF_vf31] = { "$" "31", "$" "vf31" }, + [RABBITIZER_REG_R5900_VF_vf0] = { "$" "vf0", "$" "vf0" }, + [RABBITIZER_REG_R5900_VF_vf1] = { "$" "vf1", "$" "vf1" }, + [RABBITIZER_REG_R5900_VF_vf2] = { "$" "vf2", "$" "vf2" }, + [RABBITIZER_REG_R5900_VF_vf3] = { "$" "vf3", "$" "vf3" }, + [RABBITIZER_REG_R5900_VF_vf4] = { "$" "vf4", "$" "vf4" }, + [RABBITIZER_REG_R5900_VF_vf5] = { "$" "vf5", "$" "vf5" }, + [RABBITIZER_REG_R5900_VF_vf6] = { "$" "vf6", "$" "vf6" }, + [RABBITIZER_REG_R5900_VF_vf7] = { "$" "vf7", "$" "vf7" }, + [RABBITIZER_REG_R5900_VF_vf8] = { "$" "vf8", "$" "vf8" }, + [RABBITIZER_REG_R5900_VF_vf9] = { "$" "vf9", "$" "vf9" }, + [RABBITIZER_REG_R5900_VF_vf10] = { "$" "vf10", "$" "vf10" }, + [RABBITIZER_REG_R5900_VF_vf11] = { "$" "vf11", "$" "vf11" }, + [RABBITIZER_REG_R5900_VF_vf12] = { "$" "vf12", "$" "vf12" }, + [RABBITIZER_REG_R5900_VF_vf13] = { "$" "vf13", "$" "vf13" }, + [RABBITIZER_REG_R5900_VF_vf14] = { "$" "vf14", "$" "vf14" }, + [RABBITIZER_REG_R5900_VF_vf15] = { "$" "vf15", "$" "vf15" }, + [RABBITIZER_REG_R5900_VF_vf16] = { "$" "vf16", "$" "vf16" }, + [RABBITIZER_REG_R5900_VF_vf17] = { "$" "vf17", "$" "vf17" }, + [RABBITIZER_REG_R5900_VF_vf18] = { "$" "vf18", "$" "vf18" }, + [RABBITIZER_REG_R5900_VF_vf19] = { "$" "vf19", "$" "vf19" }, + [RABBITIZER_REG_R5900_VF_vf20] = { "$" "vf20", "$" "vf20" }, + [RABBITIZER_REG_R5900_VF_vf21] = { "$" "vf21", "$" "vf21" }, + [RABBITIZER_REG_R5900_VF_vf22] = { "$" "vf22", "$" "vf22" }, + [RABBITIZER_REG_R5900_VF_vf23] = { "$" "vf23", "$" "vf23" }, + [RABBITIZER_REG_R5900_VF_vf24] = { "$" "vf24", "$" "vf24" }, + [RABBITIZER_REG_R5900_VF_vf25] = { "$" "vf25", "$" "vf25" }, + [RABBITIZER_REG_R5900_VF_vf26] = { "$" "vf26", "$" "vf26" }, + [RABBITIZER_REG_R5900_VF_vf27] = { "$" "vf27", "$" "vf27" }, + [RABBITIZER_REG_R5900_VF_vf28] = { "$" "vf28", "$" "vf28" }, + [RABBITIZER_REG_R5900_VF_vf29] = { "$" "vf29", "$" "vf29" }, + [RABBITIZER_REG_R5900_VF_vf30] = { "$" "vf30", "$" "vf30" }, + [RABBITIZER_REG_R5900_VF_vf31] = { "$" "vf31", "$" "vf31" }, }; const char *RabbitizerRegister_R5900VI_Names[][2] = { [RABBITIZER_REG_R5900_VI_vi0] = { "$" "0", "$" "vi0" }, diff --git a/pyproject.toml b/pyproject.toml index 1f3bc858..bf6d1c5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [project] name = "rabbitizer" # Version should be synced with include/common/RabbitizerVersion.h -version = "1.7.3" +version = "1.7.4" description = "MIPS instruction decoder" # license = "MIT" readme = "README.md" diff --git a/tables/Makefile b/tables/Makefile index 3b484553..b718dc88 100644 --- a/tables/Makefile +++ b/tables/Makefile @@ -13,7 +13,7 @@ TABLE_C_TEMPLATES := $(wildcard $(TEMPLATE_FOLDER)/c/*.table.template) TABLE_C_GENERATED := $(TABLE_C_TEMPLATES:$(TEMPLATE_FOLDER)/c/%.table.template=../include/generated/%.h) TABLE_CPLUSPLUS_TEMPLATES := $(wildcard $(TEMPLATE_FOLDER)/cplusplus/*.table.template) -TABLE_CPLUSPLUS_GENERATES := $(TABLE_CPLUSPLUS_TEMPLATES:$(TEMPLATE_FOLDER)/cplusplus/%.table.template=../cplusplus/include/generated/%.hpp) +TABLE_CPLUSPLUS_GENERATED := $(TABLE_CPLUSPLUS_TEMPLATES:$(TEMPLATE_FOLDER)/cplusplus/%.table.template=../cplusplus/include/generated/%.hpp) TABLE_RS_TEMPLATES := $(wildcard $(TEMPLATE_FOLDER)/rust/*.tablers.template) TABLE_RS_GENERATED := $(TABLE_RS_TEMPLATES:$(TEMPLATE_FOLDER)/rust/%.tablers.template=../rust/src/%.rs) @@ -22,20 +22,20 @@ TABLE_PYI_TEMPLATES := $(wildcard $(TEMPLATE_FOLDER)/python/*.tablepyi.t TABLE_PYI_GENERATED := $(TABLE_PYI_TEMPLATES:$(TEMPLATE_FOLDER)/python/%.tablepyi.template=../rabbitizer/%.pyi) -TABLE_DEP_FILES += $(TABLE_C_TEMPLATES:%.template=%.d) -TABLE_DEP_FILES += $(TABLE_CPLUSPLUS_TEMPLATES:%.template=%.d) +TABLE_DEP_FILES += $(TABLE_C_GENERATED:%.h=%.d) +TABLE_DEP_FILES += $(TABLE_CPLUSPLUS_GENERATED:%.hpp=%.d) TABLE_DEP_FILES += $(TABLE_RS_TEMPLATES:%.template=%.d) TABLE_DEP_FILES += $(TABLE_PYI_TEMPLATES:%.template=%.d) all: tables -tables: $(TABLE_C_GENERATED) $(TABLE_CPLUSPLUS_GENERATES) $(TABLE_RS_GENERATED) $(TABLE_PYI_GENERATED) +tables: $(TABLE_C_GENERATED) $(TABLE_CPLUSPLUS_GENERATED) $(TABLE_RS_GENERATED) $(TABLE_PYI_GENERATED) cargo fmt clean: $(RM) -rf $(TABLE_C_GENERATED) - $(RM) -rf $(TABLE_CPLUSPLUS_GENERATES) + $(RM) -rf $(TABLE_CPLUSPLUS_GENERATED) $(RM) -rf $(TABLE_RS_GENERATED) $(RM) -rf $(TABLE_PYI_GENERATED) @@ -49,11 +49,11 @@ distclean: clean ../include/generated/%.h: $(TEMPLATE_FOLDER)/c/%.table.template - cpp -P $(IINC) -M -MM -MMD -MP -MT $@ -MF $(@:.table.h=.table.d) $< + cpp -P $(IINC) -M -MM -MMD -MP -MT $@ -MF $(@:.h=.d) $< $(C_TABLE_GEN) $< $@ $(@F) || rm -rf $@ ../cplusplus/include/generated/%.hpp: $(TEMPLATE_FOLDER)/cplusplus/%.table.template - cpp -P $(IINC) -M -MM -MMD -MP -MT $@ -MF $(@:.table.hpp=.table.d) $< + cpp -P $(IINC) -M -MM -MMD -MP -MT $@ -MF $(@:.hpp=.d) $< $(C_TABLE_GEN) $< $@ $(@F) || rm -rf $@ ../rust/src/%.rs: $(TEMPLATE_FOLDER)/rust/%.tablers.template diff --git a/tables/tables/registers/RabbitizerRegister_R5900VF.inc b/tables/tables/registers/RabbitizerRegister_R5900VF.inc index 585f4ac9..0ccb305a 100644 --- a/tables/tables/registers/RabbitizerRegister_R5900VF.inc +++ b/tables/tables/registers/RabbitizerRegister_R5900VF.inc @@ -2,130 +2,130 @@ /* SPDX-License-Identifier: MIT */ RABBITIZER_DEF_REG( - R5900_VF, vf0, 0, + R5900_VF, vf0, vf0, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf1, 1, + R5900_VF, vf1, vf1, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf2, 2, + R5900_VF, vf2, vf2, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf3, 3, + R5900_VF, vf3, vf3, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf4, 4, + R5900_VF, vf4, vf4, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf5, 5, + R5900_VF, vf5, vf5, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf6, 6, + R5900_VF, vf6, vf6, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf7, 7, + R5900_VF, vf7, vf7, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf8, 8, + R5900_VF, vf8, vf8, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf9, 9, + R5900_VF, vf9, vf9, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf10, 10, + R5900_VF, vf10, vf10, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf11, 11, + R5900_VF, vf11, vf11, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf12, 12, + R5900_VF, vf12, vf12, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf13, 13, + R5900_VF, vf13, vf13, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf14, 14, + R5900_VF, vf14, vf14, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf15, 15, + R5900_VF, vf15, vf15, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf16, 16, + R5900_VF, vf16, vf16, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf17, 17, + R5900_VF, vf17, vf17, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf18, 18, + R5900_VF, vf18, vf18, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf19, 19, + R5900_VF, vf19, vf19, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf20, 20, + R5900_VF, vf20, vf20, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf21, 21, + R5900_VF, vf21, vf21, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf22, 22, + R5900_VF, vf22, vf22, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf23, 23, + R5900_VF, vf23, vf23, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf24, 24, + R5900_VF, vf24, vf24, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf25, 25, + R5900_VF, vf25, vf25, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf26, 26, + R5900_VF, vf26, vf26, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf27, 27, + R5900_VF, vf27, vf27, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf28, 28, + R5900_VF, vf28, vf28, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf29, 29, + R5900_VF, vf29, vf29, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf30, 30, + R5900_VF, vf30, vf30, 0 ) RABBITIZER_DEF_REG( - R5900_VF, vf31, 31, + R5900_VF, vf31, vf31, 0 ) diff --git a/tests/asm/r3000gte/gte_instrs.s b/tests/asm/r3000gte/gte_instrs.s index 94efe19e..2b405de3 100644 --- a/tests/asm/r3000gte/gte_instrs.s +++ b/tests/asm/r3000gte/gte_instrs.s @@ -3,6 +3,59 @@ .section .text .global gte_rtps_b +gte_rtps_b: RTPS jr $ra nop + +.global gte_macros +gte_macros: + rtv0 + rtv1 + rtv2 + rtir12 + rtir0 + rtv0tr + rtv1tr + rtv2tr + rtirtr + rtv0bk + rtv1bk + rtv2bk + rtirbk + ll + llv0 + llv1 + llv2 + llvir + llv0tr + llv1tr + llv2tr + llirtr + llv0bk + llv1bk + llv2bk + llirbk + lc + lcv0 + lcv1 + lcv2 + lcvir + lcv0tr + lcv1tr + lcv2tr + lcirtr + lev0bk + lev1bk + lev2bk + leirbk + # sqr12 + sqr0 + op12 + op0 + gpf12 + gpf0 + gpl12 + gpl0 + jr $ra + nop