~registry/dolphin-emu/triforce

« back to all changes in this revision

Viewing changes to Source/Core/Core/Src/DSP/disassemble.h

  • Committer: Sérgio Benjamim
  • Date: 2015-02-13 05:54:40 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20150213055440-ey2rt3sjpy27km78
Dolphin Triforce branch from code.google, commit b957980 (4.0-315).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*====================================================================
 
2
 
 
3
   project:      GameCube DSP Tool (gcdsp)
 
4
   created:      2005.03.04
 
5
   mail:                  duddie@walla.com
 
6
 
 
7
   Copyright (c) 2005 Duddie
 
8
 
 
9
   This program is free software; you can redistribute it and/or
 
10
   modify it under the terms of the GNU General Public License
 
11
   as published by the Free Software Foundation; either version 2
 
12
   of the License, or (at your option) any later version.
 
13
 
 
14
   This program is distributed in the hope that it will be useful,
 
15
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
   GNU General Public License for more details.
 
18
 
 
19
   You should have received a copy of the GNU General Public License
 
20
   along with this program; if not, write to the Free Software
 
21
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
22
 
 
23
   ====================================================================*/
 
24
 
 
25
#ifndef _DSP_DISASSEMBLE_H
 
26
#define _DSP_DISASSEMBLE_H
 
27
 
 
28
#include <map>
 
29
#include <vector>
 
30
 
 
31
#include "Common.h"
 
32
#include "DSPTables.h"
 
33
#include "LabelMap.h"
 
34
 
 
35
struct AssemblerSettings
 
36
{
 
37
        AssemblerSettings()
 
38
                : print_tabs(false),
 
39
                  show_hex(false),
 
40
                  show_pc(false),
 
41
                  force(false),
 
42
                  decode_names(true),
 
43
                  decode_registers(true),
 
44
                  ext_separator('\''),
 
45
                  lower_case_ops(true),
 
46
                  pc(0)
 
47
        {
 
48
        }
 
49
 
 
50
        bool print_tabs;
 
51
        bool show_hex;
 
52
        bool show_pc;
 
53
        bool force;
 
54
        bool decode_names;
 
55
        bool decode_registers;
 
56
        char ext_separator;
 
57
        bool lower_case_ops;
 
58
 
 
59
        u16 pc;
 
60
};
 
61
 
 
62
class DSPDisassembler
 
63
{
 
64
public:
 
65
        DSPDisassembler(const AssemblerSettings &settings);
 
66
        ~DSPDisassembler();
 
67
 
 
68
        bool Disassemble(int start_pc, const std::vector<u16> &code, int base_addr, std::string &text);
 
69
 
 
70
        // Warning - this one is trickier to use right.
 
71
        // Use pass == 2 if you're just using it by itself.
 
72
        bool DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 *pc, std::string &dest);
 
73
 
 
74
private:
 
75
        // Moves PC forward and writes the result to dest.
 
76
        bool DisFile(const char* name, int base_addr, int pass, std::string &output);
 
77
 
 
78
        char* DisParams(const DSPOPCTemplate& opc, u16 op1, u16 op2, char* strbuf);
 
79
        std::map<u16, int> unk_opcodes;
 
80
 
 
81
        const AssemblerSettings settings_;
 
82
 
 
83
        LabelMap labels;
 
84
};
 
85
 
 
86
#endif  // _DSP_DISASSEMBLE_H
 
87