Fix a DSP disasm problem, misc minor stuff .. not much to see here

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3745 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-07-11 10:18:25 +00:00
parent aa10f4d2e0
commit ccebd7512e
8 changed files with 49 additions and 17 deletions

View File

@ -81,6 +81,24 @@ void XEmitter::ABI_CallFunctionCC(void *func, u32 param1, u32 param2) {
ABI_RestoreStack(2 * 4);
}
void XEmitter::ABI_CallFunctionCCC(void *func, u32 param1, u32 param2, u32 param3) {
ABI_AlignStack(3 * 4);
PUSH(32, Imm32(param3));
PUSH(32, Imm32(param2));
PUSH(32, Imm32(param1));
CALL(func);
ABI_RestoreStack(3 * 4);
}
void XEmitter::ABI_CallFunctionCCP(void *func, u32 param1, u32 param2, void *param3) {
ABI_AlignStack(3 * 4);
PUSH(32, Imm32((u32)param3));
PUSH(32, Imm32(param2));
PUSH(32, Imm32(param1));
CALL(func);
ABI_RestoreStack(3 * 4);
}
// Pass a register as a paremeter.
void XEmitter::ABI_CallFunctionR(void *func, X64Reg reg1) {
ABI_AlignStack(1 * 4);
@ -177,6 +195,20 @@ void XEmitter::ABI_CallFunctionCC(void *func, u32 param1, u32 param2) {
CALL(func);
}
void XEmitter::ABI_CallFunctionCCC(void *func, u32 param1, u32 param2, u32 param3) {
MOV(32, R(ABI_PARAM1), Imm32(param1));
MOV(32, R(ABI_PARAM2), Imm32(param2));
MOV(32, R(ABI_PARAM3), Imm32(param3));
CALL(func);
}
void XEmitter::ABI_CallFunctionCCP(void *func, u32 param1, u32 param2, void *param3) {
MOV(32, R(ABI_PARAM1), Imm32(param1));
MOV(32, R(ABI_PARAM2), Imm32(param2));
MOV(64, R(ABI_PARAM3), Imm64((u64)param3));
CALL(func);
}
// Pass a register as a paremeter.
void XEmitter::ABI_CallFunctionR(void *func, X64Reg reg1) {
if (reg1 != ABI_PARAM1)

View File

@ -585,6 +585,8 @@ public:
// These will destroy the 1 or 2 first "parameter regs".
void ABI_CallFunctionC(void *func, u32 param1);
void ABI_CallFunctionCC(void *func, u32 param1, u32 param2);
void ABI_CallFunctionCCC(void *func, u32 param1, u32 param2, u32 param3);
void ABI_CallFunctionCCP(void *func, u32 param1, u32 param2, void *param3);
void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2);
// Pass a register as a paremeter.
@ -607,7 +609,7 @@ public:
void ABI_RestoreStack(unsigned int frameSize);
// Sets up a __cdecl function.
// Only x64 really needs the parameter.
// Only x64 really needs the parameter count.
void ABI_EmitPrologue(int maxCallParams);
void ABI_EmitEpilogue(int maxCallParams);

View File

@ -102,17 +102,8 @@ namespace Memory
u32 Read_Opcode(const u32 _Address);
// For use by emulator
/* Local byteswap shortcuts. They are placed inline so that they may hopefully be executed faster
than otherwise */
inline u8 bswap(u8 val) {return val;}
inline u16 bswap(u16 val) {return Common::swap16(val);}
inline u32 bswap(u32 val) {return Common::swap32(val);}
inline u64 bswap(u64 val) {return Common::swap64(val);}
// =================
// Read and write functions
#define NUMHWMEMFUN 64
#define HWSHIFT 10

View File

@ -77,6 +77,13 @@ extern readFn8 hwReadWii8 [NUMHWMEMFUN];
extern readFn16 hwReadWii16[NUMHWMEMFUN];
extern readFn32 hwReadWii32[NUMHWMEMFUN];
// Overloaded byteswap functions, for use within the templated functions below.
inline u8 bswap(u8 val) {return val;}
inline u16 bswap(u16 val) {return Common::swap16(val);}
inline u32 bswap(u32 val) {return Common::swap32(val);}
inline u64 bswap(u64 val) {return Common::swap64(val);}
// =================
///////////////////////////////////////////////////////////////////////////////////
// Read and write
// ----------------

View File

@ -317,7 +317,6 @@ void dsp_op_ext_ls_epi(const UDSPInstruction& opc)
}
}
void dsp_op_ext_sl_pro(const UDSPInstruction& opc)
{
u8 areg = (opc.hex & 0x1) + 0x1e;
@ -334,13 +333,12 @@ void dsp_op_ext_sl_pro(const UDSPInstruction& opc)
}
}
void dsp_op_ext_sl_epi(const UDSPInstruction& opc)
{
u8 dreg = ((opc.hex >> 4) & 0x3) + 0x18;
u16 val = dsp_dmem_read(g_dsp.r[0x03]);
const u8 sreg = 0x03;
u16 val = dsp_dmem_read(g_dsp.r[sreg]);
dsp_op_write_reg(dreg, val);
u8 sreg = 0x03;
if (opc.hex & 0x8) // SLM/SLMN
{
@ -379,6 +377,8 @@ void dsp_op_ext_ld(const UDSPInstruction& opc)
}
else
{
// Hmm
// if (sreg != 0x3)
dsp_increment_addr_reg(0x03);
}
}

View File

@ -48,12 +48,12 @@ enum partype_t
P_REG1A = P_REG | 0x1a80,
P_REG1C = P_REG | 0x1c00,
// P_ACC = P_REG | 0x1c10, // used for global accum (gcdsptool's value)
P_ACC_D = P_REG | 0x1c80,
P_ACCL = P_REG | 0x1c00, // used for low part of accum
P_ACCM = P_REG | 0x1e00, // used for mid part of accum
// The following are not in gcdsptool
P_ACCM_D = P_REG | 0x1e80,
P_ACC = P_REG | 0x2000, // used for full accum.
P_ACC_D = P_REG | 0x2080,
P_AX = P_REG | 0x2200,
P_REGS_MASK = 0x03f80, // gcdsptool's value = 0x01f80
P_REF = P_REG | 0x4000,

View File

@ -154,7 +154,7 @@ void HandleLoop()
if (rLoopAddress > 0 && rLoopCounter > 0)
{
// FIXME: why -1?
// FIXME: why -1? because we just read past it.
if (g_dsp.pc - 1 == rLoopAddress)
{
rLoopCounter--;

View File

@ -32,7 +32,7 @@ namespace DSPInterpreter {
s64 dsp_multiply_conditional_unsigned(u16 a, u16 b)
{
s64 prod;
#if 0 // Makes games sound horrible. TODO: activate and figure out why - it's been verified through DSPSpy :/
#if 0 // Makes AX games sound horrible. TODO: activate and figure out why - it's been verified through DSPSpy :/
if (g_dsp.r[DSP_REG_SR] & SR_MUL_UNSIGNED)
prod = (u64)a * (u64)b; // won't overflow 32-bits
else