Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmeteor/source/disassembler/argrelative.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/argrelative.hpp"
18
19
#include <sstream>
20
21
namespace AMeteor
22
{
23
namespace Disassembler
24
{
25
ArgRelative::ArgRelative (const ArgRegister& reg, const Argument& off,
26
bool pre, bool up, bool writeback) :
27
Argument(),
28
m_reg(reg),
29
m_off(off.Clone()),
30
m_pre(pre),
31
m_up(up),
32
m_writeback(writeback)
33
{ }
34
35
ArgRelative::ArgRelative (const ArgRelative& arg) :
36
Argument(),
37
m_reg(arg.m_reg),
38
m_off(arg.m_off->Clone()),
39
m_pre(arg.m_pre),
40
m_up(arg.m_up),
41
m_writeback(arg.m_writeback)
42
{ }
43
44
ArgRelative::~ArgRelative ()
45
{
46
delete m_off;
47
}
48
49
Argument* ArgRelative::Clone () const
50
{
51
return new ArgRelative(*this);
52
}
53
54
std::string ArgRelative::GetString () const
55
{
56
std::ostringstream ss;
57
ss << "[r" << (int)m_reg.GetRegister();
58
59
if (m_pre)
60
{
61
ss << (m_up ? ", +" : ", -") << m_off->GetString() << ']';
62
if (m_writeback)
63
ss << '!';
64
}
65
else
66
ss << (m_up ? "], +" : "], -") << m_off->GetString();
67
68
return ss.str();
69
}
70
}
71
}
72
73