Merge pull request #4653 from lioncash/dsp-define

DSPInterpreter: Get rid of a #define constant
This commit is contained in:
Matthew Parlane 2017-01-14 10:54:48 +13:00 committed by GitHub
commit 30e57cecf7
5 changed files with 6 additions and 10 deletions

View File

@ -48,7 +48,7 @@ void lrs(const UDSPInstruction opc)
// Move value from data memory pointed by address M to register $D. // Move value from data memory pointed by address M to register $D.
void lr(const UDSPInstruction opc) void lr(const UDSPInstruction opc)
{ {
u8 reg = opc & DSP_REG_MASK; u8 reg = opc & 0x1F;
u16 addr = dsp_fetch_code(); u16 addr = dsp_fetch_code();
u16 val = dsp_dmem_read(addr); u16 val = dsp_dmem_read(addr);
dsp_op_write_reg(reg, val); dsp_op_write_reg(reg, val);
@ -61,7 +61,7 @@ void lr(const UDSPInstruction opc)
// Store value from register $S to a memory pointed by address M. // Store value from register $S to a memory pointed by address M.
void sr(const UDSPInstruction opc) void sr(const UDSPInstruction opc)
{ {
u8 reg = opc & DSP_REG_MASK; u8 reg = opc & 0x1F;
u16 addr = dsp_fetch_code(); u16 addr = dsp_fetch_code();
if (reg >= DSP_REG_ACM0) if (reg >= DSP_REG_ACM0)

View File

@ -41,7 +41,7 @@ void mrr(const UDSPInstruction opc)
// S16 mode. // S16 mode.
void lri(const UDSPInstruction opc) void lri(const UDSPInstruction opc)
{ {
u8 reg = opc & DSP_REG_MASK; u8 reg = opc & 0x1F;
u16 imm = dsp_fetch_code(); u16 imm = dsp_fetch_code();
dsp_op_write_reg(reg, imm); dsp_op_write_reg(reg, imm);
dsp_conditional_extend_accum(reg); dsp_conditional_extend_accum(reg);

View File

@ -6,8 +6,6 @@
#include "Core/DSP/DSPCommon.h" #include "Core/DSP/DSPCommon.h"
#define DSP_REG_MASK 0x1f
namespace DSP namespace DSP
{ {
namespace Interpreter namespace Interpreter

View File

@ -8,7 +8,6 @@
#include "Core/DSP/DSPCore.h" #include "Core/DSP/DSPCore.h"
#include "Core/DSP/DSPMemoryMap.h" #include "Core/DSP/DSPMemoryMap.h"
#include "Core/DSP/Interpreter/DSPInterpreter.h"
#include "Core/DSP/Jit/DSPEmitter.h" #include "Core/DSP/Jit/DSPEmitter.h"
using namespace Gen; using namespace Gen;
@ -70,7 +69,7 @@ void DSPEmitter::lrs(const UDSPInstruction opc)
// Move value from data memory pointed by address M to register $D. // Move value from data memory pointed by address M to register $D.
void DSPEmitter::lr(const UDSPInstruction opc) void DSPEmitter::lr(const UDSPInstruction opc)
{ {
int reg = opc & DSP_REG_MASK; int reg = opc & 0x1F;
u16 address = dsp_imem_read(compilePC + 1); u16 address = dsp_imem_read(compilePC + 1);
dmem_read_imm(address); dmem_read_imm(address);
dsp_op_write_reg(reg, EAX); dsp_op_write_reg(reg, EAX);
@ -83,7 +82,7 @@ void DSPEmitter::lr(const UDSPInstruction opc)
// Store value from register $S to a memory pointed by address M. // Store value from register $S to a memory pointed by address M.
void DSPEmitter::sr(const UDSPInstruction opc) void DSPEmitter::sr(const UDSPInstruction opc)
{ {
u8 reg = opc & DSP_REG_MASK; u8 reg = opc & 0x1F;
u16 address = dsp_imem_read(compilePC + 1); u16 address = dsp_imem_read(compilePC + 1);
X64Reg tmp1 = gpr.GetFreeXReg(); X64Reg tmp1 = gpr.GetFreeXReg();

View File

@ -6,7 +6,6 @@
#include "Core/DSP/DSPCore.h" #include "Core/DSP/DSPCore.h"
#include "Core/DSP/DSPMemoryMap.h" #include "Core/DSP/DSPMemoryMap.h"
#include "Core/DSP/Interpreter/DSPInterpreter.h"
#include "Core/DSP/Jit/DSPEmitter.h" #include "Core/DSP/Jit/DSPEmitter.h"
using namespace Gen; using namespace Gen;
@ -41,7 +40,7 @@ void DSPEmitter::mrr(const UDSPInstruction opc)
// S16 mode. // S16 mode.
void DSPEmitter::lri(const UDSPInstruction opc) void DSPEmitter::lri(const UDSPInstruction opc)
{ {
u8 reg = opc & DSP_REG_MASK; u8 reg = opc & 0x1F;
u16 imm = dsp_imem_read(compilePC + 1); u16 imm = dsp_imem_read(compilePC + 1);
dsp_op_write_reg_imm(reg, imm); dsp_op_write_reg_imm(reg, imm);
dsp_conditional_extend_accum_imm(reg, imm); dsp_conditional_extend_accum_imm(reg, imm);