Glide Plugin GLES2 port from mupen64plus-ae, but with special FrameSkip code
[mupen64plus-pandora.git] / source / gles2glide64 / src / Glide64 / ucode.h
1 /*
2 * Glide64 - Glide video plugin for Nintendo 64 emulators.
3 * Copyright (c) 2002  Dave2001
4 * Copyright (c) 2003-2009  Sergey 'Gonetz' Lipski
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 //****************************************************************
22 //
23 // Glide64 - Glide Plugin for Nintendo 64 emulators
24 // Project started on December 29th, 2001
25 //
26 // Authors:
27 // Dave2001, original author, founded the project in 2001, left it in 2002
28 // Gugaman, joined the project in 2002, left it in 2002
29 // Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
30 // Hiroshi 'KoolSmoky' Morii, joined the project in 2007
31 //
32 //****************************************************************
33 //
34 // To modify Glide64:
35 // * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
36 // * Do NOT send me the whole project or file that you modified.  Take out your modified code sections, and tell me where to put them.  If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
37 //
38 //****************************************************************
39
40 typedef void (*rdp_instr)();
41
42 // RDP graphic instructions pointer table
43
44 static rdp_instr gfx_instruction[10][256] =
45 {
46     {
47         // uCode 0 - RSP SW 2.0X
48         // 00-3f
49         // games: Super Mario 64, Tetrisphere, Demos
50         spnoop,                     uc0_matrix,             rsp_reserved0,              uc0_movemem,
51         uc0_vertex,             rsp_reserved1,              uc0_displaylist,        rsp_reserved2,
52         rsp_reserved3,              uc6_sprite2d,           undef,                      undef,
53         undef,                      undef,                      undef,                      undef,        
54         undef,                      undef,                      undef,                      undef,        
55         undef,                      undef,                      undef,                      undef,        
56         undef,                      undef,                      undef,                      undef,        
57         undef,                      undef,                      undef,                      undef,        
58         undef,                      undef,                      undef,                      undef,        
59         undef,                      undef,                      undef,                      undef,        
60         undef,                      undef,                      undef,                      undef,        
61         undef,                      undef,                      undef,                      undef,        
62         undef,                      undef,                      undef,                      undef,        
63         undef,                      undef,                      undef,                      undef,        
64         undef,                      undef,                      undef,                      undef,        
65         undef,                      undef,                      undef,                      undef,        
66           // 40-7f: Unused
67         undef,                      undef,                      undef,                      undef,        
68         undef,                      undef,                      undef,                      undef,        
69         undef,                      undef,                      undef,                      undef,        
70         undef,                      undef,                      undef,                      undef,        
71         undef,                      undef,                      undef,                      undef,        
72         undef,                      undef,                      undef,                      undef,        
73         undef,                      undef,                      undef,                      undef,        
74         undef,                      undef,                      undef,                      undef,        
75         undef,                      undef,                      undef,                      undef,        
76         undef,                      undef,                      undef,                      undef,        
77         undef,                      undef,                      undef,                      undef,        
78         undef,                      undef,                      undef,                      undef,        
79         undef,                      undef,                      undef,                      undef,        
80         undef,                      undef,                      undef,                      undef,        
81         undef,                      undef,                      undef,                      undef,        
82         undef,                      undef,                      undef,                      undef,        
83           // 80-bf: Immediate commands
84         undef,                      undef,                      undef,                      undef,        
85         undef,                      undef,                      undef,                      undef,        
86         undef,                      undef,                      undef,                      undef,        
87         undef,                      undef,                      undef,                      undef,        
88         undef,                      undef,                      undef,                      undef,        
89         undef,                      undef,                      undef,                      undef,        
90         undef,                      undef,                      undef,                      undef,        
91         undef,                      undef,                      undef,                      undef,        
92         undef,                      undef,                      undef,                      undef,        
93         undef,                      undef,                      undef,                      undef,        
94         undef,                      undef,                      undef,                      undef,        
95         undef,                      undef,                      undef,                      undef,        
96         undef,                      uc0_tri4,           rdphalf_cont,           rdphalf_2,
97         rdphalf_1,              uc0_line3d,             uc0_cleargeometrymode,  uc0_setgeometrymode,
98         uc0_enddl,              uc0_setothermode_l,     uc0_setothermode_h,     uc0_texture,
99         uc0_moveword,           uc0_popmatrix,          uc0_culldl,             uc0_tri1,
100           // c0-ff: RDP commands
101         rdp_noop,               undef,                  undef,                  undef,    
102         undef,                  undef,                  undef,                  undef,    
103         rdp_trifill,            rdp_trifillz,           rdp_tritxtr,            rdp_tritxtrz,
104         rdp_trishade,           rdp_trishadez,          rdp_trishadetxtr,       rdp_trishadetxtrz,
105         undef,                  undef,                  undef,                  undef,    
106         undef,                  undef,                  undef,                  undef,    
107         undef,                  undef,                  undef,                  undef,    
108         undef,                  undef,                  undef,                  undef,    
109         undef,                  undef,                  undef,                  undef,    
110         rdp_texrect,                    rdp_texrect,                rdp_loadsync,           rdp_pipesync,
111         rdp_tilesync,           rdp_fullsync,           rdp_setkeygb,           rdp_setkeyr,
112         rdp_setconvert,         rdp_setscissor,         rdp_setprimdepth,       rdp_setothermode,
113         rdp_loadtlut,           undef,                  rdp_settilesize,        rdp_loadblock,
114         rdp_loadtile,           rdp_settile,            rdp_fillrect,           rdp_setfillcolor,
115         rdp_setfogcolor,        rdp_setblendcolor,      rdp_setprimcolor,       rdp_setenvcolor,
116         rdp_setcombine,         rdp_settextureimage,    rdp_setdepthimage,      rdp_setcolorimage
117         },
118
119         // uCode 1 - F3DEX 1.XX
120         // 00-3f
121         // games: Mario Kart, Star Fox
122         {
123         spnoop,                     uc0_matrix,             rsp_reserved0,              uc0_movemem,
124         uc1_vertex,             rsp_reserved1,              uc0_displaylist,        rsp_reserved2,
125         rsp_reserved3,              uc6_sprite2d,           undef,                      undef,
126         undef,                      undef,                      undef,                      undef,        
127         undef,                      undef,                      undef,                      undef,        
128         undef,                      undef,                      undef,                      undef,        
129         undef,                      undef,                      undef,                      undef,        
130         undef,                      undef,                      undef,                      undef,        
131         undef,                      undef,                      undef,                      undef,        
132         undef,                      undef,                      undef,                      undef,        
133         undef,                      undef,                      undef,                      undef,        
134         undef,                      undef,                      undef,                      undef,        
135         undef,                      undef,                      undef,                      undef,        
136         undef,                      undef,                      undef,                      undef,        
137         undef,                      undef,                      undef,                      undef,        
138         undef,                      undef,                      undef,                      undef,        
139       // 40-7f: unused
140         undef,                      undef,                      undef,                      undef,        
141         undef,                      undef,                      undef,                      undef,        
142         undef,                      undef,                      undef,                      undef,        
143         undef,                      undef,                      undef,                      undef,        
144         undef,                      undef,                      undef,                      undef,        
145         undef,                      undef,                      undef,                      undef,        
146         undef,                      undef,                      undef,                      undef,        
147         undef,                      undef,                      undef,                      undef,        
148         undef,                      undef,                      undef,                      undef,        
149         undef,                      undef,                      undef,                      undef,        
150         undef,                      undef,                      undef,                      undef,        
151         undef,                      undef,                      undef,                      undef,        
152         undef,                      undef,                      undef,                      undef,        
153         undef,                      undef,                      undef,                      undef,        
154         undef,                      undef,                      undef,                      undef,        
155         undef,                      undef,                      undef,                      undef,        
156       // 80-bf: Immediate commands
157         undef,                      undef,                      undef,                      undef,        
158         undef,                      undef,                      undef,                      undef,        
159         undef,                      undef,                      undef,                      undef,        
160         undef,                      undef,                      undef,                      undef,        
161         undef,                      undef,                      undef,                      undef,        
162         undef,                      undef,                      undef,                      undef,        
163         undef,                      undef,                      undef,                      undef,        
164         undef,                      undef,                      undef,                      undef,        
165         undef,                      undef,                      undef,                      undef,        
166         undef,                      undef,                      undef,                      undef,        
167         undef,                      undef,                      undef,                      undef,        
168         undef,                      undef,                      undef,                      uc6_loaducode,        
169         uc1_branch_z,           uc1_tri2,               uc2_modifyvtx,             rdphalf_2,
170         uc1_rdphalf_1,          uc1_line3d,             uc0_cleargeometrymode,  uc0_setgeometrymode,
171         uc0_enddl,              uc0_setothermode_l,     uc0_setothermode_h,     uc0_texture,
172         uc0_moveword,           uc0_popmatrix,          uc2_culldl,             uc1_tri1,
173       // c0-ff: RDP commands
174         rdp_noop,               undef,                  undef,                  undef,    
175         undef,                  undef,                  undef,                  undef,    
176         rdp_trifill,            rdp_trifillz,           rdp_tritxtr,            rdp_tritxtrz,
177         rdp_trishade,           rdp_trishadez,          rdp_trishadetxtr,       rdp_trishadetxtrz,
178         undef,                  undef,                  undef,                  undef,    
179         undef,                  undef,                  undef,                  undef,    
180         undef,                  undef,                  undef,                  undef,    
181         undef,                  undef,                  undef,                  undef,    
182         undef,                  undef,                  undef,                  undef,    
183         rdp_texrect,            rdp_texrect,            rdp_loadsync,           rdp_pipesync,
184         rdp_tilesync,           rdp_fullsync,           rdp_setkeygb,           rdp_setkeyr,
185         rdp_setconvert,         rdp_setscissor,         rdp_setprimdepth,       rdp_setothermode,
186         rdp_loadtlut,           undef,                  rdp_settilesize,        rdp_loadblock,
187         rdp_loadtile,           rdp_settile,            rdp_fillrect,           rdp_setfillcolor,
188         rdp_setfogcolor,        rdp_setblendcolor,      rdp_setprimcolor,       rdp_setenvcolor,
189         rdp_setcombine,         rdp_settextureimage,    rdp_setdepthimage,      rdp_setcolorimage
190     },
191
192         // uCode 2 - F3DEX 2.XX
193         // games: Zelda 64
194         {
195                 // 00-3f
196                 spnoop,                                 uc2_vertex,                             uc2_modifyvtx,                  uc2_culldl,
197                 uc1_branch_z,                   uc2_tri1,                               uc2_quad,                           uc2_quad,
198                 uc2_line3d,                             uc6_bg_1cyc,                    uc6_bg_copy,                    uc6_obj_rendermode/*undef*/,
199                 undef,                                  undef,                                  undef,                                  undef,
200                 uc0_tri4,                               uc0_tri4,                               uc0_tri4,                               uc0_tri4,
201                 uc0_tri4,                               uc0_tri4,                               uc0_tri4,                               uc0_tri4,
202                 uc0_tri4,                               uc0_tri4,                               uc0_tri4,                               uc0_tri4,
203                 uc0_tri4,                               uc0_tri4,                               uc0_tri4,                               uc0_tri4,
204                 undef,                                  undef,                                  undef,                                  undef,
205                 undef,                                  undef,                                  undef,                                  undef,
206                 undef,                                  undef,                                  undef,                                  undef,
207                 undef,                                  undef,                                  undef,                                  undef,
208                 undef,                                  undef,                                  undef,                                  undef,
209                 undef,                                  undef,                                  undef,                                  undef,
210                 undef,                                  undef,                                  undef,                                  undef,
211                 undef,                                  undef,                                  undef,                                  undef,
212
213                 // 40-7f: unused
214                 undef,                                  undef,                                  undef,                                  undef,
215                 undef,                                  undef,                                  undef,                                  undef,
216                 undef,                                  undef,                                  undef,                                  undef,
217                 undef,                                  undef,                                  undef,                                  undef,
218                 undef,                                  undef,                                  undef,                                  undef,
219                 undef,                                  undef,                                  undef,                                  undef,
220                 undef,                                  undef,                                  undef,                                  undef,
221                 undef,                                  undef,                                  undef,                                  undef,
222                 undef,                                  undef,                                  undef,                                  undef,
223                 undef,                                  undef,                                  undef,                                  undef,
224                 undef,                                  undef,                                  undef,                                  undef,
225                 undef,                                  undef,                                  undef,                                  undef,
226                 undef,                                  undef,                                  undef,                                  undef,
227                 undef,                                  undef,                                  undef,                                  undef,
228                 undef,                                  undef,                                  undef,                                  undef,
229                 undef,                                  undef,                                  undef,                                  undef,
230
231                 // 80-bf: unused
232                 undef,                                  undef,                                  undef,                                  undef,
233                 undef,                                  undef,                                  undef,                                  undef,
234                 undef,                                  undef,                                  undef,                                  undef,
235                 undef,                                  undef,                                  undef,                                  undef,
236                 undef,                                  undef,                                  undef,                                  undef,
237                 undef,                                  undef,                                  undef,                                  undef,
238                 undef,                                  undef,                                  undef,                                  undef,
239                 undef,                                  undef,                                  undef,                                  undef,
240                 undef,                                  undef,                                  undef,                                  undef,
241                 undef,                                  undef,                                  undef,                                  undef,
242                 undef,                                  undef,                                  undef,                                  undef,
243                 undef,                                  undef,                                  undef,                                  undef,
244                 undef,                                  undef,                                  undef,                                  undef,
245                 undef,                                  undef,                                  undef,                                  undef,
246                 undef,                                  undef,                                  undef,                                  undef,
247                 undef,                                  undef,                                  undef,                                  undef,
248
249                 // c0-ff: RDP commands mixed with uc2 commands
250                rdp_noop,               undef,                  undef,                  undef,    
251                undef,                  undef,                  undef,                  undef,    
252                rdp_trifill,            rdp_trifillz,           rdp_tritxtr,            rdp_tritxtrz,
253                rdp_trishade,           rdp_trishadez,          rdp_trishadetxtr,       rdp_trishadetxtrz,
254                undef,                  undef,                  undef,                  uc2_special3,
255                uc2_special2,           uc2_dlist_cnt,          uc2_dma_io,             uc0_texture,
256                uc2_pop_matrix,         uc2_geom_mode,          uc2_matrix,             uc2_moveword,
257                uc2_movemem,            uc2_load_ucode,         uc0_displaylist,        uc0_enddl,
258                spnoop,                 uc1_rdphalf_1,          uc0_setothermode_l,     uc0_setothermode_h,
259                rdp_texrect,            rdp_texrect,            rdp_loadsync,           rdp_pipesync,
260                rdp_tilesync,           rdp_fullsync,           rdp_setkeygb,           rdp_setkeyr,
261                rdp_setconvert,         rdp_setscissor,         rdp_setprimdepth,       rdp_setothermode,
262                rdp_loadtlut,           uc2_rdphalf_2,          rdp_settilesize,        rdp_loadblock,
263                rdp_loadtile,           rdp_settile,            rdp_fillrect,           rdp_setfillcolor,
264                rdp_setfogcolor,        rdp_setblendcolor,      rdp_setprimcolor,       rdp_setenvcolor,
265                rdp_setcombine,         rdp_settextureimage,    rdp_setdepthimage,      rdp_setcolorimage
266         },
267
268         // uCode 3 - "RSP SW 2.0D", but not really
269         // 00-3f
270         // games: Wave Race
271         // ** Added by Gonetz **
272         {
273                 spnoop,                                 uc0_matrix,             rsp_reserved0,              uc0_movemem,
274                 uc3_vertex,                             rsp_reserved1,              uc0_displaylist,        rsp_reserved2,
275                 rsp_reserved3,              uc6_sprite2d,           undef,                      undef,
276                 undef,                      undef,                      undef,                      undef,        
277                 undef,                      undef,                      undef,                      undef,        
278                 undef,                      undef,                      undef,                      undef,        
279                 undef,                      undef,                      undef,                      undef,        
280                 undef,                      undef,                      undef,                      undef,        
281                 undef,                      undef,                      undef,                      undef,        
282                 undef,                      undef,                      undef,                      undef,        
283                 undef,                      undef,                      undef,                      undef,        
284                 undef,                      undef,                      undef,                      undef,        
285                 undef,                      undef,                      undef,                      undef,        
286                 undef,                      undef,                      undef,                      undef,        
287                 undef,                      undef,                      undef,                      undef,        
288                 undef,                      undef,                      undef,                      undef,        
289           // 40-7f: unused
290                 undef,                      undef,                      undef,                      undef,        
291                 undef,                      undef,                      undef,                      undef,        
292                 undef,                      undef,                      undef,                      undef,        
293                 undef,                      undef,                      undef,                      undef,        
294                 undef,                      undef,                      undef,                      undef,        
295                 undef,                      undef,                      undef,                      undef,        
296                 undef,                      undef,                      undef,                      undef,        
297                 undef,                      undef,                      undef,                      undef,        
298                 undef,                      undef,                      undef,                      undef,        
299                 undef,                      undef,                      undef,                      undef,        
300                 undef,                      undef,                      undef,                      undef,        
301                 undef,                      undef,                      undef,                      undef,        
302                 undef,                      undef,                      undef,                      undef,        
303                 undef,                      undef,                      undef,                      undef,        
304                 undef,                      undef,                      undef,                      undef,        
305                 undef,                      undef,                      undef,                      undef,        
306           // 80-bf: Immediate commands
307                 undef,                      undef,                      undef,                      undef,        
308                 undef,                      undef,                      undef,                      undef,        
309                 undef,                      undef,                      undef,                      undef,        
310                 undef,                      undef,                      undef,                      undef,        
311                 undef,                      undef,                      undef,                      undef,        
312                 undef,                      undef,                      undef,                      undef,        
313                 undef,                      undef,                      undef,                      undef,        
314                 undef,                      undef,                      undef,                      undef,        
315                 undef,                      undef,                      undef,                      undef,        
316                 undef,                      undef,                      undef,                      undef,        
317                 undef,                      undef,                      undef,                      undef,        
318                 undef,                      undef,                      undef,                      undef,        
319                 undef,                  uc3_tri2,               rdphalf_cont,       rdphalf_2,
320                 rdphalf_1,          uc3_quad3d,             uc0_cleargeometrymode,  uc0_setgeometrymode,
321                 uc0_enddl,              uc0_setothermode_l,     uc0_setothermode_h,     uc0_texture,
322                 uc0_moveword,           uc0_popmatrix,          uc0_culldl,             uc3_tri1,
323           // c0-ff: RDP commands
324                 rdp_noop,               undef,                  undef,                  undef,    
325                 undef,                  undef,                  undef,                  undef,    
326                 rdp_trifill,            rdp_trifillz,           rdp_tritxtr,            rdp_tritxtrz,
327                 rdp_trishade,           rdp_trishadez,          rdp_trishadetxtr,       rdp_trishadetxtrz,
328                 undef,                  undef,                  undef,                  undef,    
329                 undef,                  undef,                  undef,                  undef,    
330                 undef,                  undef,                  undef,                  undef,    
331                 undef,                  undef,                  undef,                  undef,    
332                 undef,                  undef,                  undef,                  undef,    
333                 rdp_texrect,            rdp_texrect,            rdp_loadsync,           rdp_pipesync,
334                 rdp_tilesync,           rdp_fullsync,           rdp_setkeygb,           rdp_setkeyr,
335                 rdp_setconvert,         rdp_setscissor,         rdp_setprimdepth,       rdp_setothermode,
336                 rdp_loadtlut,           undef,                  rdp_settilesize,        rdp_loadblock,
337                 rdp_loadtile,           rdp_settile,            rdp_fillrect,           rdp_setfillcolor,
338                 rdp_setfogcolor,        rdp_setblendcolor,      rdp_setprimcolor,       rdp_setenvcolor,
339                 rdp_setcombine,         rdp_settextureimage,    rdp_setdepthimage,      rdp_setcolorimage
340         },
341
342         {
343         // uCode 4 - RSP SW 2.0D EXT
344         // 00-3f
345         // games: Star Wars: Shadows of the Empire
346         spnoop,                     uc0_matrix,             rsp_reserved0,              uc0_movemem,
347         uc4_vertex,             rsp_reserved1,              uc0_displaylist,        rsp_reserved2,
348         rsp_reserved3,              uc6_sprite2d,           undef,                      undef,
349         undef,                      undef,                      undef,                      undef,        
350         undef,                      undef,                      undef,                      undef,        
351         undef,                      undef,                      undef,                      undef,        
352         undef,                      undef,                      undef,                      undef,        
353         undef,                      undef,                      undef,                      undef,        
354         undef,                      undef,                      undef,                      undef,        
355         undef,                      undef,                      undef,                      undef,        
356         undef,                      undef,                      undef,                      undef,        
357         undef,                      undef,                      undef,                      undef,        
358         undef,                      undef,                      undef,                      undef,        
359         undef,                      undef,                      undef,                      undef,        
360         undef,                      undef,                      undef,                      undef,        
361         undef,                      undef,                      undef,                      undef,        
362           // 40-7f: Unused
363         undef,                      undef,                      undef,                      undef,        
364         undef,                      undef,                      undef,                      undef,        
365         undef,                      undef,                      undef,                      undef,        
366         undef,                      undef,                      undef,                      undef,        
367         undef,                      undef,                      undef,                      undef,        
368         undef,                      undef,                      undef,                      undef,        
369         undef,                      undef,                      undef,                      undef,        
370         undef,                      undef,                      undef,                      undef,        
371         undef,                      undef,                      undef,                      undef,        
372         undef,                      undef,                      undef,                      undef,        
373         undef,                      undef,                      undef,                      undef,        
374         undef,                      undef,                      undef,                      undef,        
375         undef,                      undef,                      undef,                      undef,        
376         undef,                      undef,                      undef,                      undef,        
377         undef,                      undef,                      undef,                      undef,        
378         undef,                      undef,                      undef,                      undef,        
379           // 80-bf: Immediate commands
380         undef,                      undef,                      undef,                      undef,        
381         undef,                      undef,                      undef,                      undef,        
382         undef,                      undef,                      undef,                      undef,        
383         undef,                      undef,                      undef,                      undef,        
384         undef,                      undef,                      undef,                      undef,        
385         undef,                      undef,                      undef,                      undef,        
386         undef,                      undef,                      undef,                      undef,        
387         undef,                      undef,                      undef,                      undef,        
388         undef,                      undef,                      undef,                      undef,        
389         undef,                      undef,                      undef,                      undef,        
390         undef,                      undef,                      undef,                      undef,        
391         undef,                      undef,                      undef,                      undef,        
392         undef,                      uc0_tri4,                       rdphalf_cont,       rdphalf_2,
393         rdphalf_1,          uc4_quad3d,             uc0_cleargeometrymode,  uc0_setgeometrymode,
394         uc0_enddl,              uc0_setothermode_l,     uc0_setothermode_h,     uc0_texture,
395         uc0_moveword,           uc0_popmatrix,          uc0_culldl,             uc4_tri1,
396           // c0-ff: RDP commands
397         rdp_noop,               undef,                  undef,                  undef,    
398         undef,                  undef,                  undef,                  undef,    
399         rdp_trifill,            rdp_trifillz,           rdp_tritxtr,            rdp_tritxtrz,
400         rdp_trishade,           rdp_trishadez,          rdp_trishadetxtr,       rdp_trishadetxtrz,
401         undef,                  undef,                  undef,                  undef,    
402         undef,                  undef,                  undef,                  undef,    
403         undef,                  undef,                  undef,                  undef,    
404         undef,                  undef,                  undef,                  undef,    
405         undef,                  undef,                  undef,                  undef,    
406         rdp_texrect,                    rdp_texrect,            rdp_loadsync,           rdp_pipesync,
407         rdp_tilesync,           rdp_fullsync,           rdp_setkeygb,           rdp_setkeyr,
408         rdp_setconvert,         rdp_setscissor,         rdp_setprimdepth,       rdp_setothermode,
409         rdp_loadtlut,           undef,                  rdp_settilesize,        rdp_loadblock,
410         rdp_loadtile,           rdp_settile,            rdp_fillrect,           rdp_setfillcolor,
411         rdp_setfogcolor,        rdp_setblendcolor,      rdp_setprimcolor,       rdp_setenvcolor,
412         rdp_setcombine,         rdp_settextureimage,    rdp_setdepthimage,      rdp_setcolorimage
413         },
414
415     {
416         // uCode 5 - RSP SW 2.0 Diddy
417         // 00-3f
418         // games: Diddy Kong Racing
419         spnoop,                     uc5_matrix,             rsp_reserved0,              uc0_movemem,
420         uc5_vertex,                                     uc5_tridma,                            uc0_displaylist,                  uc5_dl_in_mem,
421         rsp_reserved3,              uc6_sprite2d,           undef,                      undef,
422         undef,                      undef,                      undef,                      undef,        
423         undef,                      undef,                      undef,                      undef,        
424         undef,                      undef,                      undef,                      undef,        
425         undef,                      undef,                      undef,                      undef,        
426         undef,                      undef,                      undef,                      undef,        
427         undef,                      undef,                      undef,                      undef,        
428         undef,                      undef,                      undef,                      undef,        
429         undef,                      undef,                      undef,                      undef,        
430         undef,                      undef,                      undef,                      undef,        
431         undef,                      undef,                      undef,                      undef,        
432         undef,                      undef,                      undef,                      undef,        
433         undef,                      undef,                      undef,                      undef,        
434         undef,                      undef,                      undef,                      undef,        
435           // 40-7f: Unused
436         undef,                      undef,                      undef,                      undef,        
437         undef,                      undef,                      undef,                      undef,        
438         undef,                      undef,                      undef,                      undef,        
439         undef,                      undef,                      undef,                      undef,        
440         undef,                      undef,                      undef,                      undef,        
441         undef,                      undef,                      undef,                      undef,        
442         undef,                      undef,                      undef,                      undef,        
443         undef,                      undef,                      undef,                      undef,        
444         undef,                      undef,                      undef,                      undef,        
445         undef,                      undef,                      undef,                      undef,        
446         undef,                      undef,                      undef,                      undef,        
447         undef,                      undef,                      undef,                      undef,        
448         undef,                      undef,                      undef,                      undef,        
449         undef,                      undef,                      undef,                      undef,        
450         undef,                      undef,                      undef,                      undef,        
451         undef,                      undef,                      undef,                      undef,        
452           // 80-bf: Immediate commands
453         undef,                      undef,                      undef,                      undef,        
454         undef,                      undef,                      undef,                      undef,        
455         undef,                      undef,                      undef,                      undef,        
456         undef,                      undef,                      undef,                      undef,        
457         undef,                      undef,                      undef,                      undef,        
458         undef,                      undef,                      undef,                      undef,        
459         undef,                      undef,                      undef,                      undef,        
460         undef,                      undef,                      undef,                      undef,        
461         undef,                      undef,                      undef,                      undef,        
462         undef,                      undef,                      undef,                      undef,        
463         undef,                      undef,                      undef,                      undef,        
464         undef,                      undef,                      undef,                      undef,        
465         undef,                      uc0_tri4,                   rdphalf_cont,               rdphalf_2,
466         rdphalf_1,              uc0_line3d,             uc5_cleargeometrymode,  uc5_setgeometrymode,
467         uc0_enddl,              uc0_setothermode_l,     uc0_setothermode_h,     uc0_texture,
468         uc5_moveword,           uc0_popmatrix,          uc0_culldl,             uc5_dma_offsets,
469           // c0-ff: RDP commands
470         rdp_noop,               undef,                  undef,                  undef,    
471         undef,                  undef,                  undef,                  undef,    
472         rdp_trifill,            rdp_trifillz,           rdp_tritxtr,            rdp_tritxtrz,
473         rdp_trishade,           rdp_trishadez,          rdp_trishadetxtr,       rdp_trishadetxtrz,
474         undef,                  undef,                  undef,                  undef,    
475         undef,                  undef,                  undef,                  undef,    
476         undef,                  undef,                  undef,                  undef,    
477         undef,                  undef,                  undef,                  undef,    
478         undef,                  undef,                  undef,                  undef,    
479         rdp_texrect,                    rdp_texrect,            rdp_loadsync,           rdp_pipesync,
480         rdp_tilesync,           rdp_fullsync,           rdp_setkeygb,           rdp_setkeyr,
481         rdp_setconvert,         rdp_setscissor,         rdp_setprimdepth,       rdp_setothermode,
482         rdp_loadtlut,           undef,                  rdp_settilesize,        rdp_loadblock,
483         rdp_loadtile,           rdp_settile,            rdp_fillrect,           rdp_setfillcolor,
484         rdp_setfogcolor,        rdp_setblendcolor,      rdp_setprimcolor,       rdp_setenvcolor,
485         rdp_setcombine,         rdp_settextureimage,    rdp_setdepthimage,      rdp_setcolorimage
486         },
487
488         // uCode 6 - S2DEX 1.XX
489         // games: Yoshi's Story
490         {
491         spnoop,                     uc6_bg_1cyc,             uc6_bg_copy,              uc6_obj_rectangle,
492         uc6_obj_sprite,             uc6_obj_movemem,         uc0_displaylist,        rsp_reserved2,
493         rsp_reserved3,              undef/*uc6_sprite2d*/,           undef,                      undef,
494         undef,                      undef,                      undef,                      undef,        
495         undef,                      undef,                      undef,                      undef,        
496         undef,                      undef,                      undef,                      undef,        
497         undef,                      undef,                      undef,                      undef,        
498         undef,                      undef,                      undef,                      undef,        
499         undef,                      undef,                      undef,                      undef,        
500         undef,                      undef,                      undef,                      undef,        
501         undef,                      undef,                      undef,                      undef,        
502         undef,                      undef,                      undef,                      undef,        
503         undef,                      undef,                      undef,                      undef,        
504         undef,                      undef,                      undef,                      undef,        
505         undef,                      undef,                      undef,                      undef,        
506         undef,                      undef,                      undef,                      undef,        
507       // 40-7f: unused
508                 undef,                      undef,                      undef,                      undef,        
509         undef,                      undef,                      undef,                      undef,        
510         undef,                      undef,                      undef,                      undef,        
511         undef,                      undef,                      undef,                      undef,        
512         undef,                      undef,                      undef,                      undef,        
513         undef,                      undef,                      undef,                      undef,        
514         undef,                      undef,                      undef,                      undef,        
515         undef,                      undef,                      undef,                      undef,        
516         undef,                      undef,                      undef,                      undef,        
517         undef,                      undef,                      undef,                      undef,        
518         undef,                      undef,                      undef,                      undef,        
519         undef,                      undef,                      undef,                      undef,        
520         undef,                      undef,                      undef,                      undef,        
521         undef,                      undef,                      undef,                      undef,        
522         undef,                      undef,                      undef,                      undef,        
523         undef,                      undef,                      undef,                      undef,        
524       // 80-bf: Immediate commands
525         undef,                      undef,                      undef,                      undef,        
526         undef,                      undef,                      undef,                      undef,        
527         undef,                      undef,                      undef,                      undef,        
528         undef,                      undef,                      undef,                      undef,        
529         undef,                      undef,                      undef,                      undef,        
530         undef,                      undef,                      undef,                      undef,        
531         undef,                      undef,                      undef,                      undef,        
532         undef,                      undef,                      undef,                      undef,        
533         undef,                      undef,                      undef,                      undef,        
534         undef,                      undef,                      undef,                      undef,        
535         undef,                      undef,                      undef,                      undef,        
536         undef,                      undef,                      undef,                      uc6_loaducode,        
537         uc6_select_dl,              uc6_obj_rendermode,         uc6_obj_rectangle_r,            rdphalf_2,
538         rdphalf_1,          uc1_line3d,             uc0_cleargeometrymode,  uc0_setgeometrymode,
539         uc0_enddl,              uc0_setothermode_l,     uc0_setothermode_h,     uc0_texture,
540         uc0_moveword,           uc0_popmatrix,          uc2_culldl,             uc1_tri1,
541       // c0-ff: RDP commands
542         rdp_noop,               uc6_obj_loadtxtr,       uc6_obj_ldtx_sprite,    uc6_obj_ldtx_rect,
543         uc6_ldtx_rect_r,        undef,                  undef,                  undef,
544         rdp_trifill,            rdp_trifillz,           rdp_tritxtr,            rdp_tritxtrz,
545         rdp_trishade,           rdp_trishadez,          rdp_trishadetxtr,       rdp_trishadetxtrz,
546         undef,                  undef,                  undef,                  undef,    
547         undef,                  undef,                  undef,                  undef,    
548         undef,                  undef,                  undef,                  undef,    
549         undef,                  undef,                  undef,                  undef,    
550         undef,                  undef,                  undef,                  undef,    
551         rdp_texrect,            rdp_texrect,        rdp_loadsync,           rdp_pipesync,
552         rdp_tilesync,           rdp_fullsync,           rdp_setkeygb,           rdp_setkeyr,
553         rdp_setconvert,         rdp_setscissor,         rdp_setprimdepth,       rdp_setothermode,
554         rdp_loadtlut,           undef,                  rdp_settilesize,        rdp_loadblock,
555         rdp_loadtile,           rdp_settile,            rdp_fillrect,           rdp_setfillcolor,
556         rdp_setfogcolor,        rdp_setblendcolor,      rdp_setprimcolor,       rdp_setenvcolor,
557         rdp_setcombine,         rdp_settextureimage,    rdp_setdepthimage,      rdp_setcolorimage
558     },
559         // uCode 7 - unknown
560         // games: Perfect Dark
561         {
562                 // 00-3f
563                 spnoop,                                 uc0_matrix,                             rsp_reserved0,                  uc0_movemem,
564                 uc7_vertex,                             rsp_reserved1,                  uc0_displaylist,                uc7_colorbase,
565                 rsp_reserved3,                  undef,                                  undef,                                  undef,
566                 undef,                                  undef,                                  undef,                                  undef,
567                 undef,                                  undef,                                  undef,                                  undef,
568                 undef,                                  undef,                                  undef,                                  undef,
569                 undef,                                  undef,                                  undef,                                  undef,
570                 undef,                                  undef,                                  undef,                                  undef,
571                 undef,                                  undef,                                  undef,                                  undef,
572                 undef,                                  undef,                                  undef,                                  undef,
573                 undef,                                  undef,                                  undef,                                  undef,
574                 undef,                                  undef,                                  undef,                                  undef,
575                 undef,                                  undef,                                  undef,                                  undef,
576                 undef,                                  undef,                                  undef,                                  undef,
577                 undef,                                  undef,                                  undef,                                  undef,
578                 undef,                                  undef,                                  undef,                                  undef,
579
580                 // 40-7f: unused
581                 undef,                                  undef,                                  undef,                                  undef,
582                 undef,                                  undef,                                  undef,                                  undef,
583                 undef,                                  undef,                                  undef,                                  undef,
584                 undef,                                  undef,                                  undef,                                  undef,
585                 undef,                                  undef,                                  undef,                                  undef,
586                 undef,                                  undef,                                  undef,                                  undef,
587                 undef,                                  undef,                                  undef,                                  undef,
588                 undef,                                  undef,                                  undef,                                  undef,
589                 undef,                                  undef,                                  undef,                                  undef,
590                 undef,                                  undef,                                  undef,                                  undef,
591                 undef,                                  undef,                                  undef,                                  undef,
592                 undef,                                  undef,                                  undef,                                  undef,
593                 undef,                                  undef,                                  undef,                                  undef,
594                 undef,                                  undef,                                  undef,                                  undef,
595                 undef,                                  undef,                                  undef,                                  undef,
596                 undef,                                  undef,                                  undef,                                  undef,
597
598                 // 80-bf: unused
599                 undef,                                  undef,                                  undef,                                  undef,
600                 undef,                                  undef,                                  undef,                                  undef,
601                 undef,                                  undef,                                  undef,                                  undef,
602                 undef,                                  undef,                                  undef,                                  undef,
603
604                 undef,                                  undef,                                  undef,                                  undef,
605                 undef,                                  undef,                                  undef,                                  undef,
606                 undef,                                  undef,                                  undef,                                  undef,
607                 undef,                                  undef,                                  undef,                                  undef,
608
609                 undef,                                  undef,                                  undef,                                  undef,
610                 undef,                                  undef,                                  undef,                                  undef,
611                 undef,                                  undef,                                  undef,                                  undef,
612                 undef,                                  undef,                                  undef,                                  undef,
613
614                 undef,                                  uc0_tri4,                               rdphalf_cont,           rdphalf_2,
615                 rdphalf_1,                      uc1_tri2,                               uc0_cleargeometrymode,  uc0_setgeometrymode,
616                 uc0_enddl,                              uc0_setothermode_l,             uc0_setothermode_h,             uc0_texture,
617                 uc0_moveword,                   uc0_popmatrix,                  uc0_culldl,                             uc0_tri1,
618
619                 // c0-ff: RDP commands mixed with uc2 commands
620                 rdp_noop,               undef,                  undef,                  undef,    
621         undef,                  undef,                  undef,                  undef,    
622         rdp_trifill,            rdp_trifillz,           rdp_tritxtr,            rdp_tritxtrz,
623         rdp_trishade,           rdp_trishadez,          rdp_trishadetxtr,       rdp_trishadetxtrz,
624
625                 undef,                                  undef,                                  undef,                                  undef,
626                 undef,                                  undef,                                  undef,                                  undef,
627                 undef,                                  undef,                                  undef,                                  undef,
628                 undef,                                  undef,                                  undef,                                  undef,
629
630                 undef,                                  undef,                                  undef,                                  undef,
631                 rdp_texrect,            rdp_texrect,            rdp_loadsync,           rdp_pipesync,
632         rdp_tilesync,           rdp_fullsync,           rdp_setkeygb,           rdp_setkeyr,
633         rdp_setconvert,         rdp_setscissor,         rdp_setprimdepth,       rdp_setothermode,
634         
635         rdp_loadtlut,           rdphalf_2,          rdp_settilesize,        rdp_loadblock,
636         rdp_loadtile,           rdp_settile,            rdp_fillrect,           rdp_setfillcolor,
637         rdp_setfogcolor,        rdp_setblendcolor,      rdp_setprimcolor,       rdp_setenvcolor,
638         rdp_setcombine,         rdp_settextureimage,    rdp_setdepthimage,      rdp_setcolorimage
639         },
640
641         // uCode 8 - unknown
642         // games: Conker's Bad Fur Day
643         {
644                 // 00-3f
645                 spnoop,                                 uc8_vertex,                             uc2_modifyvtx,                  uc2_culldl,
646                 uc1_branch_z,                   uc2_tri1,                               uc2_quad,                               uc2_quad,
647                 uc2_line3d,                             uc6_bg_1cyc,                    uc6_bg_copy,                    uc6_obj_rendermode/*undef*/,
648                 undef,                                  undef,                                  undef,                                  undef,
649                 uc8_tri4,                               uc8_tri4,                               uc8_tri4,                               uc8_tri4,
650                 uc8_tri4,                               uc8_tri4,                               uc8_tri4,                               uc8_tri4,
651                 uc8_tri4,                               uc8_tri4,                               uc8_tri4,                               uc8_tri4,
652                 uc8_tri4,                               uc8_tri4,                               uc8_tri4,                               uc8_tri4,
653                 undef,                                  undef,                                  undef,                                  undef,
654                 undef,                                  undef,                                  undef,                                  undef,
655                 undef,                                  undef,                                  undef,                                  undef,
656                 undef,                                  undef,                                  undef,                                  undef,
657                 undef,                                  undef,                                  undef,                                  undef,
658                 undef,                                  undef,                                  undef,                                  undef,
659                 undef,                                  undef,                                  undef,                                  undef,
660                 undef,                                  undef,                                  undef,                                  undef,
661
662                 // 40-7f: unused
663                 undef,                                  undef,                                  undef,                                  undef,
664                 undef,                                  undef,                                  undef,                                  undef,
665                 undef,                                  undef,                                  undef,                                  undef,
666                 undef,                                  undef,                                  undef,                                  undef,
667                 undef,                                  undef,                                  undef,                                  undef,
668                 undef,                                  undef,                                  undef,                                  undef,
669                 undef,                                  undef,                                  undef,                                  undef,
670                 undef,                                  undef,                                  undef,                                  undef,
671                 undef,                                  undef,                                  undef,                                  undef,
672                 undef,                                  undef,                                  undef,                                  undef,
673                 undef,                                  undef,                                  undef,                                  undef,
674                 undef,                                  undef,                                  undef,                                  undef,
675                 undef,                                  undef,                                  undef,                                  undef,
676                 undef,                                  undef,                                  undef,                                  undef,
677                 undef,                                  undef,                                  undef,                                  undef,
678                 undef,                                  undef,                                  undef,                                  undef,
679
680                 // 80-bf: unused
681                 undef,                                  undef,                                  undef,                                  undef,
682                 undef,                                  undef,                                  undef,                                  undef,
683                 undef,                                  undef,                                  undef,                                  undef,
684                 undef,                                  undef,                                  undef,                                  undef,
685                 undef,                                  undef,                                  undef,                                  undef,
686                 undef,                                  undef,                                  undef,                                  undef,
687                 undef,                                  undef,                                  undef,                                  undef,
688                 undef,                                  undef,                                  undef,                                  undef,
689                 undef,                                  undef,                                  undef,                                  undef,
690                 undef,                                  undef,                                  undef,                                  undef,
691                 undef,                                  undef,                                  undef,                                  undef,
692                 undef,                                  undef,                                  undef,                                  undef,
693                 undef,                                  undef,                                  undef,                                  undef,
694                 undef,                                  undef,                                  undef,                                  undef,
695                 undef,                                  undef,                                  undef,                                  undef,
696                 undef,                                  undef,                                  undef,                                  undef,
697
698                 // c0-ff: RDP commands mixed with uc2 commands
699                 rdp_noop,               undef,                  undef,                  undef,    
700         undef,                  undef,                  undef,                  undef,    
701         rdp_trifill,            rdp_trifillz,           rdp_tritxtr,            rdp_tritxtrz,
702         rdp_trishade,           rdp_trishadez,          rdp_trishadetxtr,       rdp_trishadetxtrz,
703                 undef,                                  undef,                                  undef,                                  uc2_special3,
704                 uc2_special2,                   uc2_dlist_cnt,                  uc2_dma_io,                             uc0_texture,
705                 uc2_pop_matrix,                 uc2_geom_mode,                  uc2_matrix,                             uc8_moveword,
706                 uc8_movemem,                    uc2_load_ucode,                 uc0_displaylist,                uc0_enddl,
707                 spnoop,                                 rdphalf_1,                      uc0_setothermode_l,             uc0_setothermode_h,
708                 rdp_texrect,            rdp_texrect,            rdp_loadsync,           rdp_pipesync,
709         rdp_tilesync,           rdp_fullsync,           rdp_setkeygb,           rdp_setkeyr,
710         rdp_setconvert,         rdp_setscissor,         rdp_setprimdepth,       rdp_setothermode,
711         rdp_loadtlut,           uc2_rdphalf_2,          rdp_settilesize,        rdp_loadblock,
712         rdp_loadtile,           rdp_settile,            rdp_fillrect,           rdp_setfillcolor,
713         rdp_setfogcolor,        rdp_setblendcolor,      rdp_setprimcolor,       rdp_setenvcolor,
714         rdp_setcombine,         rdp_settextureimage,    rdp_setdepthimage,      rdp_setcolorimage
715         },
716
717         {
718         // uCode 9 - gzsort
719         // games: Telefoot Soccer
720         // 00-3f
721         spnoop,                     undef,                      undef,                      undef,        
722         undef,                      undef,                      undef,                      undef,        
723         undef,                      undef,                      undef,                      undef,        
724         undef,                      undef,                      undef,                      undef,        
725         undef,                      undef,                      undef,                      undef,        
726         undef,                      undef,                      undef,                      undef,        
727         undef,                      undef,                      undef,                      undef,        
728         undef,                      undef,                      undef,                      undef,        
729         undef,                      undef,                      undef,                      undef,        
730         undef,                      undef,                      undef,                      undef,        
731         undef,                      undef,                      undef,                      undef,        
732         undef,                      undef,                      undef,                      undef,        
733         undef,                      undef,                      undef,                      undef,        
734         undef,                      undef,                      undef,                      undef,        
735         undef,                      undef,                      undef,                      undef,        
736         undef,                      undef,                      undef,                      undef,        
737           // 40-7f: Unused
738         undef,                      undef,                      undef,                      undef,        
739         undef,                      undef,                      undef,                      undef,        
740         undef,                      undef,                      undef,                      undef,        
741         undef,                      undef,                      undef,                      undef,        
742         undef,                      undef,                      undef,                      undef,        
743         undef,                      undef,                      undef,                      undef,        
744         undef,                      undef,                      undef,                      undef,        
745         undef,                      undef,                      undef,                      undef,        
746         undef,                      undef,                      undef,                      undef,        
747         undef,                      undef,                      undef,                      undef,        
748         undef,                      undef,                      undef,                      undef,        
749         undef,                      undef,                      undef,                      undef,        
750         undef,                      undef,                      undef,                      undef,        
751         undef,                      undef,                      undef,                      undef,        
752         undef,                      undef,                      undef,                      undef,        
753         undef,                      undef,                      undef,                      undef,        
754           // 80-bf: Immediate commands
755         uc9_object,                 uc9_rpdcmd,                 undef,                      undef,        
756         undef,                      undef,                      undef,                      undef,        
757         undef,                      undef,                      undef,                      undef,        
758         undef,                      undef,                      undef,                      undef,        
759         undef,                      undef,                      undef,                      undef,        
760         undef,                      undef,                      undef,                      undef,        
761         undef,                      undef,                      undef,                      undef,        
762         undef,                      undef,                      undef,                      undef,        
763         undef,                      undef,                      undef,                      undef,        
764         undef,                      undef,                      undef,                      undef,        
765         undef,                      undef,                      undef,                      undef,        
766         undef,                      undef,                      undef,                      undef,        
767         undef,                      undef,                      undef,                      undef,        
768         rdphalf_1,                  undef,                      uc0_cleargeometrymode,      uc0_setgeometrymode,
769         uc0_enddl,                  uc0_setothermode_l,         uc0_setothermode_h,         uc0_texture,
770         uc0_moveword,               undef,                      uc0_culldl,                 undef,
771           // c0-ff: RDP commands
772         rdp_noop,               undef,                  undef,                  undef,    
773         undef,                  undef,                  undef,                  undef,    
774         rdp_trifill,            rdp_trifillz,           rdp_tritxtr,            rdp_tritxtrz,
775         rdp_trishade,           rdp_trishadez,          rdp_trishadetxtr,       rdp_trishadetxtrz,
776
777         uc9_mix,                uc9_fmlight,            uc9_light,              undef,    
778         uc9_mtxtrnsp,           uc9_mtxcat,             uc9_mult_mpmtx,         uc9_link_subdl,    
779         uc9_set_subdl,          uc9_wait_signal,        uc9_send_signal,        uc0_moveword,    
780         uc9_movemem,            undef,                  uc0_displaylist,        uc0_enddl,    
781
782         undef,                  undef,                  uc0_setothermode_l,     uc0_setothermode_h,    
783         rdp_texrect,            rdp_texrect,            rdp_loadsync,           rdp_pipesync,
784         rdp_tilesync,           rdp_fullsync,           rdp_setkeygb,           rdp_setkeyr,
785         rdp_setconvert,         uc9_setscissor,         rdp_setprimdepth,       rdp_setothermode,
786
787         rdp_loadtlut,           rdphalf_2,              rdp_settilesize,        rdp_loadblock,
788         rdp_loadtile,           rdp_settile,            rdp_fillrect,           rdp_setfillcolor,
789         rdp_setfogcolor,        rdp_setblendcolor,      rdp_setprimcolor,       rdp_setenvcolor,
790         rdp_setcombine,         rdp_settextureimage,    rdp_setdepthimage,      rdp_setcolorimage
791         },
792 };