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 *****************************************************************************/
22 #ifndef DISPLAYLIST_PARSER_H_
23 #define DISPLAYLIST_PARSER_H_
31 #define MAX_DL_COUNT 100000 //!< Maximum display list count
32 #define TASK_ADDRESS_RELATIVE_DMEM 0x0FC0
33 //-----------------------------------------------------------------------------
34 //! The display list PC stack.
35 //-----------------------------------------------------------------------------
42 //*****************************************************************************
44 //! Class for parsing and managing the displaylist
45 //*****************************************************************************
46 class DisplayListParser
49 //Constructor / Destructor
54 bool initialize(RSP* rsp, RDP* rdp, GBI* gbi, Memory* memory);
56 //Process/Parse the display list
57 void processDisplayList();
59 //Display list funcitons
60 void branchDisplayList(unsigned int dl);
61 void displayList(unsigned int segmentAddress);
62 void DMADisplayList( unsigned int w0, unsigned int w1 );
64 void endDisplayList() { --m_DListStackPointer; }
66 //! Get Program Counter
67 unsigned int getPC() { return m_DlistStack[m_DListStackPointer].pc; }
69 //! Set Program Counter
70 void setPC(unsigned int pc) { m_DlistStack[m_DListStackPointer].pc = pc; }
72 //! Increase Program Counter
73 void increasePC(int increment) { m_DlistStack[m_DListStackPointer].pc += increment; }
76 unsigned int getNextWord();
78 //! Get Current Display List
79 DListStack& getCurrentDlist() { return m_DlistStack[m_DListStackPointer]; }
84 RSP* m_rsp; //! Pointer to Reality Signal Processor
85 RDP* m_rdp; //! Pointer to Reality Drawing Processor
86 GBI* m_gbi; //! Pointer to Graphics Binary Interface
87 Memory* m_memory; //! Pointer to Memory
89 //Stack used for processing the Display List
90 int m_DListStackPointer; //!< Current size of Display List stack
91 static const int MAX_DL_STACK_SIZE = 32; //!< Maximum size of Display List stack
92 DListStack m_DlistStack[MAX_DL_STACK_SIZE]; //!< Stack used for processing the Display List