Path: blob/master/libmeteor/source/disassembler/argrelative.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/argrelative.hpp"1718#include <sstream>1920namespace AMeteor21{22namespace Disassembler23{24ArgRelative::ArgRelative (const ArgRegister& reg, const Argument& off,25bool pre, bool up, bool writeback) :26Argument(),27m_reg(reg),28m_off(off.Clone()),29m_pre(pre),30m_up(up),31m_writeback(writeback)32{ }3334ArgRelative::ArgRelative (const ArgRelative& arg) :35Argument(),36m_reg(arg.m_reg),37m_off(arg.m_off->Clone()),38m_pre(arg.m_pre),39m_up(arg.m_up),40m_writeback(arg.m_writeback)41{ }4243ArgRelative::~ArgRelative ()44{45delete m_off;46}4748Argument* ArgRelative::Clone () const49{50return new ArgRelative(*this);51}5253std::string ArgRelative::GetString () const54{55std::ostringstream ss;56ss << "[r" << (int)m_reg.GetRegister();5758if (m_pre)59{60ss << (m_up ? ", +" : ", -") << m_off->GetString() << ']';61if (m_writeback)62ss << '!';63}64else65ss << (m_up ? "], +" : "], -") << m_off->GetString();6667return ss.str();68}69}70}717273