.global microcodeconstructor microcodeconstructor : //$a0 = Pointer to free gfx array (GListP) // gDPPipeSync() /* 0E18C8 7F0ACD98 00801025 */ or $v0, $a0, $zero //$v0 = $a0 //$a0 must = 0 since it doesnt affect next command /* 0E18CC 7F0ACD9C 24840008 */ addiu $a0, $a0, 8 //$a0 += 8 //= 8 this is a counter to offset the GFX array (64bit cmds = +8Bytes) /* 0E18D0 7F0ACDA0 3C0EE700 */ lui $t6, 0xe700 //$v0 = . //$v0 = RCP Vector Register, so its not a variable but somewhere /* 0E18D4 7F0ACDA4 AC4E0000 */ sw $t6, ($v0) // . //to send the command and execute. /* 0E18D8 7F0ACDA8 AC400004 */ sw $zero, 4($v0) // gDPPipeSync() // gDPSetCycleType(G_CYC_1CYCLE) /* 0E18DC 7F0ACDAC 00801825 */ or $v1, $a0, $zero //$v1 = $a0 /* 0E18E0 7F0ACDB0 24840008 */ addiu $a0, $a0, 8 //$a0 += 8 //16 GListP++ /* 0E18E4 7F0ACDB4 3C0FBA00 */ lui $t7, 0xba00 //$t7 = //ORI behaves like LI, it Or's Lowerhalf, in essence its a load /* 0E18E8 7F0ACDB8 35EF1402 */ ori $t7, $t7, 0x1402 // BA00 1402 //BA00 + (0000 or 1402) /* 0E18EC 7F0ACDBC 00802825 */ or $a1, $a0, $zero //$a1 = 16 //never used? overwritten /* 0E18F0 7F0ACDC0 AC6F0000 */ sw $t7, ($v1) //$v1 = . /* 0E18F4 7F0ACDC4 AC600004 */ sw $zero, 4($v1) // gDPSetCycleType(G_CYC_1CYCLE) // gDPSetColorDither(G_CD_MAGICSQ) /* 0E18F8 7F0ACDC8 24840008 */ addiu $a0, $a0, 8 //$a0 += 8 //24 /* 0E18FC 7F0ACDCC 3C18BA00 */ lui $t8, 0xba00 //$t8 = . /* 0E1900 7F0ACDD0 37180602 */ ori $t8, $t8, 0x602 // ba000602 /* 0E1904 7F0ACDD4 241900C0 */ addiu $t9, $zero, 0xc0 //$t9 = 00c00000 /* 0E1908 7F0ACDD8 00803025 */ or $a2, $a0, $zero //$a2 = 24 /* 0E190C 7F0ACDDC ACB90004 */ sw $t9, 4($a1) //$a1 = . /* 0E1910 7F0ACDE0 ACB80000 */ sw $t8, ($a1) // gDPSetColorDither(G_CD_MAGICSQ) // gDPSetRenderMode(G_RM_AA_OPA_Surf) /* 0E1914 7F0ACDE4 24840008 */ addiu $a0, $a0, 8 //$a0 += 8 //32 /* 0E1918 7F0ACDE8 3C08B900 */ lui $t0, 0xb900 //$a2 = . /* 0E191C 7F0ACDEC 3C090050 */ lui $t1, 0x50 // . /* 0E1920 7F0ACDF0 352941C8 */ ori $t1, $t1, 0x41c8 // . /* 0E1924 7F0ACDF4 3508031D */ ori $t0, $t0, 0x31d // . //This is all building the final command /* 0E1928 7F0ACDF8 00803825 */ or $a3, $a0, $zero //serves no purpose? overwritten next command /* 0E192C 7F0ACDFC ACC80000 */ sw $t0, ($a2) // . /* 0E1930 7F0ACE00 ACC90004 */ sw $t1, 4($a2) // gDPSetRenderMode(G_RM_AA_OPA_Surf) //1 cycle normal surface // gDPSetCombineMode(MODURATERGB_PRIM) /* 0E1934 7F0ACE04 3C0AFCFF */ lui $t2, 0xfcff //$a3 = . /* 0E1938 7F0ACE08 3C0BFF2D */ lui $t3, 0xff2d // . /* 0E193C 7F0ACE0C 356BFEFF */ ori $t3, $t3, 0xfeff // . /* 0E1940 7F0ACE10 354A97FF */ ori $t2, $t2, 0x97ff // . /* 0E1944 7F0ACE14 24840008 */ addiu $a0, $a0, 8 //$a0 += 8 //40 /* 0E1948 7F0ACE18 ACEA0000 */ sw $t2, ($a3) //$a3 = . /* 0E194C 7F0ACE1C ACEB0004 */ sw $t3, 4($a3) // gDPSetCombineMode(MODURATERGB_PRIM) //CC1/2=(tex0 - 0)*Primitive + 0 // gDPSetTexturePersp(G_TP_NONE) /* 0E1950 7F0ACE20 00801025 */ or $v0, $a0, $zero //$v0 = $a0 //40 /* 0E1954 7F0ACE24 24840008 */ addiu $a0, $a0, 8 //$a0 = 48 /* 0E1958 7F0ACE28 3C0CBA00 */ lui $t4, 0xba00 //$v0 = . /* 0E195C 7F0ACE2C 358C1301 */ ori $t4, $t4, 0x1301 // . /* 0E1960 7F0ACE30 00801825 */ or $v1, $a0, $zero // . /* 0E1964 7F0ACE34 AC4C0000 */ sw $t4, ($v0) // . /* 0E1968 7F0ACE38 AC400004 */ sw $zero, 4($v0) // gDPSetTexturePersp(G_TP_NONE) // gDPSetAlphaCompare(None) /* 0E196C 7F0ACE3C 24840008 */ addiu $a0, $a0, 8 //$a0 = 56 /* 0E1970 7F0ACE40 3C0DB900 */ lui $t5, 0xb900 //$v1 = . /* 0E1974 7F0ACE44 35AD0002 */ ori $t5, $t5, 2 // . /* 0E1978 7F0ACE48 00802825 */ or $a1, $a0, $zero //$a1 = 56 /* 0E197C 7F0ACE4C AC6D0000 */ sw $t5, ($v1) // . /* 0E1980 7F0ACE50 AC600004 */ sw $zero, 4($v1) // gDPSetAlphaCompare(None) // gsDPSetTextureLOD(G_TL_TILE) /* 0E1984 7F0ACE54 24840008 */ addiu $a0, $a0, 8 //$a0 = 64 /* 0E1988 7F0ACE58 3C0EBA00 */ lui $t6, 0xba00 //$a1 = . /* 0E198C 7F0ACE5C 35CE1001 */ ori $t6, $t6, 0x1001 // . /* 0E1990 7F0ACE60 00803025 */ or $a2, $a0, $zero //$a2 = 64 /* 0E1994 7F0ACE64 ACAE0000 */ sw $t6, ($a1) // . /* 0E1998 7F0ACE68 ACA00004 */ sw $zero, 4($a1) // gsDPSetTextureLOD(G_TL_TILE) // gDPSetTextureConvert(G_TC_FILT) /* 0E199C 7F0ACE6C 3C0FBA00 */ lui $t7, 0xba00 //$a2 = . /* 0E19A0 7F0ACE70 35EF0903 */ ori $t7, $t7, 0x903 // . /* 0E19A4 7F0ACE74 24840008 */ addiu $a0, $a0, 8 //$a0 = 72 /* 0E19A8 7F0ACE78 24180C00 */ addiu $t8, $zero, 0xc00 // . //ba000903 0000+0c00 //dont mix order /* 0E19AC 7F0ACE7C ACD80004 */ sw $t8, 4($a2) // . /* 0E19B0 7F0ACE80 ACCF0000 */ sw $t7, ($a2) // gDPSetTextureConvert(G_TC_FILT) // gDPSetTextureLUT(G_TT_NONE) /* 0E19B4 7F0ACE84 00803825 */ or $a3, $a0, $zero //$a3 = 72 /* 0E19B8 7F0ACE88 3C19BA00 */ lui $t9, 0xba00 //$a3 = . /* 0E19BC 7F0ACE8C 37390E02 */ ori $t9, $t9, 0xe02 // . /* 0E19C0 7F0ACE90 ACF90000 */ sw $t9, ($a3) // . /* 0E19C4 7F0ACE94 ACE00004 */ sw $zero, 4($a3) // gDPSetTextureLUT(G_TT_NONE) //IF WantBiLinearFilter /* 0E19C8 7F0ACE98 3C088004 */ lui $t0, 0x8004 //$t0 = . /* 0E19CC 7F0ACE9C 8D080E94 */ lw $t0, 0xe94($t0) // content of 80040e94 /* 0E19D0 7F0ACEA0 24840008 */ addiu $a0, $a0, 8 //$a0 = 80 /* 0E19D4 7F0ACEA4 00801025 */ or $v0, $a0, $zero //$v0 = 80 /* 0E19D8 7F0ACEA8 1100000A */ beqz $t0, .Lmicrocodeconstructor_13C //IF (content of 80040e94) == 0 goto /* 0E19DC 7F0ACEAC 3C0BBA00 */ lui $t3, 0xba00 // this is executed before .Lmicrocodeconstructor_13C AKA Delayed Load Instruction // gDPSetTextureFilter(G_TF_AVERAGE): /* 0E19E0 7F0ACEB0 00801025 */ or $v0, $a0, $zero //$v0 = 80 //if not == 0 stay here /* 0E19E4 7F0ACEB4 3C09BA00 */ lui $t1, 0xba00 //$v0 = . /* 0E19E8 7F0ACEB8 35290C02 */ ori $t1, $t1, 0xc02 // . /* 0E19EC 7F0ACEBC 240A3000 */ addiu $t2, $zero, 0x3000// .ba000c02 0000+3000 /* 0E19F0 7F0ACEC0 AC4A0004 */ sw $t2, 4($v0) // . /* 0E19F4 7F0ACEC4 AC490000 */ sw $t1, ($v0) // gDPSetTextureFilter(G_TF_AVERAGE) /* 0E19F8 7F0ACEC8 24840008 */ addiu $a0, $a0, 8 //$a0 = 88 // return /* 0E19FC 7F0ACECC 03E00008 */ jr $ra // return to caller $ra used by JAL /* 0E1A00 7F0ACED0 00801025 */ or $v0, $a0, $zero //$v0 = final GFX Array Position // before jump .Lmicrocodeconstructor_13C: // effectivly began with setting $t3 = ba00 /* 0E1A04 7F0ACED4 356B0C02 */ ori $t3, $t3, 0xc02 //$v0 = . /* 0E1A08 7F0ACED8 240C2000 */ addiu $t4, $zero, 0x2000// . ba000c02 00002000 /* 0E1A0C 7F0ACEDC AC4C0004 */ sw $t4, 4($v0) // . /* 0E1A10 7F0ACEE0 AC4B0000 */ sw $t3, ($v0) // gDPSetTextureFilter(G_TF_BILERP) /* 0E1A14 7F0ACEE4 24840008 */ addiu $a0, $a0, 8 //$a0 = 88 /* 0E1A18 7F0ACEE8 03E00008 */ jr $ra // return to caller /* 0E1A1C 7F0ACEEC 00801025 */ or $v0, $a0, $zero // $v0 = final GFX Array Position # end microcodeconstructor .global proc_7F0ACEF0 proc_7F0ACEF0: combiner: bayer, lod, perspective accepts: A0=@output display list returns: V0=final DL address // gDPPipeSync() /* 0E1A20 7F0ACEF0 24850008 */ addiu $a1, $a0, 8 //GListP++ /* 0E1A24 7F0ACEF4 3C0EE700 */ lui $t6, 0xe700 /* 0E1A28 7F0ACEF8 AC8E0000 */ sw $t6, ($a0) /* 0E1A2C 7F0ACEFC AC800004 */ sw $zero, 4($a0) // gDPPipeSync() // gDPSetColorDither(G_CD_BAYER) /* 0E1A30 7F0ACF00 3C0FBA00 */ lui $t7, 0xba00 /* 0E1A34 7F0ACF04 35EF0602 */ ori $t7, $t7, 0x602 /* 0E1A38 7F0ACF08 24A60008 */ addiu $a2, $a1, 8 //GListP++ /* 0E1A3C 7F0ACF0C 24180040 */ addiu $t8, $zero, 0x40 /* 0E1A40 7F0ACF10 ACB80004 */ sw $t8, 4($a1) /* 0E1A44 7F0ACF14 ACAF0000 */ sw $t7, ($a1) // gDPSetColorDither(G_CD_BAYER) // gDPSetTexturePersp(G_TP_PERSP), gsDPSetTextureLOD(G_TL_LOD) /* 0E1A48 7F0ACF18 3C19BA00 */ lui $t9, 0xba00 /* 0E1A4C 7F0ACF1C 37391301 */ ori $t9, $t9, 0x1301 /* 0E1A50 7F0ACF20 24C70008 */ addiu $a3, $a2, 8 /* 0E1A54 7F0ACF24 3C080008 */ lui $t0, 8 /* 0E1A58 7F0ACF28 3C09BA00 */ lui $t1, 0xba00 /* 0E1A5C 7F0ACF2C ACC80004 */ sw $t0, 4($a2) /* 0E1A60 7F0ACF30 ACD90000 */ sw $t9, ($a2) // gDPSetTexturePersp(G_TP_PERSP) /* 0E1A64 7F0ACF34 35291001 */ ori $t1, $t1, 0x1001 /* 0E1A68 7F0ACF38 3C0A0001 */ lui $t2, 1 /* 0E1A6C 7F0ACF3C ACEA0004 */ sw $t2, 4($a3) /* 0E1A70 7F0ACF40 ACE90000 */ sw $t1, ($a3) // gsDPSetTextureLOD(G_TL_LOD) //return GlistP /* 0E1A74 7F0ACF44 03E00008 */ jr $ra /* 0E1A78 7F0ACF48 24E20008 */ addiu $v0, $a3, 8 # end proc_7F0ACEF0 === C Code === // microcodeconstructor, possible better name : Font_Setup_RDPState //Gfx setup_rdpstate[] = { <-- This cannot be an array, must be function since dynamic - Revised void Font_Setup_RDPState(bool WantBiLinearFilter, glist glistp) { /* Set start address of display list */ // glistp = glist; already passed as argument /* Initialize RCP */ /* Hand KSEG0 address to RSP */ gSPSegment(glistp++, 0, 0); //The following section should have been a 'static Gfx setup_rdpstate[] = {' since the only variable is filter /* * This RDP initialization sequence will setup the following modes * * 1 cycle mode, smooth sampled textures, non-zbuffer, Anti-Ailised * opaque polygons using Primitive Colour blending. */ gDPPipeSync(glistp++); gDPSetCycleType(glistp++, G_CYC_1CYCLE); gDPSetColorDither(glistp++, G_CD_MAGICSQ); gDPSetRenderMode(glistp++, G_RM_AA_OPA_Surf); //1 cycle normal surface gDPSetCombineMode(glistp++, MODURATERGB_PRIM); //CC1/2=(tex0 - 0)*Primitive + 0 gDPSetTexturePersp(glistp++, G_TP_NONE); gDPSetAlphaCompare(glistp++, None); gsDPSetTextureLOD(glistp++, G_TL_TILE); gDPSetTextureConvert(glistp++, G_TC_FILT); gDPSetTextureLUT(glistp++, G_TT_NONE); // end should have been static if !(WantBiLinearFilter) { gDPSetTextureFilter(glistp++,G_TF_AVERAGE); } else { gDPSetTextureFilter(glistp++,G_TF_BILERP); } /*Also more proof of not static is lack of EndDL command, however it means this list is called by another routine * such as * DrawText() * { * Font_Setup_RDPState(true, glistp); */ /* To update this function to use static setup we simply extract the bulk gfx commands and place them in a static array then we call it as any other dlist ... glistp = glist; gSPSegment(glistp++,0,0); gSPDisplayList(glistp++, TextSetup_dl) if (wantBiLinearFilter){gDPSetTextureFilter(glistp++,G_TF_BILERP);} else {gDPSetTextureFilter(glistp++,G_TF_AVERAGE);} ... */ } //possibly a standard RDP State setup since using LOD void NeedNameForRDPModeType(glist glistp) { gDPPipeSync(glistp++); gDPSetColorDither(glistp++, G_CD_BAYER); gDPSetTexturePersp(glistp++, G_TP_PERSP); gsDPSetTextureLOD(glistp++, G_TL_LOD); }