Add debug printing for ARM mode

This commit is contained in:
Abaresk 2024-06-09 14:13:11 -07:00
parent c6a2436a69
commit 28d6ab36f0
1 changed files with 16 additions and 0 deletions

View File

@ -266,6 +266,22 @@ void A_MRC(ARM* cpu)
void A_SVC(ARM* cpu)
{
// Print from game. Execute `svc 0xFC` with the null-terminated string address in `r0`.
if ((cpu->CurInstr & 0xFF) == 0xFC && cpu->NDS.GetDebugPrint())
{
u32 addr = cpu->R[0];
std::string output;
for (;;)
{
u32 c;
cpu->DataRead8(addr++, &c);
if (!c) break;
output += c;
}
Platform::Log(LogLevel::Info, "%s", output.c_str());
return;
}
u32 oldcpsr = cpu->CPSR;
cpu->CPSR &= ~0xBF;
cpu->CPSR |= 0x93;