Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmeteor/source/disassembler/argshift.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/argshift.hpp"
18
19
#include <sstream>
20
21
namespace AMeteor
22
{
23
namespace Disassembler
24
{
25
ArgShift::ArgShift (const Argument& arg1, const Argument& arg2,
26
ShiftType type, bool memory) :
27
Argument(),
28
m_arg1(arg1.Clone()),
29
m_arg2(arg2.Clone()),
30
m_type(type),
31
m_memory(memory)
32
{ }
33
34
ArgShift::ArgShift (const ArgShift& arg) :
35
Argument(),
36
m_arg1(arg.m_arg1->Clone()),
37
m_arg2(arg.m_arg2->Clone()),
38
m_type(arg.m_type),
39
m_memory(arg.m_memory)
40
{ }
41
42
ArgShift::~ArgShift ()
43
{
44
delete m_arg1;
45
delete m_arg2;
46
}
47
48
Argument* ArgShift::Clone () const
49
{
50
return new ArgShift(*this);
51
}
52
53
std::string ArgShift::GetString () const
54
{
55
static const char* Shifts[] = {", LSL ", ", LSR ", ", ASR ", ", ROR ",
56
", RRX "};
57
58
std::ostringstream ss;
59
60
if (m_memory)
61
ss << '[';
62
63
ss << m_arg1->GetString() << Shifts[m_type] << m_arg2->GetString();
64
65
if (m_memory)
66
ss << ']';
67
68
return ss.str();
69
}
70
}
71
}
72
73