aboutsummaryrefslogtreecommitdiff
path: root/src/ARMInterpreter_ALU.cpp
diff options
context:
space:
mode:
authorPedro <pedroignacioperezvargas@gmail.com>2021-05-27 07:15:16 -0300
committerGitHub <noreply@github.com>2021-05-27 12:15:16 +0200
commitf74387a8c15cdf901957e93058e1b86e55dcd398 (patch)
tree51475d9eeafabd1692cffc2dc245c865211d70a9 /src/ARMInterpreter_ALU.cpp
parent308e5df426661c4487f57adfa68413f6066edbe4 (diff)
Implement NO$GBA debug registers. (#1110)
* Implement NO$GBA debug registers. NO$GBA comes with 4 debug registers that allow a ROM to print text to the emulator terminal and 2 other status registers, one with the name of the emulator and the other with the clock cycles count. This commit implements them for the ARMv5 processor. Some small things to note: - `NocashPrint` was changed and now it takes an address to _the string_ instead of the flags before it (those don't do anything anyways). - The "Emulation ID" register contains the string "melonDS " followed by version, _not_ "NO$GBA" * Fix styling issue and improve comment regarding NO$GBA message flags
Diffstat (limited to 'src/ARMInterpreter_ALU.cpp')
-rw-r--r--src/ARMInterpreter_ALU.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ARMInterpreter_ALU.cpp b/src/ARMInterpreter_ALU.cpp
index d72a5db..92d1571 100644
--- a/src/ARMInterpreter_ALU.cpp
+++ b/src/ARMInterpreter_ALU.cpp
@@ -661,7 +661,10 @@ void A_MOV_REG_LSL_IMM_DBG(ARM* cpu)
(cpu->NextInstr[0] & 0xFF000000) == 0xEA000000 && // branch
(cpu->NextInstr[1] & 0xFFFF) == 0x6464)
{
- u32 addr = cpu->R[15] + 2;
+ // GBATek says the two bytes after the 2nd ID are _reserved_ for flags
+ // but since they serve no purpose ATTOW, we can skip them
+ u32 addr = cpu->R[15] + 4; // Skip 2nd ID and flags
+ // TODO: Pass flags to NocashPrint
NDS::NocashPrint(cpu->Num, addr);
}
}
@@ -1527,7 +1530,10 @@ void T_MOV_HIREG(ARM* cpu)
(cpu->NextInstr[0] & 0xF800) == 0xE000 && // branch
(cpu->NextInstr[1] & 0xFFFF) == 0x6464)
{
- u32 addr = cpu->R[15] + 2;
+ // GBATek says the two bytes after the 2nd ID are _reserved_ for flags
+ // but since they serve no purpose ATTOW, we can skip them
+ u32 addr = cpu->R[15] + 4; // Skip 2nd ID and flags
+ // TODO: Pass flags to NocashPrint
NDS::NocashPrint(cpu->Num, addr);
}
}