Path: blob/master/libmeteor/source/disassembler/argshift.cpp
2 views
// Meteor - A Nintendo Gameboy Advance emulator1// Copyright (C) 2009-2011 Philippe Daouadi2//3// This program is free software: you can redistribute it and/or modify4// it under the terms of the GNU General Public License as published by5// the Free Software Foundation, either version 3 of the License, or6// (at your option) any later version.7//8// This program is distributed in the hope that it will be useful,9// but WITHOUT ANY WARRANTY; without even the implied warranty of10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11// GNU General Public License for more details.12//13// You should have received a copy of the GNU General Public License14// along with this program. If not, see <http://www.gnu.org/licenses/>.1516#include "ameteor/disassembler/argshift.hpp"1718#include <sstream>1920namespace AMeteor21{22namespace Disassembler23{24ArgShift::ArgShift (const Argument& arg1, const Argument& arg2,25ShiftType type, bool memory) :26Argument(),27m_arg1(arg1.Clone()),28m_arg2(arg2.Clone()),29m_type(type),30m_memory(memory)31{ }3233ArgShift::ArgShift (const ArgShift& arg) :34Argument(),35m_arg1(arg.m_arg1->Clone()),36m_arg2(arg.m_arg2->Clone()),37m_type(arg.m_type),38m_memory(arg.m_memory)39{ }4041ArgShift::~ArgShift ()42{43delete m_arg1;44delete m_arg2;45}4647Argument* ArgShift::Clone () const48{49return new ArgShift(*this);50}5152std::string ArgShift::GetString () const53{54static const char* Shifts[] = {", LSL ", ", LSR ", ", ASR ", ", ROR ",55", RRX "};5657std::ostringstream ss;5859if (m_memory)60ss << '[';6162ss << m_arg1->GetString() << Shifts[m_type] << m_arg2->GetString();6364if (m_memory)65ss << ']';6667return ss.str();68}69}70}717273