22726e4d |
1 | /****************************************************************************** |
2 | * Arachnoid Graphics Plugin for Mupen64Plus |
3 | * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/ |
4 | * |
5 | * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson |
6 | * |
7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License |
9 | * as published by the Free Software Foundation; either version 2 |
10 | * of the License, or (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License |
18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
20 | *****************************************************************************/ |
21 | |
22 | #ifndef UCODE_0_H_ |
23 | #define UCODE_0_H_ |
24 | |
25 | //Includes |
26 | #include "UCodeDefs.h" |
27 | |
28 | //Forward declaration |
29 | class GBI; |
30 | class RSP; |
31 | class RDP; |
32 | class Memory; |
33 | class DisplayListParser; |
34 | |
35 | //Definitions |
36 | #define F3D_MTX_STACKSIZE 10 |
37 | |
38 | #define F3D_MTX_MODELVIEW 0x00 |
39 | #define F3D_MTX_PROJECTION 0x01 |
40 | #define F3D_MTX_MUL 0x00 |
41 | #define F3D_MTX_LOAD 0x02 |
42 | #define F3D_MTX_NOPUSH 0x00 |
43 | #define F3D_MTX_PUSH 0x04 |
44 | |
45 | #define F3D_TEXTURE_ENABLE 0x00000002 |
46 | #define F3D_SHADING_SMOOTH 0x00000200 |
47 | #define F3D_CULL_FRONT 0x00001000 |
48 | #define F3D_CULL_BACK 0x00002000 |
49 | #define F3D_CULL_BOTH 0x00003000 |
50 | #define F3D_CLIPPING 0x00000000 |
51 | |
52 | #define F3D_MV_VIEWPORT 0x80 |
53 | |
54 | #define F3D_MWO_aLIGHT_1 0x00 |
55 | #define F3D_MWO_bLIGHT_1 0x04 |
56 | #define F3D_MWO_aLIGHT_2 0x20 |
57 | #define F3D_MWO_bLIGHT_2 0x24 |
58 | #define F3D_MWO_aLIGHT_3 0x40 |
59 | #define F3D_MWO_bLIGHT_3 0x44 |
60 | #define F3D_MWO_aLIGHT_4 0x60 |
61 | #define F3D_MWO_bLIGHT_4 0x64 |
62 | #define F3D_MWO_aLIGHT_5 0x80 |
63 | #define F3D_MWO_bLIGHT_5 0x84 |
64 | #define F3D_MWO_aLIGHT_6 0xa0 |
65 | #define F3D_MWO_bLIGHT_6 0xa4 |
66 | #define F3D_MWO_aLIGHT_7 0xc0 |
67 | #define F3D_MWO_bLIGHT_7 0xc4 |
68 | #define F3D_MWO_aLIGHT_8 0xe0 |
69 | #define F3D_MWO_bLIGHT_8 0xe4 |
70 | |
71 | // FAST3D commands |
72 | #define F3D_SPNOOP 0x00 |
73 | #define F3D_MTX 0x01 |
74 | #define F3D_RESERVED0 0x02 |
75 | #define F3D_MOVEMEM 0x03 |
76 | #define F3D_VTX 0x04 |
77 | #define F3D_RESERVED1 0x05 |
78 | #define F3D_DL 0x06 |
79 | #define F3D_RESERVED2 0x07 |
80 | #define F3D_RESERVED3 0x08 |
81 | #define F3D_SPRITE2D_BASE 0x09 |
82 | |
83 | #define F3D_TRI1 0xBF |
84 | #define F3D_CULLDL 0xBE |
85 | #define F3D_POPMTX 0xBD |
86 | #define F3D_MOVEWORD 0xBC |
87 | #define F3D_TEXTURE 0xBB |
88 | #define F3D_SETOTHERMODE_H 0xBA |
89 | #define F3D_SETOTHERMODE_L 0xB9 |
90 | #define F3D_ENDDL 0xB8 |
91 | #define F3D_SETGEOMETRYMODE 0xB7 |
92 | #define F3D_CLEARGEOMETRYMODE 0xB6 |
93 | //#define F3D_LINE3D 0xB5 // Only used in Line3D |
94 | #define F3D_QUAD 0xB5 |
95 | #define F3D_RDPHALF_1 0xB4 |
96 | #define F3D_RDPHALF_2 0xB3 |
97 | #define F3D_RDPHALF_CONT 0xB2 |
98 | #define F3D_TRI4 0xB1 |
99 | |
100 | //***************************************************************************** |
101 | //! UCode0 (aka F3D - Fast 3D) |
102 | //! Microcode used for Super Mario 64!!! |
103 | //***************************************************************************** |
104 | class UCode0 |
105 | { |
106 | public: |
107 | |
108 | UCode0(); |
109 | ~UCode0(); |
110 | |
111 | static void initialize(RSP* rsp, RDP* rdp, Memory* memory, DisplayListParser* dlp); |
112 | static void initializeGBI(GBI* gbi); |
113 | |
114 | public: |
115 | |
116 | // Matrix Functions |
117 | static void F3D_Mtx(MicrocodeArgument* ucode); |
118 | static void F3D_PopMtx(MicrocodeArgument* ucode); |
119 | |
120 | //Vertex and indices |
121 | static void F3D_Vtx(MicrocodeArgument* ucode); |
122 | static void F3D_Tri1(MicrocodeArgument* ucode); |
123 | static void F3D_Tri4(MicrocodeArgument* ucode); |
124 | static void F3D_Quad(MicrocodeArgument* ucode); |
125 | |
126 | //Display list |
127 | static void F3D_DList(MicrocodeArgument* ucode); |
128 | static void F3D_EndDL(MicrocodeArgument* ucode); |
129 | static void F3D_CullDL(MicrocodeArgument* ucode); //Unimplemented |
130 | |
131 | // Texture |
132 | static void F3D_Texture(MicrocodeArgument* ucode); |
133 | |
134 | // Half |
135 | static void F3D_RDPHalf_1(MicrocodeArgument* ucode); |
136 | static void F3D_RDPHalf_2(MicrocodeArgument* ucode); |
137 | static void F3D_RDPHalf_Cont(MicrocodeArgument* ucode); //Unimplmeneted |
138 | |
139 | // Geometry Mode |
140 | static void F3D_SetGeometryMode(MicrocodeArgument* ucode); |
141 | static void F3D_ClearGeometryMode(MicrocodeArgument* ucode); |
142 | |
143 | // Set Other Modes |
144 | static void F3D_SetOtherMode_H(MicrocodeArgument* ucode); |
145 | static void F3D_SetOtherMode_L(MicrocodeArgument* ucode); |
146 | |
147 | // Other |
148 | static void F3D_MoveMem(MicrocodeArgument* ucode); |
149 | static void F3D_MoveWord(MicrocodeArgument* ucode); |
150 | static void F3D_Sprite2D_Base(MicrocodeArgument* ucode); //Unimplemented |
151 | |
152 | //Unimportant |
153 | static void F3D_SPNoOp(MicrocodeArgument* ucode); |
154 | static void F3D_Reserved0(MicrocodeArgument* ucode); |
155 | static void F3D_Reserved1(MicrocodeArgument* ucode); |
156 | static void F3D_Reserved2(MicrocodeArgument* ucode); |
157 | static void F3D_Reserved3(MicrocodeArgument* ucode); |
158 | |
159 | private: |
160 | |
161 | static RSP* m_rsp; //!< Pointer to Reality Signal Processor |
162 | static RDP* m_rdp; //!< Pointer to Reality Drawing Processor |
163 | static Memory* m_memory; //!< Pointer to Memory Manager |
164 | static DisplayListParser* m_displayListParser; //!< Pointer to Display List Parser |
165 | |
166 | }; |
167 | |
168 | #endif |