Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmeteor/source/disassembler/argmulregisters.cpp
2 views
1
// Meteor - A Nintendo Gameboy Advance emulator
2
// Copyright (C) 2009-2011 Philippe Daouadi
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
#include "ameteor/disassembler/argmulregisters.hpp"
18
19
#include <sstream>
20
21
namespace AMeteor
22
{
23
namespace Disassembler
24
{
25
std::string ArgMulRegisters::GetString () const
26
{
27
std::ostringstream ss;
28
ss << '{';
29
30
bool open = false;
31
32
for (Registers::const_iterator iter = m_regs.begin();
33
iter != m_regs.end(); ++iter)
34
{
35
if (open &&
36
iter + 1 < m_regs.end() &&
37
*(iter + 1) == (*iter) + 1)
38
{
39
continue;
40
}
41
else if (iter + 2 < m_regs.end() &&
42
*(iter + 1) == (*iter) + 1 &&
43
*(iter + 2) == (*iter) + 2)
44
{
45
ss << 'r' << (int)*iter << '-';
46
open = true;
47
}
48
else
49
{
50
ss << 'r' << (int)*iter;
51
open = false;
52
if (iter + 1 != m_regs.end())
53
ss << ", ";
54
}
55
}
56
57
if (m_lastreg == SPREG_LR)
58
{
59
if (ss.width() != 1)
60
ss << ", ";
61
ss << "lr";
62
}
63
else if (m_lastreg == SPREG_PC)
64
{
65
if (ss.width() != 1)
66
ss << ", ";
67
ss << "pc";
68
}
69
70
ss << '}';
71
72
if (m_forceuser)
73
ss << '^';
74
75
return ss.str();
76
}
77
78
Argument* ArgMulRegisters::Clone () const
79
{
80
return new ArgMulRegisters(*this);
81
}
82
}
83
}
84
85