std::string Thumb::LoadFromLiteralStoreInstruction::ToString() const
{
    std::stringstream stream;
    stream << "LDR R" << GetDestinationRegister() << ", [PC, #0x";
    stream << std::hex << std::uppercase << GetImmediate() << "]";
    return stream.str();
}
Example #2
0
uint16_t CPU::FetchOperand()
{
	switch(_instAddrMode) {
		case AddrMode::Acc:
		case AddrMode::Imp: DummyRead(); return 0;
		case AddrMode::Imm:
		case AddrMode::Rel: return GetImmediate();
		case AddrMode::Zero: return GetZeroAddr();
		case AddrMode::ZeroX: return GetZeroXAddr();
		case AddrMode::ZeroY: return GetZeroYAddr();
		case AddrMode::Ind: return GetIndAddr();
		case AddrMode::IndX: return GetIndXAddr();
		case AddrMode::IndY: return GetIndYAddr(false);
		case AddrMode::IndYW: return GetIndYAddr(true);
		case AddrMode::Abs: return GetAbsAddr();
		case AddrMode::AbsX: return GetAbsXAddr(false);
		case AddrMode::AbsXW: return GetAbsXAddr(true);
		case AddrMode::AbsY: return GetAbsYAddr(false);
		case AddrMode::AbsYW: return GetAbsYAddr(true);
		default: break;
	}
	
#ifndef LIBRETRO
	Debugger::BreakIfDebugging();
	
	if(NsfMapper::GetInstance()) {
		//Don't stop emulation on CPU crash when playing NSFs, reset cpu instead
		Console::Reset(true);
		return 0;
	} else if(!Debugger::IsEnabled()) {
		//Throw an error and stop emulation core (if debugger is not enabled)
		throw std::runtime_error("Invalid OP code - CPU crashed");
	} else {
		return 0;
	}
#else 
	return 0;
#endif

}
std::string Thumb::LoadStoreImmediateInstruction::ToString() const
{
    std::stringstream stream;
    stream << Thumb::ToString(GetOpcode()) << " R" << GetDestinationRegister();
    stream << ", [R" << GetBaseAddressRegister() << ", #0x" << std::hex << std::uppercase << GetImmediate() << "]";
    return stream.str();
}