DSP: Eliminate some magic values related to the CR register

Makes some values more immediately readable.
This commit is contained in:
Lioncash 2020-12-29 08:06:53 -05:00
parent 3f68aceaca
commit 64f93610ee
5 changed files with 11 additions and 9 deletions

View File

@ -161,7 +161,7 @@ bool SDSP::Initialize(const DSPInitOptions& opts)
r.sr |= SR_INT_ENABLE;
r.sr |= SR_EXT_INT_ENABLE;
cr = 0x804;
cr = CR_INIT | CR_HALT;
InitializeIFX();
// Mostly keep IRAM write protected. We unprotect only when DMA-ing
// in new ucodes.

View File

@ -181,9 +181,11 @@ enum class StackRegister
// See HW/DSP.cpp.
enum : u32
{
CR_RESET = 0x0001,
CR_EXTERNAL_INT = 0x0002,
CR_HALT = 0x0004,
CR_INIT = 0x0400
CR_INIT_CODE = 0x0400,
CR_INIT = 0x0800
};
// SR bits

View File

@ -122,7 +122,7 @@ void Interpreter::rti(const UDSPInstruction)
void Interpreter::halt(const UDSPInstruction)
{
auto& state = m_dsp_core.DSPState();
state.cr |= 0x4;
state.cr |= CR_HALT;
state.pc--;
}

View File

@ -201,7 +201,7 @@ void Interpreter::WriteCR(u16 val)
{
INFO_LOG_FMT(DSPLLE, "DSP_CONTROL RESET");
m_dsp_core.Reset();
val &= ~1;
val &= ~CR_RESET;
}
// init
else if (val == 4)
@ -210,7 +210,7 @@ void Interpreter::WriteCR(u16 val)
// OSInitAudioSystem ucode should send this mail - not DSP core itself
INFO_LOG_FMT(DSPLLE, "DSP_CONTROL INIT");
m_dsp_core.SetInitHax(true);
val |= 0x800;
val |= CR_INIT;
}
// update cr
@ -223,11 +223,11 @@ u16 Interpreter::ReadCR()
if ((state.pc & 0x8000) != 0)
{
state.cr |= 0x800;
state.cr |= CR_INIT;
}
else
{
state.cr &= ~0x800;
state.cr &= ~CR_INIT;
}
return state.cr;

View File

@ -273,9 +273,9 @@ void DSPEmitter::rti(const UDSPInstruction opc)
// HALT
// 0000 0000 0020 0001
// Stops execution of DSP code. Sets bit DSP_CR_HALT in register DREG_CR.
void DSPEmitter::halt(const UDSPInstruction opc)
void DSPEmitter::halt(const UDSPInstruction)
{
OR(16, M_SDSP_cr(), Imm16(4));
OR(16, M_SDSP_cr(), Imm16(CR_HALT));
// g_dsp.pc = dsp_reg_load_stack(StackRegister::Call);
dsp_reg_load_stack(StackRegister::Call);
MOV(16, M_SDSP_pc(), R(DX));