1 /******************************************************************************
2 * Arachnoid Graphics Plugin for Mupen64Plus
3 * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/
5 * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson
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.
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.
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 *****************************************************************************/
26 #include "UCodeDefs.h"
28 #define F3DEX_MTX_STACKSIZE 18
30 #define F3DEX_MTX_MODELVIEW 0x00
31 #define F3DEX_MTX_PROJECTION 0x01
32 #define F3DEX_MTX_MUL 0x00
33 #define F3DEX_MTX_LOAD 0x02
34 #define F3DEX_MTX_NOPUSH 0x00
35 #define F3DEX_MTX_PUSH 0x04
37 #define F3DEX_TEXTURE_ENABLE 0x00000002
38 #define F3DEX_SHADING_SMOOTH 0x00000200
39 #define F3DEX_CULL_FRONT 0x00001000
40 #define F3DEX_CULL_BACK 0x00002000
41 #define F3DEX_CULL_BOTH 0x00003000
42 #define F3DEX_CLIPPING 0x00800000
44 #define F3DEX_MV_VIEWPORT 0x80
46 #define F3DEX_MWO_aLIGHT_1 0x00
47 #define F3DEX_MWO_bLIGHT_1 0x04
48 #define F3DEX_MWO_aLIGHT_2 0x20
49 #define F3DEX_MWO_bLIGHT_2 0x24
50 #define F3DEX_MWO_aLIGHT_3 0x40
51 #define F3DEX_MWO_bLIGHT_3 0x44
52 #define F3DEX_MWO_aLIGHT_4 0x60
53 #define F3DEX_MWO_bLIGHT_4 0x64
54 #define F3DEX_MWO_aLIGHT_5 0x80
55 #define F3DEX_MWO_bLIGHT_5 0x84
56 #define F3DEX_MWO_aLIGHT_6 0xa0
57 #define F3DEX_MWO_bLIGHT_6 0xa4
58 #define F3DEX_MWO_aLIGHT_7 0xc0
59 #define F3DEX_MWO_bLIGHT_7 0xc4
60 #define F3DEX_MWO_aLIGHT_8 0xe0
61 #define F3DEX_MWO_bLIGHT_8 0xe4
64 #define F3DEX_MODIFYVTX 0xB2
65 #define F3DEX_TRI2 0xB1
66 #define F3DEX_BRANCH_Z 0xB0
67 #define F3DEX_LOAD_UCODE 0xAF // 0xCF
75 //*****************************************************************************
76 //! UCode1 (aka F3DEX - Fast 3D EX)
77 //! Microcode used for most games
78 //*****************************************************************************
86 static void initialize(GBI* gbi, RSP* rsp, RDP* rdp, Memory* memory);
87 static void initializeGBI();
89 static void F3DEX_Load_uCode(MicrocodeArgument* ucode);
90 static void F3DEX_Vtx(MicrocodeArgument* ucode);
91 static void F3DEX_ModifyVtx(MicrocodeArgument* ucode);
92 static void F3DEX_Tri1(MicrocodeArgument* ucode);
93 static void F3DEX_Tri2(MicrocodeArgument* ucode);
94 static void F3DEX_Quad(MicrocodeArgument* ucode);
95 static void F3DEX_CullDL(MicrocodeArgument* ucode);
96 static void F3DEX_Branch_Z(MicrocodeArgument* ucode);
100 static GBI* m_gbi; //!< Graphics Binary Interface
101 static RSP* m_rsp; //!< Pointer to Reality Signal Processor
102 static RDP* m_rdp; //!< Pointer to Reality Drawing Processor
103 static Memory* m_memory; //!< Pointer accessing memory like RDRAM and Texture Memory