From 57105f08d67991cdd1585e22d2d6f7addd38e9ad Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 30 Mar 2009 03:27:31 +0000 Subject: [PATCH] use dolphin-style typedefs in dsp-lle testing git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2793 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugin_DSP_LLE-testing/Src/Globals.cpp | 2 +- .../Plugin_DSP_LLE-testing/Src/Globals.h | 16 +- .../Src/HLE_Functions.cpp | 106 +-- .../Plugin_DSP_LLE-testing/Src/HLE_Helper.cpp | 4 +- .../Plugin_DSP_LLE-testing/Src/HLE_Helper.h | 58 +- .../Plugin_DSP_LLE-testing/Src/Tools.cpp | 8 +- .../Plugin_DSP_LLE-testing/Src/Tools.h | 10 +- .../Src/disassemble.cpp | 42 +- .../Plugin_DSP_LLE-testing/Src/disassemble.h | 8 +- .../Plugin_DSP_LLE-testing/Src/gdsp_aram.cpp | 24 +- .../Plugin_DSP_LLE-testing/Src/gdsp_aram.h | 2 +- .../Src/gdsp_ext_op.cpp | 58 +- .../Plugin_DSP_LLE-testing/Src/gdsp_ext_op.h | 4 +- .../Plugin_DSP_LLE-testing/Src/gdsp_ifx.h | 4 +- .../Src/gdsp_interface.cpp | 58 +- .../Src/gdsp_interface.h | 14 +- .../Src/gdsp_interpreter.cpp | 72 +- .../Src/gdsp_interpreter.h | 42 +- .../Src/gdsp_memory.cpp | 26 +- .../Plugin_DSP_LLE-testing/Src/gdsp_memory.h | 10 +- .../Src/gdsp_opcodes.cpp | 682 +++++++++--------- .../Plugin_DSP_LLE-testing/Src/gdsp_opcodes.h | 28 +- .../Src/gdsp_opcodes_helper.h | 66 +- .../Src/gdsp_registers.cpp | 10 +- .../Src/gdsp_registers.h | 4 +- .../Plugin_DSP_LLE-testing/Src/main.cpp | 4 +- .../Plugin_DSP_LLE-testing/Src/opcodes.cpp | 4 +- .../Plugin_DSP_LLE-testing/Src/opcodes.h | 22 +- 28 files changed, 687 insertions(+), 701 deletions(-) diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Globals.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Globals.cpp index 2704766b90..0f6f18f4e0 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Globals.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Globals.cpp @@ -66,7 +66,7 @@ void ProfilerInit() memset(g_profileMap, 0, sizeof(g_profileMap)); } -void ProfilerDump(uint64 count) +void ProfilerDump(u64 count) { FILE* pFile = fopen("DSP_Prof.txt", "wt"); if (pFile != NULL) diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Globals.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Globals.h index 730706cba7..95f752520c 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Globals.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Globals.h @@ -28,25 +28,11 @@ void DSP_DebugBreak(); - -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef unsigned long long uint64; -typedef unsigned int uint; - -typedef signed char sint8; -typedef signed short sint16; -typedef signed int sint32; -typedef signed long long sint64; - -typedef const uint32 cuint32; - u16 Memory_Read_U16(u32 _uAddress); // For PB address detection u32 Memory_Read_U32(u32 _uAddress); #if PROFILE - void ProfilerDump(uint64 _count); + void ProfilerDump(u64 _count); void ProfilerInit(); void ProfilerAddDelta(int _addr, int _delta); void ProfilerStart(); diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Functions.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Functions.cpp index ceb9ff4e99..c5bd81dda8 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Functions.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Functions.cpp @@ -22,60 +22,60 @@ #include "HLE_Helper.h" -uint16& R00 = g_dsp.r[0x00]; -uint16& R01 = g_dsp.r[0x01]; -uint16& R02 = g_dsp.r[0x02]; -uint16& R03 = g_dsp.r[0x03]; -uint16& R04 = g_dsp.r[0x04]; -uint16& R05 = g_dsp.r[0x05]; -uint16& R06 = g_dsp.r[0x06]; -uint16& R07 = g_dsp.r[0x07]; -uint16& R08 = g_dsp.r[0x08]; -uint16& R09 = g_dsp.r[0x09]; -uint16& R0A = g_dsp.r[0x0a]; -uint16& R0B = g_dsp.r[0x0b]; -uint16& R0C = g_dsp.r[0x0c]; -uint16& R0D = g_dsp.r[0x0d]; -uint16& R0E = g_dsp.r[0x0e]; -uint16& R0F = g_dsp.r[0x0f]; -uint16& R10 = g_dsp.r[0x10]; -uint16& R11 = g_dsp.r[0x11]; -uint16& R12 = g_dsp.r[0x12]; -uint16& R13 = g_dsp.r[0x13]; -uint16& R14 = g_dsp.r[0x14]; -uint16& R15 = g_dsp.r[0x15]; -uint16& R16 = g_dsp.r[0x16]; -uint16& R17 = g_dsp.r[0x17]; -uint16& R18 = g_dsp.r[0x18]; -uint16& R19 = g_dsp.r[0x19]; -uint16& R1A = g_dsp.r[0x1a]; -uint16& R1B = g_dsp.r[0x1b]; -uint16& R1C = g_dsp.r[0x1c]; -uint16& R1D = g_dsp.r[0x1d]; -uint16& R1E = g_dsp.r[0x1e]; -uint16& R1F = g_dsp.r[0x1f]; +u16& R00 = g_dsp.r[0x00]; +u16& R01 = g_dsp.r[0x01]; +u16& R02 = g_dsp.r[0x02]; +u16& R03 = g_dsp.r[0x03]; +u16& R04 = g_dsp.r[0x04]; +u16& R05 = g_dsp.r[0x05]; +u16& R06 = g_dsp.r[0x06]; +u16& R07 = g_dsp.r[0x07]; +u16& R08 = g_dsp.r[0x08]; +u16& R09 = g_dsp.r[0x09]; +u16& R0A = g_dsp.r[0x0a]; +u16& R0B = g_dsp.r[0x0b]; +u16& R0C = g_dsp.r[0x0c]; +u16& R0D = g_dsp.r[0x0d]; +u16& R0E = g_dsp.r[0x0e]; +u16& R0F = g_dsp.r[0x0f]; +u16& R10 = g_dsp.r[0x10]; +u16& R11 = g_dsp.r[0x11]; +u16& R12 = g_dsp.r[0x12]; +u16& R13 = g_dsp.r[0x13]; +u16& R14 = g_dsp.r[0x14]; +u16& R15 = g_dsp.r[0x15]; +u16& R16 = g_dsp.r[0x16]; +u16& R17 = g_dsp.r[0x17]; +u16& R18 = g_dsp.r[0x18]; +u16& R19 = g_dsp.r[0x19]; +u16& R1A = g_dsp.r[0x1a]; +u16& R1B = g_dsp.r[0x1b]; +u16& R1C = g_dsp.r[0x1c]; +u16& R1D = g_dsp.r[0x1d]; +u16& R1E = g_dsp.r[0x1e]; +u16& R1F = g_dsp.r[0x1f]; -uint16& ST0 = g_dsp.r[0x0c]; -uint16& ST1 = g_dsp.r[0x0d]; -uint16& ST2 = g_dsp.r[0x0e]; -uint16& ST3 = g_dsp.r[0x0f]; -uint16& ACH0 = g_dsp.r[0x10]; -uint16& ACH1 = g_dsp.r[0x11]; -uint16& CR = g_dsp.r[0x12]; -uint16& SR = g_dsp.r[0x13]; -uint16& PROD_l = g_dsp.r[0x14]; -uint16& PROD_m1 = g_dsp.r[0x15]; -uint16& PROD_h = g_dsp.r[0x16]; -uint16& PROD_m2 = g_dsp.r[0x17]; -uint16& AX0_l = g_dsp.r[0x18]; -uint16& AX1_l = g_dsp.r[0x19]; -uint16& AX0_h = g_dsp.r[0x1a]; -uint16& AX1_h = g_dsp.r[0x1b]; -uint16& AC0_l = g_dsp.r[0x1c]; -uint16& AC1_l = g_dsp.r[0x1d]; -uint16& AC0_m = g_dsp.r[0x1e]; -uint16& AC1_m = g_dsp.r[0x1f]; +u16& ST0 = g_dsp.r[0x0c]; +u16& ST1 = g_dsp.r[0x0d]; +u16& ST2 = g_dsp.r[0x0e]; +u16& ST3 = g_dsp.r[0x0f]; +u16& ACH0 = g_dsp.r[0x10]; +u16& ACH1 = g_dsp.r[0x11]; +u16& CR = g_dsp.r[0x12]; +u16& SR = g_dsp.r[0x13]; +u16& PROD_l = g_dsp.r[0x14]; +u16& PROD_m1 = g_dsp.r[0x15]; +u16& PROD_h = g_dsp.r[0x16]; +u16& PROD_m2 = g_dsp.r[0x17]; +u16& AX0_l = g_dsp.r[0x18]; +u16& AX1_l = g_dsp.r[0x19]; +u16& AX0_h = g_dsp.r[0x1a]; +u16& AX1_h = g_dsp.r[0x1b]; +u16& AC0_l = g_dsp.r[0x1c]; +u16& AC1_l = g_dsp.r[0x1d]; +u16& AC0_m = g_dsp.r[0x1e]; +u16& AC1_m = g_dsp.r[0x1f]; TAccumulator<0> ACC0; TAccumulator<1> ACC1; @@ -84,7 +84,7 @@ CProd PROD; u16 HLE_ROM_80E7_81F8() { - sint8 MultiplyModifier = GetMultiplyModifier(); + s8 MultiplyModifier = GetMultiplyModifier(); // l_80E7: AX0_h = ReadDMEM(R00); R00++; diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Helper.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Helper.cpp index 4fc201007e..b6beb185ef 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Helper.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Helper.cpp @@ -25,12 +25,12 @@ #include "gdsp_opcodes_helper.h" -bool WriteDMEM(uint16 addr, uint16 val) +bool WriteDMEM(u16 addr, u16 val) { return dsp_dmem_write(addr, val); } -uint16 ReadDMEM(uint16 addr) +u16 ReadDMEM(u16 addr) { return dsp_dmem_read(addr); } diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Helper.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Helper.h index ffd3866fe9..90137a076f 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Helper.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/HLE_Helper.h @@ -20,10 +20,10 @@ #include "gdsp_interpreter.h" -bool WriteDMEM(uint16 addr, uint16 val); -uint16 ReadDMEM(uint16 addr); -void Update_SR_Register(sint64 _Value); -sint8 GetMultiplyModifier(); +bool WriteDMEM(u16 addr, u16 val); +u16 ReadDMEM(u16 addr); +void Update_SR_Register(s64 _Value); +s8 GetMultiplyModifier(); template class TAccumulator @@ -35,56 +35,56 @@ public: _assert_(N < 2); } - void operator=(sint64 val) + void operator=(s64 val) { setValue(val); } - void operator<<=(sint64 value) + void operator<<=(s64 value) { - sint64 acc = getValue(); + s64 acc = getValue(); acc <<= value; setValue(acc); } - void operator>>=(sint64 value) + void operator>>=(s64 value) { - sint64 acc = getValue(); + s64 acc = getValue(); acc >>= value; setValue(acc); } - void operator+=(sint64 value) + void operator+=(s64 value) { - sint64 acc = getValue(); + s64 acc = getValue(); acc += value; setValue(acc); } - operator sint64() + operator s64() { return getValue(); } - operator uint64() + operator u64() { return getValue(); } - inline void setValue(sint64 val) + inline void setValue(s64 val) { - g_dsp.r[0x1c + N] = (uint16)val; + g_dsp.r[0x1c + N] = (u16)val; val >>= 16; - g_dsp.r[0x1e + N] = (uint16)val; + g_dsp.r[0x1e + N] = (u16)val; val >>= 16; - g_dsp.r[0x10 + N] = (uint16)val; + g_dsp.r[0x10 + N] = (u16)val; } - inline sint64 getValue() + inline s64 getValue() { - sint64 val; - sint64 low_acc; - val = (sint8)g_dsp.r[0x10 + N]; + s64 val; + s64 low_acc; + val = (s8)g_dsp.r[0x10 + N]; val <<= 32; low_acc = g_dsp.r[0x1e + N]; low_acc <<= 16; @@ -101,21 +101,21 @@ public: { } - void operator=(sint64 val) + void operator=(s64 val) { - g_dsp.r[0x14] = (uint16)val; + g_dsp.r[0x14] = (u16)val; val >>= 16; - g_dsp.r[0x15] = (uint16)val; + g_dsp.r[0x15] = (u16)val; val >>= 16; - g_dsp.r[0x16] = (uint16)val; + g_dsp.r[0x16] = (u16)val; g_dsp.r[0x17] = 0; } - operator sint64() + operator s64() { - sint64 val; - sint64 low_prod; - val = (sint8)g_dsp.r[0x16]; + s64 val; + s64 low_prod; + val = (s8)g_dsp.r[0x16]; val <<= 32; low_prod = g_dsp.r[0x15]; low_prod += g_dsp.r[0x17]; diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.cpp index 8686e61213..4d1325832c 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.cpp @@ -23,7 +23,7 @@ #include "gdsp_interpreter.h" -bool DumpDSPCode(uint32 _Address, uint32 _Length, uint32 crc) +bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc) { char szFilename[MAX_PATH]; sprintf(szFilename, "c:\\_\\DSP_UC_%08X.bin", crc); @@ -44,7 +44,7 @@ bool DumpDSPCode(uint32 _Address, uint32 _Length, uint32 crc) } -uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength) +u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength) { unsigned long CRC = 0xFFFFFFFF; @@ -71,7 +71,7 @@ uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength) } -bool DumpCWCode(uint32 _Address, uint32 _Length) +bool DumpCWCode(u32 _Address, u32 _Length) { FILE* pFile = fopen("d:\\DSP_UCode.bin", "wb"); @@ -79,7 +79,7 @@ bool DumpCWCode(uint32 _Address, uint32 _Length) { for (size_t i = _Address; i < _Address + _Length; i++) { - uint16 val = Common::swap16(g_dsp.iram[i]); + u16 val = Common::swap16(g_dsp.iram[i]); fprintf(pFile, " cw 0x%04x \n", val); } diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.h index 4df998aec1..2c9e242c5e 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.h @@ -20,7 +20,7 @@ // UDSPControl union UDSPControl { - uint16 Hex; + u16 Hex; struct { unsigned DSPReset : 1; // Write 1 to reset and waits for 0 @@ -40,11 +40,11 @@ union UDSPControl unsigned pad : 4; }; - UDSPControl(uint16 _Hex = 0) + UDSPControl(u16 _Hex = 0) : Hex(_Hex) {} }; -bool DumpDSPCode(uint32 _Address, uint32 _Length, uint32 crc); -uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength); -bool DumpCWCode(uint32 _Address, uint32 _Length); +bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc); +u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength); +bool DumpCWCode(u32 _Address, u32 _Length); diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.cpp index 0b7ceb8894..495c5a72ef 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.cpp @@ -37,15 +37,15 @@ #pragma warning(disable:4996) #endif -uint32 unk_opcodes[0x10000]; +u32 unk_opcodes[0x10000]; -uint16 swap16(uint16 x); +u16 swap16(u16 x); // predefined labels typedef struct pdlabel_t { - uint16 addr; + u16 addr; const char* name; const char* description; } pdlabels_t; @@ -138,7 +138,7 @@ pdlabel_t regnames[] = {0x23, "AX1", "Additional Accumulators 1",}, }; -const char* pdname(uint16 val) +const char* pdname(u16 val) { static char tmpstr[12]; // nasty @@ -155,10 +155,10 @@ const char* pdname(uint16 val) } -char* gd_dis_params(gd_globals_t* gdg, opc_t* opc, uint16 op1, uint16 op2, char* strbuf) +char* gd_dis_params(gd_globals_t* gdg, opc_t* opc, u16 op1, u16 op2, char* strbuf) { char* buf = strbuf; - uint32 val; + u32 val; int j; for (j = 0; j < opc->param_count; j++) @@ -189,7 +189,7 @@ char* gd_dis_params(gd_globals_t* gdg, opc_t* opc, uint16 op1, uint16 op2, char* val = val >> opc->params[j].lshift; } - uint32 type; + u32 type; type = opc->params[j].type; if (type & P_REG) @@ -243,7 +243,7 @@ char* gd_dis_params(gd_globals_t* gdg, opc_t* opc, uint16 op1, uint16 op2, char* if (opc->params[j].size != 2) { - val = (uint16)(sint8)val; + val = (u16)(s8)val; } if (gdg->decode_names) @@ -278,7 +278,7 @@ gd_globals_t* gd_init() } -uint16 gd_dis_get_opcode_size(gd_globals_t* gdg) +u16 gd_dis_get_opcode_size(gd_globals_t* gdg) { opc_t* opc = 0; opc_t* opc_ext = 0; @@ -289,11 +289,11 @@ uint16 gd_dis_get_opcode_size(gd_globals_t* gdg) return(1); } - uint32 op1 = swap16(gdg->binbuf[gdg->pc & 0x0fff]); + u32 op1 = swap16(gdg->binbuf[gdg->pc & 0x0fff]); - for (uint32 j = 0; j < opcodes_size; j++) + for (u32 j = 0; j < opcodes_size; j++) { - uint16 mask; + u16 mask; if (opcodes[j].size & P_EXT) { @@ -330,7 +330,7 @@ uint16 gd_dis_get_opcode_size(gd_globals_t* gdg) { // opcode has an extension // find opcode - for (uint32 j = 0; j < opcodes_ext_size; j++) + for (u32 j = 0; j < opcodes_ext_size; j++) { if ((op1 & opcodes_ext[j].opcode_mask) == opcodes_ext[j].opcode) { @@ -353,11 +353,11 @@ uint16 gd_dis_get_opcode_size(gd_globals_t* gdg) char* gd_dis_opcode(gd_globals_t* gdg) { - uint32 j; - uint32 op1, op2; + u32 j; + u32 op1, op2; opc_t* opc = NULL; opc_t* opc_ext = NULL; - uint16 pc; + u16 pc; char* buf = gdg->buffer; bool extended; @@ -376,7 +376,7 @@ char* gd_dis_opcode(gd_globals_t* gdg) // find opcode for (j = 0; j < opcodes_size; j++) { - uint16 mask; + u16 mask; if (opcodes[j].size & P_EXT) { @@ -510,7 +510,7 @@ char* gd_dis_opcode(gd_globals_t* gdg) bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output) { FILE* in; - uint32 size; + u32 size; in = fopen(name, "rb"); @@ -522,7 +522,7 @@ bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output) fseek(in, 0, SEEK_END); size = (int)ftell(in); fseek(in, 0, SEEK_SET); - gdg->binbuf = (uint16*)malloc(size); + gdg->binbuf = (u16*)malloc(size); fread(gdg->binbuf, 1, size, in); gdg->buffer = (char*)malloc(256); @@ -550,7 +550,7 @@ void gd_dis_close_unkop() { FILE* uo; int i, j; - uint32 count = 0; + u32 count = 0; uo = fopen("uo.bin", "wb"); @@ -614,7 +614,7 @@ void gd_dis_open_unkop() } -const char* gd_dis_get_reg_name(uint16 reg) +const char* gd_dis_get_reg_name(u16 reg) { return(regnames[reg].name); } diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.h index 13772d12f3..701ca56f80 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.h @@ -33,14 +33,14 @@ typedef struct gd_globals_t bool decode_names; bool decode_registers; - uint16* binbuf; - uint16 pc; + u16* binbuf; + u16 pc; char* buffer; - uint16 buffer_size; + u16 buffer_size; char ext_separator; } gd_globals_t; char* gd_dis_opcode(gd_globals_t* gdg); bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output); -const char* gd_dis_get_reg_name(uint16 reg); +const char* gd_dis_get_reg_name(u16 reg); diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.cpp index 78ef251f09..47019f21ee 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.cpp @@ -18,12 +18,12 @@ #include "Globals.h" #include "gdsp_interface.h" -extern uint16 dsp_swap16(uint16 x); +extern u16 dsp_swap16(u16 x); // The hardware adpcm decoder :) -sint16 ADPCM_Step(uint32& _rSamplePos, uint32 _BaseAddress) +s16 ADPCM_Step(u32& _rSamplePos, u32 _BaseAddress) { - sint16* pCoefTable = (sint16*)&gdsp_ifx_regs[DSP_COEF_A1_0]; + s16* pCoefTable = (s16*)&gdsp_ifx_regs[DSP_COEF_A1_0]; if (((_rSamplePos) & 15) == 0) { @@ -34,8 +34,8 @@ sint16 ADPCM_Step(uint32& _rSamplePos, uint32 _BaseAddress) int scale = 1 << (gdsp_ifx_regs[DSP_PRED_SCALE] & 0xF); int coef_idx = gdsp_ifx_regs[DSP_PRED_SCALE] >> 4; - sint32 coef1 = pCoefTable[coef_idx * 2 + 0]; - sint32 coef2 = pCoefTable[coef_idx * 2 + 1]; + s32 coef1 = pCoefTable[coef_idx * 2 + 0]; + s32 coef2 = pCoefTable[coef_idx * 2 + 1]; int temp = (_rSamplePos & 1) ? (g_dspInitialize.pARAM_Read_U8(_rSamplePos >> 1) & 0xF) : @@ -45,7 +45,7 @@ sint16 ADPCM_Step(uint32& _rSamplePos, uint32 _BaseAddress) temp -= 16; // 0x400 = 0.5 in 11-bit fixed point - int val = (scale * temp) + ((0x400 + coef1 * (sint16)gdsp_ifx_regs[DSP_YN1] + coef2 * (sint16)gdsp_ifx_regs[DSP_YN2]) >> 11); + int val = (scale * temp) + ((0x400 + coef1 * (s16)gdsp_ifx_regs[DSP_YN1] + coef2 * (s16)gdsp_ifx_regs[DSP_YN2]) >> 11); // Clamp values. if (val > 0x7FFF) @@ -63,14 +63,14 @@ sint16 ADPCM_Step(uint32& _rSamplePos, uint32 _BaseAddress) return val; } -extern void gdsp_generate_exception(uint8 level); -uint16 dsp_read_aram() +extern void gdsp_generate_exception(u8 level); +u16 dsp_read_aram() { - // uint32 BaseAddress = (gdsp_ifx_regs[DSP_ACSAH] << 16) | gdsp_ifx_regs[DSP_ACSAL]; - uint32 EndAddress = (gdsp_ifx_regs[DSP_ACEAH] << 16) | gdsp_ifx_regs[DSP_ACEAL]; - uint32 Address = (gdsp_ifx_regs[DSP_ACCAH] << 16) | gdsp_ifx_regs[DSP_ACCAL]; + // u32 BaseAddress = (gdsp_ifx_regs[DSP_ACSAH] << 16) | gdsp_ifx_regs[DSP_ACSAL]; + u32 EndAddress = (gdsp_ifx_regs[DSP_ACEAH] << 16) | gdsp_ifx_regs[DSP_ACEAL]; + u32 Address = (gdsp_ifx_regs[DSP_ACCAH] << 16) | gdsp_ifx_regs[DSP_ACCAL]; - uint16 val; + u16 val; // lets the "hardware" decode switch (gdsp_ifx_regs[DSP_FORMAT]) diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.h index d85465986d..3c5685fc0a 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.h @@ -18,6 +18,6 @@ #ifndef _GDSP_ARAM_H #define _GDSP_ARAM_H -uint16 dsp_read_aram(); +u16 dsp_read_aram(); #endif diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ext_op.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ext_op.cpp index 3eec84083f..d082bbe5c3 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ext_op.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ext_op.cpp @@ -33,10 +33,10 @@ // -void dsp_op_ext_r_epi(uint16 _Opcode) +void dsp_op_ext_r_epi(u16 _Opcode) { - uint8 op = (_Opcode >> 2) & 0x3; - uint8 reg = _Opcode & 0x3; + u8 op = (_Opcode >> 2) & 0x3; + u8 reg = _Opcode & 0x3; switch (op) { @@ -59,19 +59,19 @@ void dsp_op_ext_r_epi(uint16 _Opcode) } -void dsp_op_ext_mv(uint16 _Opcode) +void dsp_op_ext_mv(u16 _Opcode) { - uint8 sreg = _Opcode & 0x3; - uint8 dreg = ((_Opcode >> 2) & 0x3); + u8 sreg = _Opcode & 0x3; + u8 dreg = ((_Opcode >> 2) & 0x3); g_dsp.r[dreg + 0x18] = g_dsp.r[sreg + 0x1c]; } -void dsp_op_ext_s(uint16 _Opcode) +void dsp_op_ext_s(u16 _Opcode) { - uint8 dreg = _Opcode & 0x3; - uint8 sreg = ((_Opcode >> 3) & 0x3) + 0x1c; + u8 dreg = _Opcode & 0x3; + u8 sreg = ((_Opcode >> 3) & 0x3) + 0x1c; dsp_dmem_write(g_dsp.r[dreg], g_dsp.r[sreg]); @@ -86,12 +86,12 @@ void dsp_op_ext_s(uint16 _Opcode) } -void dsp_op_ext_l(uint16 _Opcode) +void dsp_op_ext_l(u16 _Opcode) { - uint8 sreg = _Opcode & 0x3; - uint8 dreg = ((_Opcode >> 3) & 0x7) + 0x18; + u8 sreg = _Opcode & 0x3; + u8 dreg = ((_Opcode >> 3) & 0x7) + 0x18; - uint16 val = dsp_dmem_read(g_dsp.r[sreg]); + u16 val = dsp_dmem_read(g_dsp.r[sreg]); g_dsp.r[dreg] = val; if (_Opcode & 0x04) @@ -105,9 +105,9 @@ void dsp_op_ext_l(uint16 _Opcode) } -void dsp_op_ext_ls_pro(uint16 _Opcode) +void dsp_op_ext_ls_pro(u16 _Opcode) { - uint8 areg = (_Opcode & 0x1) + 0x1e; + u8 areg = (_Opcode & 0x1) + 0x1e; dsp_dmem_write(g_dsp.r[0x03], g_dsp.r[areg]); if (_Opcode & 0x8) @@ -121,10 +121,10 @@ void dsp_op_ext_ls_pro(uint16 _Opcode) } -void dsp_op_ext_ls_epi(uint16 _Opcode) +void dsp_op_ext_ls_epi(u16 _Opcode) { - uint8 dreg = ((_Opcode >> 4) & 0x3) + 0x18; - uint16 val = dsp_dmem_read(g_dsp.r[0x00]); + u8 dreg = ((_Opcode >> 4) & 0x3) + 0x18; + u16 val = dsp_dmem_read(g_dsp.r[0x00]); dsp_op_write_reg(dreg, val); if (_Opcode & 0x4) @@ -138,9 +138,9 @@ void dsp_op_ext_ls_epi(uint16 _Opcode) } -void dsp_op_ext_sl_pro(uint16 _Opcode) +void dsp_op_ext_sl_pro(u16 _Opcode) { - uint8 areg = (_Opcode & 0x1) + 0x1e; + u8 areg = (_Opcode & 0x1) + 0x1e; dsp_dmem_write(g_dsp.r[0x00], g_dsp.r[areg]); if (_Opcode & 0x4) @@ -154,10 +154,10 @@ void dsp_op_ext_sl_pro(uint16 _Opcode) } -void dsp_op_ext_sl_epi(uint16 _Opcode) +void dsp_op_ext_sl_epi(u16 _Opcode) { - uint8 dreg = ((_Opcode >> 4) & 0x3) + 0x18; - uint16 val = dsp_dmem_read(g_dsp.r[0x03]); + u8 dreg = ((_Opcode >> 4) & 0x3) + 0x18; + u16 val = dsp_dmem_read(g_dsp.r[0x03]); dsp_op_write_reg(dreg, val); if (_Opcode & 0x8) @@ -171,11 +171,11 @@ void dsp_op_ext_sl_epi(uint16 _Opcode) } -void dsp_op_ext_ld(uint16 _Opcode) +void dsp_op_ext_ld(u16 _Opcode) { - uint8 dreg1 = (((_Opcode >> 5) & 0x1) << 1) + 0x18; - uint8 dreg2 = (((_Opcode >> 4) & 0x1) << 1) + 0x19; - uint8 sreg = _Opcode & 0x3; + u8 dreg1 = (((_Opcode >> 5) & 0x1) << 1) + 0x18; + u8 dreg2 = (((_Opcode >> 4) & 0x1) << 1) + 0x19; + u8 sreg = _Opcode & 0x3; g_dsp.r[dreg1] = dsp_dmem_read(g_dsp.r[sreg]); g_dsp.r[dreg2] = dsp_dmem_read(g_dsp.r[0x03]); @@ -205,7 +205,7 @@ void dsp_op_ext_ld(uint16 _Opcode) // // ================================================================================ -void dsp_op_ext_ops_pro(uint16 _Opcode) +void dsp_op_ext_ops_pro(u16 _Opcode) { if ((_Opcode & 0xFF) == 0){return;} @@ -257,7 +257,7 @@ void dsp_op_ext_ops_pro(uint16 _Opcode) } -void dsp_op_ext_ops_epi(uint16 _Opcode) +void dsp_op_ext_ops_epi(u16 _Opcode) { if ((_Opcode & 0xFF) == 0){return;} diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ext_op.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ext_op.h index b27a5bbcca..78edc28ca2 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ext_op.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ext_op.h @@ -26,8 +26,8 @@ #ifndef _GDSP_EXT_OP_H #define _GDSP_EXT_OP_H -void dsp_op_ext_ops_pro(uint16 _Opcode); -void dsp_op_ext_ops_epi(uint16 _Opcode); +void dsp_op_ext_ops_pro(u16 _Opcode); +void dsp_op_ext_ops_epi(u16 _Opcode); #endif diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ifx.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ifx.h index 24fb43555d..1fc5fa0db7 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ifx.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_ifx.h @@ -28,8 +28,8 @@ #ifndef _GDSP_IFX_H #define _GDSP_IFX_H -void gdsp_ifx_write(uint16 addr, uint16 val); -uint16 gdsp_ifx_read(uint16 addr); +void gdsp_ifx_write(u16 addr, u16 val); +u16 gdsp_ifx_read(u16 addr); #endif diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interface.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interface.cpp index c58859c474..ccf9b2b4cc 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interface.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interface.cpp @@ -66,9 +66,9 @@ void gdsp_dma(); Common::CriticalSection g_CriticalSection; #endif -static volatile uint16 gdsp_mbox[2][2]; +static volatile u16 gdsp_mbox[2][2]; -uint16 gdsp_ifx_regs[256]; +u16 gdsp_ifx_regs[256]; void gdsp_ifx_init() { @@ -86,12 +86,12 @@ void gdsp_ifx_init() } -uint32 gdsp_mbox_peek(uint8 mbx) +u32 gdsp_mbox_peek(u8 mbx) { #if WITH_DSP_ON_THREAD g_CriticalSection.Enter(); #endif - uint32 value = ((gdsp_mbox[mbx][0] << 16) | gdsp_mbox[mbx][1]); + u32 value = ((gdsp_mbox[mbx][0] << 16) | gdsp_mbox[mbx][1]); #if WITH_DSP_ON_THREAD g_CriticalSection.Leave(); #endif @@ -99,7 +99,7 @@ uint32 gdsp_mbox_peek(uint8 mbx) } -void gdsp_mbox_write_h(uint8 mbx, uint16 val) +void gdsp_mbox_write_h(u8 mbx, u16 val) { #if WITH_DSP_ON_THREAD g_CriticalSection.Enter(); @@ -113,7 +113,7 @@ void gdsp_mbox_write_h(uint8 mbx, uint16 val) } -void gdsp_mbox_write_l(uint8 mbx, uint16 val) +void gdsp_mbox_write_l(u8 mbx, u16 val) { #if WITH_DSP_ON_THREAD g_CriticalSection.Enter(); @@ -133,15 +133,15 @@ void gdsp_mbox_write_l(uint8 mbx, uint16 val) } -uint16 gdsp_mbox_read_h(uint8 mbx) +u16 gdsp_mbox_read_h(u8 mbx) { return (gdsp_mbox[mbx][0]); } -uint16 gdsp_mbox_read_l(uint8 mbx) +u16 gdsp_mbox_read_l(u8 mbx) { - uint16 val; + u16 val; #if WITH_DSP_ON_THREAD g_CriticalSection.Enter(); #endif @@ -156,7 +156,7 @@ uint16 gdsp_mbox_read_l(uint8 mbx) } -void gdsp_ifx_write(uint16 addr, uint16 val) +void gdsp_ifx_write(u16 addr, u16 val) { addr &= 0xff; @@ -203,9 +203,9 @@ void gdsp_ifx_write(uint16 addr, uint16 val) } -uint16 gdsp_ifx_read(uint16 addr) +u16 gdsp_ifx_read(u16 addr) { - uint16 val; + u16 val; addr &= 0xff; @@ -244,13 +244,13 @@ uint16 gdsp_ifx_read(uint16 addr) } -void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size) +void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size) { - uint8* dst = ((uint8*)g_dsp.iram); + u8* dst = ((u8*)g_dsp.iram); - for (uint32 i = 0; i < size; i += 2) + for (u32 i = 0; i < size; i += 2) { - *(uint16*)&dst[dsp_addr + i] = *(uint16*)&g_dsp.cpu_ram[(addr + i) & 0x0fffffff]; + *(u16*)&dst[dsp_addr + i] = *(u16*)&g_dsp.cpu_ram[(addr + i) & 0x0fffffff]; } g_dsp.iram_crc = GenerateCRC(g_dsp.cpu_ram + (addr & 0x0fffffff), size); @@ -262,13 +262,13 @@ void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size) } -void gdsp_idma_out(uint16 dsp_addr, uint32 addr, uint32 size) +void gdsp_idma_out(u16 dsp_addr, u32 addr, u32 size) { ERROR_LOG(DSPHLE, "*** idma_out IRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)\n", dsp_addr / 2, addr, size); } -void gdsp_ddma_in(uint16 dsp_addr, uint32 addr, uint32 size) +void gdsp_ddma_in(u16 dsp_addr, u32 addr, u32 size) { if ((addr & 0x7FFFFFFF) > 0x01FFFFFF) { @@ -276,18 +276,18 @@ void gdsp_ddma_in(uint16 dsp_addr, uint32 addr, uint32 size) return; } - uint8* dst = ((uint8*)g_dsp.dram); + u8* dst = ((u8*)g_dsp.dram); - for (uint32 i = 0; i < size; i += 2) + for (u32 i = 0; i < size; i += 2) { - *(uint16*)&dst[dsp_addr + i] = *(uint16*)&g_dsp.cpu_ram[(addr + i) & 0x7FFFFFFF]; + *(u16*)&dst[dsp_addr + i] = *(u16*)&g_dsp.cpu_ram[(addr + i) & 0x7FFFFFFF]; } DEBUG_LOG(DSPHLE, "*** ddma_in RAM (0x%08x) -> DRAM_DSP (0x%04x) : size (0x%08x)\n", addr, dsp_addr / 2, size); } -void gdsp_ddma_out(uint16 dsp_addr, uint32 addr, uint32 size) +void gdsp_ddma_out(u16 dsp_addr, u32 addr, u32 size) { if ((addr & 0x7FFFFFFF) > 0x01FFFFFF) { @@ -295,11 +295,11 @@ void gdsp_ddma_out(uint16 dsp_addr, uint32 addr, uint32 size) return; } - uint8* src = ((uint8*)g_dsp.dram); + u8* src = ((u8*)g_dsp.dram); - for (uint32 i = 0; i < size; i += 2) + for (u32 i = 0; i < size; i += 2) { - *(uint16*)&g_dsp.cpu_ram[(addr + i) & 0x7FFFFFFF] = *(uint16*)&src[dsp_addr + i]; + *(u16*)&g_dsp.cpu_ram[(addr + i) & 0x7FFFFFFF] = *(u16*)&src[dsp_addr + i]; } DEBUG_LOG(DSPHLE, "*** ddma_out DRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)\n", dsp_addr / 2, addr, size); @@ -313,10 +313,10 @@ void gdsp_ddma_out(uint16 dsp_addr, uint32 addr, uint32 size) void gdsp_dma() { - uint16 ctl; - uint32 addr; - uint16 dsp_addr; - uint16 len; + u16 ctl; + u32 addr; + u16 dsp_addr; + u16 len; addr = (gdsp_ifx_regs[DSP_DSMAH] << 16) | gdsp_ifx_regs[DSP_DSMAL]; ctl = gdsp_ifx_regs[DSP_DSCR]; diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interface.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interface.h index b051a7c4d8..2ac76af4e4 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interface.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interface.h @@ -50,17 +50,17 @@ #define DSP_ARAM 0xdd #define DSP_GAIN 0xde -extern uint16 gdsp_ifx_regs[256]; +extern u16 gdsp_ifx_regs[256]; -uint32 gdsp_mbox_peek(uint8 mbx); -void gdsp_mbox_write_h(uint8 mbx, uint16 val); -void gdsp_mbox_write_l(uint8 mbx, uint16 val); -uint16 gdsp_mbox_read_h(uint8 mbx); -uint16 gdsp_mbox_read_l(uint8 mbx); +u32 gdsp_mbox_peek(u8 mbx); +void gdsp_mbox_write_h(u8 mbx, u16 val); +void gdsp_mbox_write_l(u8 mbx, u16 val); +u16 gdsp_mbox_read_h(u8 mbx); +u16 gdsp_mbox_read_l(u8 mbx); void gdsp_ifx_init(); -void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size); +void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size); #endif diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp index f46cb68484..c4f32d36b2 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp @@ -34,25 +34,25 @@ SDSP g_dsp; -uint16 SDSP::r[32]; -uint16 SDSP::pc = 0; -uint16 SDSP::err_pc = 0; -uint16* SDSP::iram = 0; -uint16* SDSP::dram = 0; -uint16* SDSP::irom = 0; -uint16* SDSP::drom = 0; -uint16* SDSP::coef = 0; -uint8* SDSP::cpu_ram = 0; -uint16 SDSP::cr = 0; -uint8 SDSP::reg_stack_ptr[4]; +u16 SDSP::r[32]; +u16 SDSP::pc = 0; +u16 SDSP::err_pc = 0; +u16* SDSP::iram = 0; +u16* SDSP::dram = 0; +u16* SDSP::irom = 0; +u16* SDSP::drom = 0; +u16* SDSP::coef = 0; +u8* SDSP::cpu_ram = 0; +u16 SDSP::cr = 0; +u8 SDSP::reg_stack_ptr[4]; // lets make stack depth to 32 for now -uint16 SDSP::reg_stack[4][DSP_STACK_DEPTH]; +u16 SDSP::reg_stack[4][DSP_STACK_DEPTH]; void (*SDSP::irq_request)() = NULL; bool SDSP::exception_in_progress_hack = false; // for debugger only -uint32 SDSP::iram_crc = 0; -uint64 SDSP::step_counter = 0; +u32 SDSP::iram_crc = 0; +u64 SDSP::step_counter = 0; //------------------------------------------------------------------------------- @@ -69,7 +69,7 @@ void UpdateCachedCR() //------------------------------------------------------------------------------- -void (*dsp_op[])(uint16 opc) = +void (*dsp_op[])(u16 opc) = { dsp_op0, dsp_op1, dsp_op2, dsp_op3, dsp_op4, dsp_op5, dsp_op6, dsp_op7, @@ -85,11 +85,11 @@ void dbg_error(char* err_msg) void gdsp_init() { - g_dsp.irom = (uint16*)malloc(DSP_IROM_SIZE * sizeof(uint16)); - g_dsp.iram = (uint16*)malloc(DSP_IRAM_SIZE * sizeof(uint16)); - g_dsp.drom = (uint16*)malloc(DSP_DROM_SIZE * sizeof(uint16)); - g_dsp.dram = (uint16*)malloc(DSP_DRAM_SIZE * sizeof(uint16)); - g_dsp.coef = (uint16*)malloc(DSP_COEF_SIZE * sizeof(uint16)); + g_dsp.irom = (u16*)malloc(DSP_IROM_SIZE * sizeof(u16)); + g_dsp.iram = (u16*)malloc(DSP_IRAM_SIZE * sizeof(u16)); + g_dsp.drom = (u16*)malloc(DSP_DROM_SIZE * sizeof(u16)); + g_dsp.dram = (u16*)malloc(DSP_DRAM_SIZE * sizeof(u16)); + g_dsp.coef = (u16*)malloc(DSP_COEF_SIZE * sizeof(u16)); for (int i = 0; i < DSP_IRAM_SIZE; i++) { @@ -138,8 +138,8 @@ void gdsp_reset() } -uint8 gdsp_exceptions = 0; -void gdsp_generate_exception(uint8 level) +u8 gdsp_exceptions = 0; +void gdsp_generate_exception(u8 level) { gdsp_exceptions |= 1 << level; } @@ -175,7 +175,7 @@ bool gdsp_load_coef(char* fname) } -void gdsp_write_cr(uint16 val) +void gdsp_write_cr(u16 val) { // reset if (val & 0x0001) @@ -192,7 +192,7 @@ void gdsp_write_cr(uint16 val) } -uint16 gdsp_read_cr() +u16 gdsp_read_cr() { if (g_dsp.pc & 0x8000) { @@ -216,7 +216,7 @@ uint16 gdsp_read_cr() void gdsp_loop_step() { g_dsp.err_pc = g_dsp.pc; - uint16 opc = dsp_fetch_code(); + u16 opc = dsp_fetch_code(); dsp_op[opc >> 12](opc); } @@ -247,15 +247,15 @@ void gdsp_step() #endif - uint16 opc = dsp_fetch_code(); + u16 opc = dsp_fetch_code(); dsp_op[opc >> 12](opc); - uint16& rLoopCounter = g_dsp.r[DSP_REG_ST0 + 3]; + u16& rLoopCounter = g_dsp.r[DSP_REG_ST0 + 3]; if (rLoopCounter > 0) { - const uint16& rCallAddress = g_dsp.r[DSP_REG_ST0 + 0]; - const uint16& rLoopAddress = g_dsp.r[DSP_REG_ST0 + 2]; + const u16& rCallAddress = g_dsp.r[DSP_REG_ST0 + 0]; + const u16& rLoopAddress = g_dsp.r[DSP_REG_ST0 + 2]; if (g_dsp.pc == (rLoopAddress + 1)) { @@ -290,7 +290,7 @@ void gdsp_step() // check exceptions if ((gdsp_exceptions > 0) && (!g_dsp.exception_in_progress_hack)) { - for (uint8 i=0; i<8; i++) + for (u8 i=0; i<8; i++) { if (gdsp_exceptions & (1< 1024*1024*1) @@ -400,7 +400,7 @@ void Hacks() const int numSamples = 0x280; static short Buffer[numSamples]; - uint16 bufferAddr = 0x280; //dsp_dmem_read(0xe44); + u16 bufferAddr = 0x280; //dsp_dmem_read(0xe44); for (int i=0; i> 8) | (x << 8)); } -uint16* gdsp_get_iram(void) +u16* gdsp_get_iram(void) { return(g_dsp.iram); } -uint16* gdsp_get_irom(void) +u16* gdsp_get_irom(void) { return(g_dsp.irom); } -uint16* gdsp_get_dram(void) +u16* gdsp_get_dram(void) { return(g_dsp.dram); } -uint16* gdsp_get_drom(void) +u16* gdsp_get_drom(void) { return(g_dsp.drom); } -uint16 dsp_imem_read(uint16 addr) +u16 dsp_imem_read(u16 addr) { - uint16 opc; + u16 opc; if (g_dsp.pc & 0x8000) { @@ -76,9 +76,9 @@ uint16 dsp_imem_read(uint16 addr) } -uint16 dsp_dmem_read(uint16 addr) +u16 dsp_dmem_read(u16 addr) { - uint16 val; + u16 val; switch (addr >> 12) { @@ -112,7 +112,7 @@ uint16 dsp_dmem_read(uint16 addr) } -bool dsp_dmem_write(uint16 addr, uint16 val) +bool dsp_dmem_write(u16 addr, u16 val) { switch (addr >> 12) { @@ -140,15 +140,15 @@ bool dsp_dmem_write(uint16 addr, uint16 val) } -uint16 dsp_fetch_code(void) +u16 dsp_fetch_code(void) { - uint16 opc = dsp_imem_read(g_dsp.pc); + u16 opc = dsp_imem_read(g_dsp.pc); g_dsp.pc++; return(opc); } -uint16 dsp_peek_code(void) +u16 dsp_peek_code(void) { return(dsp_imem_read(g_dsp.pc)); } diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_memory.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_memory.h index df42a1a951..f1c4948878 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_memory.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_memory.h @@ -27,11 +27,11 @@ #include "Globals.h" -uint16 dsp_fetch_code(void); -uint16 dsp_peek_code(void); -uint16 dsp_imem_read(uint16 addr); -bool dsp_dmem_write(uint16 addr, uint16 val); -uint16 dsp_dmem_read(uint16 addr); +u16 dsp_fetch_code(void); +u16 dsp_peek_code(void); +u16 dsp_imem_read(u16 addr); +bool dsp_dmem_write(u16 addr, u16 val); +u16 dsp_dmem_read(u16 addr); #endif diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes.cpp index a3e22ec058..207157c46c 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes.cpp @@ -48,7 +48,7 @@ #define DSP_REG_MASK 0x1f -void Update_SR_Register(sint64 _Value) +void Update_SR_Register(s64 _Value) { g_dsp.r[R_SR] &= ~SR_CMP_MASK; @@ -70,7 +70,7 @@ void Update_SR_Register(sint64 _Value) } -void Update_SR_Register(sint16 _Value) +void Update_SR_Register(s16 _Value) { g_dsp.r[R_SR] &= ~SR_CMP_MASK; @@ -92,7 +92,7 @@ void Update_SR_Register(sint16 _Value) } -sint8 GetMultiplyModifier() +s8 GetMultiplyModifier() { if (g_dsp.r[R_SR] & (1 << 13)) { @@ -103,7 +103,7 @@ sint8 GetMultiplyModifier() } -bool CheckCondition(uint8 _Condition) +bool CheckCondition(u8 _Condition) { bool taken = false; @@ -197,7 +197,7 @@ bool CheckCondition(uint8 _Condition) // ======================================================================= -void dsp_op_unknown(uint16 opc) +void dsp_op_unknown(u16 opc) { _assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception"); ERROR_LOG(DSPHLE, "dsp_op_unknown somewhere"); @@ -205,9 +205,9 @@ void dsp_op_unknown(uint16 opc) } -void dsp_opc_call(uint16 opc) +void dsp_opc_call(u16 opc) { - uint16 dest = dsp_fetch_code(); + u16 dest = dsp_fetch_code(); if (CheckCondition(opc & 0xf)) { @@ -217,7 +217,7 @@ void dsp_opc_call(uint16 opc) } -void dsp_opc_ifcc(uint16 opc) +void dsp_opc_ifcc(u16 opc) { if (!CheckCondition(opc & 0xf)) { @@ -226,9 +226,9 @@ void dsp_opc_ifcc(uint16 opc) } -void dsp_opc_jcc(uint16 opc) +void dsp_opc_jcc(u16 opc) { - uint16 dest = dsp_fetch_code(); + u16 dest = dsp_fetch_code(); if (CheckCondition(opc & 0xf)) { @@ -237,10 +237,10 @@ void dsp_opc_jcc(uint16 opc) } -void dsp_opc_jmpa(uint16 opc) +void dsp_opc_jmpa(u16 opc) { - uint8 reg; - uint16 addr; + u8 reg; + u16 addr; if ((opc & 0xf) != 0xf) { @@ -261,7 +261,7 @@ void dsp_opc_jmpa(uint16 opc) // NEW (added condition check) -void dsp_opc_ret(uint16 opc) +void dsp_opc_ret(u16 opc) { if (CheckCondition(opc & 0xf)) { @@ -270,7 +270,7 @@ void dsp_opc_ret(uint16 opc) } -void dsp_opc_rti(uint16 opc) +void dsp_opc_rti(u16 opc) { if ((opc & 0xf) != 0xf) { @@ -284,18 +284,18 @@ void dsp_opc_rti(uint16 opc) } -void dsp_opc_halt(uint16 opc) +void dsp_opc_halt(u16 opc) { g_dsp.cr |= 0x4; g_dsp.pc = g_dsp.err_pc; } -void dsp_opc_loop(uint16 opc) +void dsp_opc_loop(u16 opc) { - uint16 reg = opc & 0x1f; - uint16 cnt = g_dsp.r[reg]; - uint16 loop_pc = g_dsp.pc; + u16 reg = opc & 0x1f; + u16 cnt = g_dsp.r[reg]; + u16 loop_pc = g_dsp.pc; while (cnt--) { @@ -307,10 +307,10 @@ void dsp_opc_loop(uint16 opc) } -void dsp_opc_loopi(uint16 opc) +void dsp_opc_loopi(u16 opc) { - uint16 cnt = opc & 0xff; - uint16 loop_pc = g_dsp.pc; + u16 cnt = opc & 0xff; + u16 loop_pc = g_dsp.pc; while (cnt--) { @@ -322,11 +322,11 @@ void dsp_opc_loopi(uint16 opc) } -void dsp_opc_bloop(uint16 opc) +void dsp_opc_bloop(u16 opc) { - uint16 reg = opc & 0x1f; - uint16 cnt = g_dsp.r[reg]; - uint16 loop_pc = dsp_fetch_code(); + u16 reg = opc & 0x1f; + u16 cnt = g_dsp.r[reg]; + u16 loop_pc = dsp_fetch_code(); if (cnt) { @@ -341,10 +341,10 @@ void dsp_opc_bloop(uint16 opc) } -void dsp_opc_bloopi(uint16 opc) +void dsp_opc_bloopi(u16 opc) { - uint16 cnt = opc & 0xff; - uint16 loop_pc = dsp_fetch_code(); + u16 cnt = opc & 0xff; + u16 loop_pc = dsp_fetch_code(); if (cnt) { @@ -362,22 +362,22 @@ void dsp_opc_bloopi(uint16 opc) //------------------------------------------------------------- -void dsp_opc_mrr(uint16 opc) +void dsp_opc_mrr(u16 opc) { - uint8 sreg = opc & 0x1f; - uint8 dreg = (opc >> 5) & 0x1f; + u8 sreg = opc & 0x1f; + u8 dreg = (opc >> 5) & 0x1f; - uint16 val = dsp_op_read_reg(sreg); + u16 val = dsp_op_read_reg(sreg); dsp_op_write_reg(dreg, val); } -void dsp_opc_lrr(uint16 opc) +void dsp_opc_lrr(u16 opc) { - uint8 sreg = (opc >> 5) & 0x3; - uint8 dreg = opc & 0x1f; + u8 sreg = (opc >> 5) & 0x3; + u8 dreg = opc & 0x1f; - uint16 val = dsp_dmem_read(g_dsp.r[sreg]); + u16 val = dsp_dmem_read(g_dsp.r[sreg]); dsp_op_write_reg(dreg, val); // post processing of source reg @@ -401,12 +401,12 @@ void dsp_opc_lrr(uint16 opc) } -void dsp_opc_srr(uint16 opc) +void dsp_opc_srr(u16 opc) { - uint8 dreg = (opc >> 5) & 0x3; - uint8 sreg = opc & 0x1f; + u8 dreg = (opc >> 5) & 0x3; + u8 sreg = opc & 0x1f; - uint16 val = dsp_op_read_reg(sreg); + u16 val = dsp_op_read_reg(sreg); dsp_dmem_write(g_dsp.r[dreg], val); // post processing of dest reg @@ -430,10 +430,10 @@ void dsp_opc_srr(uint16 opc) } -void dsp_opc_ilrr(uint16 opc) +void dsp_opc_ilrr(u16 opc) { - uint16 reg = opc & 0x3; - uint16 dreg = 0x1e + ((opc >> 8) & 1); + u16 reg = opc & 0x3; + u16 dreg = 0x1e + ((opc >> 8) & 1); // always to acc0 ? g_dsp.r[dreg] = dsp_imem_read(g_dsp.r[reg]); @@ -457,68 +457,68 @@ void dsp_opc_ilrr(uint16 opc) } -void dsp_opc_lri(uint16 opc) +void dsp_opc_lri(u16 opc) { - uint8 reg = opc & DSP_REG_MASK; - uint16 imm = dsp_fetch_code(); + u8 reg = opc & DSP_REG_MASK; + u16 imm = dsp_fetch_code(); dsp_op_write_reg(reg, imm); } -void dsp_opc_lris(uint16 opc) +void dsp_opc_lris(u16 opc) { - uint8 reg = ((opc >> 8) & 0x7) + 0x18; - uint16 imm = (sint8)opc; + u8 reg = ((opc >> 8) & 0x7) + 0x18; + u16 imm = (s8)opc; dsp_op_write_reg(reg, imm); } -void dsp_opc_lr(uint16 opc) +void dsp_opc_lr(u16 opc) { - uint8 reg = opc & DSP_REG_MASK; - uint16 addr = dsp_fetch_code(); - uint16 val = dsp_dmem_read(addr); + u8 reg = opc & DSP_REG_MASK; + u16 addr = dsp_fetch_code(); + u16 val = dsp_dmem_read(addr); dsp_op_write_reg(reg, val); } -void dsp_opc_sr(uint16 opc) +void dsp_opc_sr(u16 opc) { - uint8 reg = opc & DSP_REG_MASK; - uint16 addr = dsp_fetch_code(); - uint16 val = dsp_op_read_reg(reg); + u8 reg = opc & DSP_REG_MASK; + u16 addr = dsp_fetch_code(); + u16 val = dsp_op_read_reg(reg); dsp_dmem_write(addr, val); } -void dsp_opc_si(uint16 opc) +void dsp_opc_si(u16 opc) { - uint16 addr = (sint8)opc; - uint16 imm = dsp_fetch_code(); + u16 addr = (s8)opc; + u16 imm = dsp_fetch_code(); dsp_dmem_write(addr, imm); } -void dsp_opc_tstaxh(uint16 opc) +void dsp_opc_tstaxh(u16 opc) { - uint8 reg = (opc >> 8) & 0x1; - sint16 val = dsp_get_ax_h(reg); + u8 reg = (opc >> 8) & 0x1; + s16 val = dsp_get_ax_h(reg); Update_SR_Register(val); } -void dsp_opc_clr(uint16 opc) +void dsp_opc_clr(u16 opc) { - uint8 reg = (opc >> 11) & 0x1; + u8 reg = (opc >> 11) & 0x1; dsp_set_long_acc(reg, 0); - Update_SR_Register((sint64)0); + Update_SR_Register((s64)0); } -void dsp_opc_clrp(uint16 opc) +void dsp_opc_clrp(u16 opc) { g_dsp.r[0x14] = 0x0000; g_dsp.r[0x15] = 0xfff0; @@ -528,13 +528,13 @@ void dsp_opc_clrp(uint16 opc) // NEW -void dsp_opc_mulc(uint16 opc) +void dsp_opc_mulc(u16 opc) { // math new prod - uint8 sreg = (opc >> 11) & 0x1; - uint8 treg = (opc >> 12) & 0x1; + u8 sreg = (opc >> 11) & 0x1; + u8 treg = (opc >> 12) & 0x1; - sint64 prod = dsp_get_acc_m(sreg) * dsp_get_ax_h(treg) * GetMultiplyModifier(); + s64 prod = dsp_get_acc_m(sreg) * dsp_get_ax_h(treg) * GetMultiplyModifier(); dsp_set_long_prod(prod); Update_SR_Register(prod); @@ -542,60 +542,60 @@ void dsp_opc_mulc(uint16 opc) // NEW -void dsp_opc_mulcmvz(uint16 opc) +void dsp_opc_mulcmvz(u16 opc) { ERROR_LOG(DSPHLE, "dsp_opc_mulcmvz ni"); } // NEW -void dsp_opc_mulcmv(uint16 opc) +void dsp_opc_mulcmv(u16 opc) { ERROR_LOG(DSPHLE, "dsp_opc_mulcmv ni"); } -void dsp_opc_cmpar(uint16 opc) +void dsp_opc_cmpar(u16 opc) { - uint8 rreg = ((opc >> 12) & 0x1) + 0x1a; - uint8 areg = (opc >> 11) & 0x1; + u8 rreg = ((opc >> 12) & 0x1) + 0x1a; + u8 areg = (opc >> 11) & 0x1; // we compare - sint64 rr = (sint16)g_dsp.r[rreg]; + s64 rr = (s16)g_dsp.r[rreg]; rr <<= 16; - sint64 ar = dsp_get_long_acc(areg); + s64 ar = dsp_get_long_acc(areg); Update_SR_Register(ar - rr); } -void dsp_opc_cmp(uint16 opc) +void dsp_opc_cmp(u16 opc) { - sint64 acc0 = dsp_get_long_acc(0); - sint64 acc1 = dsp_get_long_acc(1); + s64 acc0 = dsp_get_long_acc(0); + s64 acc1 = dsp_get_long_acc(1); Update_SR_Register(acc0 - acc1); } -void dsp_opc_tsta(uint16 opc) +void dsp_opc_tsta(u16 opc) { - uint8 reg = (opc >> 11) & 0x1; - sint64 acc = dsp_get_long_acc(reg); + u8 reg = (opc >> 11) & 0x1; + s64 acc = dsp_get_long_acc(reg); Update_SR_Register(acc); } // NEW -void dsp_opc_addaxl(uint16 opc) +void dsp_opc_addaxl(u16 opc) { - uint8 sreg = (opc >> 9) & 0x1; - uint8 dreg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 9) & 0x1; + u8 dreg = (opc >> 8) & 0x1; - sint64 acc = dsp_get_long_acc(dreg); - sint64 acx = dsp_get_ax_l(sreg); + s64 acc = dsp_get_long_acc(dreg); + s64 acx = dsp_get_ax_l(sreg); acc += acx; @@ -606,38 +606,38 @@ void dsp_opc_addaxl(uint16 opc) // NEW -void dsp_opc_addarn(uint16 opc) +void dsp_opc_addarn(u16 opc) { - uint8 dreg = opc & 0x3; - uint8 sreg = (opc >> 2) & 0x3; + u8 dreg = opc & 0x3; + u8 sreg = (opc >> 2) & 0x3; - g_dsp.r[dreg] += (sint16)g_dsp.r[0x04 + sreg]; + g_dsp.r[dreg] += (s16)g_dsp.r[0x04 + sreg]; } // NEW -void dsp_opc_mulcac(uint16 opc) +void dsp_opc_mulcac(u16 opc) { - sint64 TempProd = dsp_get_long_prod(); + s64 TempProd = dsp_get_long_prod(); // update prod - uint8 sreg = (opc >> 12) & 0x1; - sint64 Prod = (sint64)dsp_get_acc_m(sreg) * (sint64)dsp_get_acc_h(sreg) * GetMultiplyModifier(); + u8 sreg = (opc >> 12) & 0x1; + s64 Prod = (s64)dsp_get_acc_m(sreg) * (s64)dsp_get_acc_h(sreg) * GetMultiplyModifier(); dsp_set_long_prod(Prod); // update acc - uint8 rreg = (opc >> 8) & 0x1; + u8 rreg = (opc >> 8) & 0x1; dsp_set_long_acc(rreg, TempProd); } // NEW -void dsp_opc_movr(uint16 opc) +void dsp_opc_movr(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; - uint8 sreg = ((opc >> 9) & 0x3) + 0x18; + u8 areg = (opc >> 8) & 0x1; + u8 sreg = ((opc >> 9) & 0x3) + 0x18; - sint64 acc = (sint16)g_dsp.r[sreg]; + s64 acc = (s16)g_dsp.r[sreg]; acc <<= 16; acc &= ~0xffff; @@ -647,15 +647,15 @@ void dsp_opc_movr(uint16 opc) } -void dsp_opc_movax(uint16 opc) +void dsp_opc_movax(u16 opc) { - uint8 sreg = (opc >> 9) & 0x1; - uint8 dreg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 9) & 0x1; + u8 dreg = (opc >> 8) & 0x1; g_dsp.r[0x1c + dreg] = g_dsp.r[0x18 + sreg]; g_dsp.r[0x1e + dreg] = g_dsp.r[0x1a + sreg]; - if ((sint16)g_dsp.r[0x1a + sreg] < 0) + if ((s16)g_dsp.r[0x1a + sreg] < 0) { g_dsp.r[0x10 + dreg] = 0xffff; } @@ -669,10 +669,10 @@ void dsp_opc_movax(uint16 opc) // NEW -void dsp_opc_xorr(uint16 opc) +void dsp_opc_xorr(u16 opc) { - uint8 sreg = (opc >> 9) & 0x1; - uint8 dreg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 9) & 0x1; + u8 dreg = (opc >> 8) & 0x1; g_dsp.r[0x1e + dreg] ^= g_dsp.r[0x1a + sreg]; @@ -680,10 +680,10 @@ void dsp_opc_xorr(uint16 opc) } -void dsp_opc_andr(uint16 opc) +void dsp_opc_andr(u16 opc) { - uint8 sreg = (opc >> 9) & 0x1; - uint8 dreg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 9) & 0x1; + u8 dreg = (opc >> 8) & 0x1; g_dsp.r[0x1e + dreg] &= g_dsp.r[0x1a + sreg]; @@ -692,10 +692,10 @@ void dsp_opc_andr(uint16 opc) // NEW -void dsp_opc_orr(uint16 opc) +void dsp_opc_orr(u16 opc) { - uint8 sreg = (opc >> 9) & 0x1; - uint8 dreg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 9) & 0x1; + u8 dreg = (opc >> 8) & 0x1; g_dsp.r[0x1e + dreg] |= g_dsp.r[0x1a + sreg]; @@ -704,12 +704,12 @@ void dsp_opc_orr(uint16 opc) // NEW -void dsp_opc_andc(uint16 opc) +void dsp_opc_andc(u16 opc) { - uint8 D = (opc >> 8) & 0x1; + u8 D = (opc >> 8) & 0x1; - uint16 ac1 = dsp_get_acc_m(D); - uint16 ac2 = dsp_get_acc_m(1 - D); + u16 ac1 = dsp_get_acc_m(D); + u16 ac2 = dsp_get_acc_m(1 - D); dsp_set_long_acc(D, ac1 & ac2); @@ -726,21 +726,21 @@ void dsp_opc_andc(uint16 opc) //------------------------------------------------------------- -void dsp_opc_nx(uint16 opc) +void dsp_opc_nx(u16 opc) {} // NEW -void dsp_opc_andfc(uint16 opc) +void dsp_opc_andfc(u16 opc) { if (opc & 0xf) { ERROR_LOG(DSPHLE, "dsp_opc_andfc"); } - uint8 reg = (opc >> 8) & 0x1; - uint16 imm = dsp_fetch_code(); - uint16 val = dsp_get_acc_m(reg); + u8 reg = (opc >> 8) & 0x1; + u16 imm = dsp_fetch_code(); + u16 val = dsp_get_acc_m(reg); if ((val & imm) == imm) { @@ -753,11 +753,11 @@ void dsp_opc_andfc(uint16 opc) } -void dsp_opc_andf(uint16 opc) +void dsp_opc_andf(u16 opc) { - uint8 reg; - uint16 imm; - uint16 val; + u8 reg; + u16 imm; + u16 val; if (opc & 0xf) { @@ -779,56 +779,56 @@ void dsp_opc_andf(uint16 opc) } -void dsp_opc_subf(uint16 opc) +void dsp_opc_subf(u16 opc) { if (opc & 0xf) { ERROR_LOG(DSPHLE, "dsp_opc_subf"); } - uint8 reg = 0x1e + ((opc >> 8) & 0x1); - sint64 imm = (sint16)dsp_fetch_code(); + u8 reg = 0x1e + ((opc >> 8) & 0x1); + s64 imm = (s16)dsp_fetch_code(); - sint64 val = (sint16)g_dsp.r[reg]; - sint64 res = val - imm; + s64 val = (s16)g_dsp.r[reg]; + s64 res = val - imm; Update_SR_Register(res); } -void dsp_opc_xori(uint16 opc) +void dsp_opc_xori(u16 opc) { if (opc & 0xf) { ERROR_LOG(DSPHLE, "dsp_opc_xori"); } - uint8 reg = 0x1e + ((opc >> 8) & 0x1); - uint16 imm = dsp_fetch_code(); + u8 reg = 0x1e + ((opc >> 8) & 0x1); + u16 imm = dsp_fetch_code(); g_dsp.r[reg] ^= imm; - Update_SR_Register((sint16)g_dsp.r[reg]); + Update_SR_Register((s16)g_dsp.r[reg]); } -void dsp_opc_andi(uint16 opc) +void dsp_opc_andi(u16 opc) { if (opc & 0xf) { ERROR_LOG(DSPHLE, "dsp_opc_andi"); } - uint8 reg = 0x1e + ((opc >> 8) & 0x1); - uint16 imm = dsp_fetch_code(); + u8 reg = 0x1e + ((opc >> 8) & 0x1); + u16 imm = dsp_fetch_code(); g_dsp.r[reg] &= imm; - Update_SR_Register((sint16)g_dsp.r[reg]); + Update_SR_Register((s16)g_dsp.r[reg]); } // F|RES: i am not sure if this shouldnt be the whole ACC // -void dsp_opc_ori(uint16 opc) +void dsp_opc_ori(u16 opc) { if (opc & 0xf) { @@ -836,23 +836,23 @@ void dsp_opc_ori(uint16 opc) return; } - uint8 reg = 0x1e + ((opc >> 8) & 0x1); - uint16 imm = dsp_fetch_code(); + u8 reg = 0x1e + ((opc >> 8) & 0x1); + u16 imm = dsp_fetch_code(); g_dsp.r[reg] |= imm; - Update_SR_Register((sint16)g_dsp.r[reg]); + Update_SR_Register((s16)g_dsp.r[reg]); } //------------------------------------------------------------- -void dsp_opc_add(uint16 opc) +void dsp_opc_add(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; - sint64 acc0 = dsp_get_long_acc(0); - sint64 acc1 = dsp_get_long_acc(1); + u8 areg = (opc >> 8) & 0x1; + s64 acc0 = dsp_get_long_acc(0); + s64 acc1 = dsp_get_long_acc(1); - sint64 res = acc0 + acc1; + s64 res = acc0 + acc1; dsp_set_long_acc(areg, res); @@ -862,10 +862,10 @@ void dsp_opc_add(uint16 opc) //------------------------------------------------------------- -void dsp_opc_addp(uint16 opc) +void dsp_opc_addp(u16 opc) { - uint8 dreg = (opc >> 8) & 0x1; - sint64 acc = dsp_get_long_acc(dreg); + u8 dreg = (opc >> 8) & 0x1; + s64 acc = dsp_get_long_acc(dreg); acc = acc + dsp_get_long_prod(); dsp_set_long_acc(dreg, acc); @@ -873,15 +873,15 @@ void dsp_opc_addp(uint16 opc) } -void dsp_opc_cmpis(uint16 opc) +void dsp_opc_cmpis(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; + u8 areg = (opc >> 8) & 0x1; - sint64 acc = dsp_get_long_acc(areg); - sint64 val = (sint8)opc; + s64 acc = dsp_get_long_acc(areg); + s64 val = (s8)opc; val <<= 16; - sint64 res = acc - val; + s64 res = acc - val; Update_SR_Register(res); } @@ -889,14 +889,14 @@ void dsp_opc_cmpis(uint16 opc) // NEW // verified at the console -void dsp_opc_addpaxz(uint16 opc) +void dsp_opc_addpaxz(u16 opc) { - uint8 dreg = (opc >> 8) & 0x1; - uint8 sreg = (opc >> 9) & 0x1; + u8 dreg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 9) & 0x1; - sint64 prod = dsp_get_long_prod() & ~0x0ffff; - sint64 ax_h = dsp_get_long_acx(sreg); - sint64 acc = (prod + ax_h) & ~0x0ffff; + s64 prod = dsp_get_long_prod() & ~0x0ffff; + s64 ax_h = dsp_get_long_acx(sreg); + s64 acc = (prod + ax_h) & ~0x0ffff; dsp_set_long_acc(dreg, acc); @@ -905,25 +905,25 @@ void dsp_opc_addpaxz(uint16 opc) // NEW -void dsp_opc_movpz(uint16 opc) +void dsp_opc_movpz(u16 opc) { - uint8 dreg = (opc >> 8) & 0x01; + u8 dreg = (opc >> 8) & 0x01; // overwrite acc and clear low part - sint64 prod = dsp_get_long_prod(); - sint64 acc = prod & ~0xffff; + s64 prod = dsp_get_long_prod(); + s64 acc = prod & ~0xffff; dsp_set_long_acc(dreg, acc); Update_SR_Register(acc); } -void dsp_opc_decm(uint16 opc) +void dsp_opc_decm(u16 opc) { - uint8 dreg = (opc >> 8) & 0x01; + u8 dreg = (opc >> 8) & 0x01; - sint64 sub = 0x10000; - sint64 acc = dsp_get_long_acc(dreg); + s64 sub = 0x10000; + s64 acc = dsp_get_long_acc(dreg); acc -= sub; dsp_set_long_acc(dreg, acc); @@ -931,23 +931,23 @@ void dsp_opc_decm(uint16 opc) } -void dsp_opc_dec(uint16 opc) +void dsp_opc_dec(u16 opc) { - uint8 dreg = (opc >> 8) & 0x01; + u8 dreg = (opc >> 8) & 0x01; - sint64 acc = dsp_get_long_acc(dreg) - 1; + s64 acc = dsp_get_long_acc(dreg) - 1; dsp_set_long_acc(dreg, acc); Update_SR_Register(acc); } -void dsp_opc_incm(uint16 opc) +void dsp_opc_incm(u16 opc) { - uint8 dreg = (opc >> 8) & 0x1; + u8 dreg = (opc >> 8) & 0x1; - sint64 sub = 0x10000; - sint64 acc = dsp_get_long_acc(dreg); + s64 sub = 0x10000; + s64 acc = dsp_get_long_acc(dreg); acc += sub; dsp_set_long_acc(dreg, acc); @@ -955,11 +955,11 @@ void dsp_opc_incm(uint16 opc) } -void dsp_opc_inc(uint16 opc) +void dsp_opc_inc(u16 opc) { - uint8 dreg = (opc >> 8) & 0x1; + u8 dreg = (opc >> 8) & 0x1; - sint64 acc = dsp_get_long_acc(dreg); + s64 acc = dsp_get_long_acc(dreg); acc++; dsp_set_long_acc(dreg, acc); @@ -967,11 +967,11 @@ void dsp_opc_inc(uint16 opc) } -void dsp_opc_neg(uint16 opc) +void dsp_opc_neg(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; + u8 areg = (opc >> 8) & 0x1; - sint64 acc = dsp_get_long_acc(areg); + s64 acc = dsp_get_long_acc(areg); acc = 0 - acc; dsp_set_long_acc(areg, acc); @@ -979,20 +979,20 @@ void dsp_opc_neg(uint16 opc) } -void dsp_opc_movnp(uint16 opc) +void dsp_opc_movnp(u16 opc) { ERROR_LOG(DSPHLE, "dsp_opc_movnp\n"); } // NEW -void dsp_opc_addax(uint16 opc) +void dsp_opc_addax(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; - uint8 sreg = (opc >> 9) & 0x1; + u8 areg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 9) & 0x1; - sint64 ax = dsp_get_long_acx(sreg); - sint64 acc = dsp_get_long_acc(areg); + s64 ax = dsp_get_long_acx(sreg); + s64 acc = dsp_get_long_acc(areg); acc += ax; dsp_set_long_acc(areg, acc); @@ -1000,15 +1000,15 @@ void dsp_opc_addax(uint16 opc) } -void dsp_opc_addr(uint16 opc) +void dsp_opc_addr(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; - uint8 sreg = ((opc >> 9) & 0x3) + 0x18; + u8 areg = (opc >> 8) & 0x1; + u8 sreg = ((opc >> 9) & 0x3) + 0x18; - sint64 ax = (sint16)g_dsp.r[sreg]; + s64 ax = (s16)g_dsp.r[sreg]; ax <<= 16; - sint64 acc = dsp_get_long_acc(areg); + s64 acc = dsp_get_long_acc(areg); acc += ax; dsp_set_long_acc(areg, acc); @@ -1016,15 +1016,15 @@ void dsp_opc_addr(uint16 opc) } -void dsp_opc_subr(uint16 opc) +void dsp_opc_subr(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; - uint8 sreg = ((opc >> 9) & 0x3) + 0x18; + u8 areg = (opc >> 8) & 0x1; + u8 sreg = ((opc >> 9) & 0x3) + 0x18; - sint64 ax = (sint16)g_dsp.r[sreg]; + s64 ax = (s16)g_dsp.r[sreg]; ax <<= 16; - sint64 acc = dsp_get_long_acc(areg); + s64 acc = dsp_get_long_acc(areg); acc -= ax; dsp_set_long_acc(areg, acc); @@ -1032,24 +1032,24 @@ void dsp_opc_subr(uint16 opc) } // NEW -void dsp_opc_subax(uint16 opc) +void dsp_opc_subax(u16 opc) { int regD = (opc >> 8) & 0x1; int regT = (opc >> 9) & 0x1; - sint64 Acc = dsp_get_long_acc(regD) - dsp_get_long_acx(regT); + s64 Acc = dsp_get_long_acc(regD) - dsp_get_long_acx(regT); dsp_set_long_acc(regD, Acc); Update_SR_Register(Acc); } -void dsp_opc_addis(uint16 opc) +void dsp_opc_addis(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; + u8 areg = (opc >> 8) & 0x1; - sint64 Imm = (sint8)opc; + s64 Imm = (s8)opc; Imm <<= 16; - sint64 acc = dsp_get_long_acc(areg); + s64 acc = dsp_get_long_acc(areg); acc += Imm; dsp_set_long_acc(areg, acc); @@ -1057,13 +1057,13 @@ void dsp_opc_addis(uint16 opc) } -void dsp_opc_addi(uint16 opc) +void dsp_opc_addi(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; + u8 areg = (opc >> 8) & 0x1; - sint64 sub = (sint16)dsp_fetch_code(); + s64 sub = (s16)dsp_fetch_code(); sub <<= 16; - sint64 acc = dsp_get_long_acc(areg); + s64 acc = dsp_get_long_acc(areg); acc += sub; dsp_set_long_acc(areg, acc); @@ -1071,11 +1071,11 @@ void dsp_opc_addi(uint16 opc) } -void dsp_opc_lsl16(uint16 opc) +void dsp_opc_lsl16(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; + u8 areg = (opc >> 8) & 0x1; - sint64 acc = dsp_get_long_acc(areg); + s64 acc = dsp_get_long_acc(areg); acc <<= 16; dsp_set_long_acc(areg, acc); @@ -1084,21 +1084,21 @@ void dsp_opc_lsl16(uint16 opc) // NEW -void dsp_opc_madd(uint16 opc) +void dsp_opc_madd(u16 opc) { - uint8 sreg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 8) & 0x1; - sint64 prod = dsp_get_long_prod(); - prod += (sint64)dsp_get_ax_l(sreg) * (sint64)dsp_get_ax_h(sreg) * GetMultiplyModifier(); + s64 prod = dsp_get_long_prod(); + prod += (s64)dsp_get_ax_l(sreg) * (s64)dsp_get_ax_h(sreg) * GetMultiplyModifier(); dsp_set_long_prod(prod); } -void dsp_opc_lsr16(uint16 opc) +void dsp_opc_lsr16(u16 opc) { - uint8 areg = (opc >> 8) & 0x1; + u8 areg = (opc >> 8) & 0x1; - sint64 acc = dsp_get_long_acc(areg); + s64 acc = dsp_get_long_acc(areg); acc >>= 16; dsp_set_long_acc(areg, acc); @@ -1106,11 +1106,11 @@ void dsp_opc_lsr16(uint16 opc) } -void dsp_opc_asr16(uint16 opc) +void dsp_opc_asr16(u16 opc) { - uint8 areg = (opc >> 11) & 0x1; + u8 areg = (opc >> 11) & 0x1; - sint64 acc = dsp_get_long_acc(areg); + s64 acc = dsp_get_long_acc(areg); acc >>= 16; dsp_set_long_acc(areg, acc); @@ -1120,7 +1120,7 @@ void dsp_opc_asr16(uint16 opc) union UOpcodeShifti { - uint16 Hex; + u16 Hex; struct { signed shift : 6; @@ -1133,17 +1133,17 @@ union UOpcodeShifti { unsigned ushift : 6; }; - UOpcodeShifti(uint16 _Hex) + UOpcodeShifti(u16 _Hex) : Hex(_Hex) {} }; -void dsp_opc_shifti(uint16 opc) +void dsp_opc_shifti(u16 opc) { UOpcodeShifti Opcode(opc); // direction: left bool ShiftLeft = true; - uint16 shift = Opcode.ushift; + u16 shift = Opcode.ushift; if ((Opcode.negating) && (Opcode.shift < 0)) { @@ -1151,8 +1151,8 @@ void dsp_opc_shifti(uint16 opc) shift = -Opcode.shift; } - sint64 acc; - uint64 uacc; + s64 acc; + u64 uacc; if (Opcode.arithmetic) { @@ -1192,9 +1192,9 @@ void dsp_opc_shifti(uint16 opc) //------------------------------------------------------------- // hcs give me this code!! -void dsp_opc_dar(uint16 opc) +void dsp_opc_dar(u16 opc) { - uint8 reg = opc & 0x3; + u8 reg = opc & 0x3; int temp = g_dsp.r[reg] + g_dsp.r[8]; @@ -1204,9 +1204,9 @@ void dsp_opc_dar(uint16 opc) // hcs give me this code!! -void dsp_opc_iar(uint16 opc) +void dsp_opc_iar(u16 opc) { - uint8 reg = opc & 0x3; + u8 reg = opc & 0x3; int temp = g_dsp.r[reg] + g_dsp.r[8]; @@ -1217,21 +1217,21 @@ void dsp_opc_iar(uint16 opc) //------------------------------------------------------------- -void dsp_opc_sbclr(uint16 opc) +void dsp_opc_sbclr(u16 opc) { - uint8 bit = (opc & 0xff) + 6; + u8 bit = (opc & 0xff) + 6; g_dsp.r[R_SR] &= ~(1 << bit); } -void dsp_opc_sbset(uint16 opc) +void dsp_opc_sbset(u16 opc) { - uint8 bit = (opc & 0xff) + 6; + u8 bit = (opc & 0xff) + 6; g_dsp.r[R_SR] |= (1 << bit); } -void dsp_opc_srbith(uint16 opc) +void dsp_opc_srbith(u16 opc) { switch ((opc >> 8) & 0xf) { @@ -1255,20 +1255,20 @@ void dsp_opc_srbith(uint16 opc) //------------------------------------------------------------- -void dsp_opc_movp(uint16 opc) +void dsp_opc_movp(u16 opc) { - uint8 dreg = (opc >> 8) & 0x1; + u8 dreg = (opc >> 8) & 0x1; - sint64 prod = dsp_get_long_prod(); - sint64 acc = prod; + s64 prod = dsp_get_long_prod(); + s64 acc = prod; dsp_set_long_acc(dreg, acc); } -void dsp_opc_mul(uint16 opc) +void dsp_opc_mul(u16 opc) { - uint8 sreg = (opc >> 11) & 0x1; - sint64 prod = (sint64)dsp_get_ax_h(sreg) * (sint64)dsp_get_ax_l(sreg) * GetMultiplyModifier(); + u8 sreg = (opc >> 11) & 0x1; + s64 prod = (s64)dsp_get_ax_h(sreg) * (s64)dsp_get_ax_l(sreg) * GetMultiplyModifier(); dsp_set_long_prod(prod); @@ -1276,33 +1276,33 @@ void dsp_opc_mul(uint16 opc) } // NEW -void dsp_opc_mulac(uint16 opc) +void dsp_opc_mulac(u16 opc) { // add old prod to acc - uint8 rreg = (opc >> 8) & 0x1; - sint64 acR = dsp_get_long_acc(rreg) + dsp_get_long_prod(); + u8 rreg = (opc >> 8) & 0x1; + s64 acR = dsp_get_long_acc(rreg) + dsp_get_long_prod(); dsp_set_long_acc(rreg, acR); // math new prod - uint8 sreg = (opc >> 11) & 0x1; - sint64 prod = dsp_get_ax_l(sreg) * dsp_get_ax_h(sreg) * GetMultiplyModifier(); + u8 sreg = (opc >> 11) & 0x1; + s64 prod = dsp_get_ax_l(sreg) * dsp_get_ax_h(sreg) * GetMultiplyModifier(); dsp_set_long_prod(prod); Update_SR_Register(prod); } -void dsp_opc_mulmv(uint16 opc) +void dsp_opc_mulmv(u16 opc) { - uint8 rreg = (opc >> 8) & 0x1; - sint64 prod = dsp_get_long_prod(); - sint64 acc = prod; + u8 rreg = (opc >> 8) & 0x1; + s64 prod = dsp_get_long_prod(); + s64 acc = prod; dsp_set_long_acc(rreg, acc); - uint8 areg = ((opc >> 11) & 0x1) + 0x18; - uint8 breg = ((opc >> 11) & 0x1) + 0x1a; - sint64 val1 = (sint16)g_dsp.r[areg]; - sint64 val2 = (sint16)g_dsp.r[breg]; + u8 areg = ((opc >> 11) & 0x1) + 0x18; + u8 breg = ((opc >> 11) & 0x1) + 0x1a; + s64 val1 = (s16)g_dsp.r[areg]; + s64 val2 = (s16)g_dsp.r[breg]; prod = val1 * val2 * GetMultiplyModifier(); @@ -1313,18 +1313,18 @@ void dsp_opc_mulmv(uint16 opc) // NEW -void dsp_opc_mulmvz(uint16 opc) +void dsp_opc_mulmvz(u16 opc) { - uint8 sreg = (opc >> 11) & 0x1; - uint8 rreg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 11) & 0x1; + u8 rreg = (opc >> 8) & 0x1; // overwrite acc and clear low part - sint64 prod = dsp_get_long_prod(); - sint64 acc = prod & ~0xffff; + s64 prod = dsp_get_long_prod(); + s64 acc = prod & ~0xffff; dsp_set_long_acc(rreg, acc); // math prod - prod = (sint64)g_dsp.r[0x18 + sreg] * (sint64)g_dsp.r[0x1a + sreg] * GetMultiplyModifier(); + prod = (s64)g_dsp.r[0x18 + sreg] * (s64)g_dsp.r[0x1a + sreg] * GetMultiplyModifier(); dsp_set_long_prod(prod); Update_SR_Register(prod); @@ -1332,15 +1332,15 @@ void dsp_opc_mulmvz(uint16 opc) // NEW -void dsp_opc_mulx(uint16 opc) +void dsp_opc_mulx(u16 opc) { - uint8 sreg = ((opc >> 12) & 0x1); - uint8 treg = ((opc >> 11) & 0x1); + u8 sreg = ((opc >> 12) & 0x1); + u8 treg = ((opc >> 11) & 0x1); - sint64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); - sint64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); + s64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); + s64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); - sint64 prod = val1 * val2 * GetMultiplyModifier(); + s64 prod = val1 * val2 * GetMultiplyModifier(); dsp_set_long_prod(prod); Update_SR_Register(prod); @@ -1348,21 +1348,21 @@ void dsp_opc_mulx(uint16 opc) // NEW -void dsp_opc_mulxac(uint16 opc) +void dsp_opc_mulxac(u16 opc) { // add old prod to acc - uint8 rreg = (opc >> 8) & 0x1; - sint64 acR = dsp_get_long_acc(rreg) + dsp_get_long_prod(); + u8 rreg = (opc >> 8) & 0x1; + s64 acR = dsp_get_long_acc(rreg) + dsp_get_long_prod(); dsp_set_long_acc(rreg, acR); // math new prod - uint8 sreg = (opc >> 12) & 0x1; - uint8 treg = (opc >> 11) & 0x1; + u8 sreg = (opc >> 12) & 0x1; + u8 treg = (opc >> 11) & 0x1; - sint64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); - sint64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); + s64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); + s64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); - sint64 prod = val1 * val2 * GetMultiplyModifier(); + s64 prod = val1 * val2 * GetMultiplyModifier(); dsp_set_long_prod(prod); Update_SR_Register(prod); @@ -1370,21 +1370,21 @@ void dsp_opc_mulxac(uint16 opc) // NEW -void dsp_opc_mulxmv(uint16 opc) +void dsp_opc_mulxmv(u16 opc) { // add old prod to acc - uint8 rreg = ((opc >> 8) & 0x1); - sint64 acR = dsp_get_long_prod(); + u8 rreg = ((opc >> 8) & 0x1); + s64 acR = dsp_get_long_prod(); dsp_set_long_acc(rreg, acR); // math new prod - uint8 sreg = (opc >> 12) & 0x1; - uint8 treg = (opc >> 11) & 0x1; + u8 sreg = (opc >> 12) & 0x1; + u8 treg = (opc >> 11) & 0x1; - sint64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); - sint64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); + s64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); + s64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); - sint64 prod = val1 * val2 * GetMultiplyModifier(); + s64 prod = val1 * val2 * GetMultiplyModifier(); dsp_set_long_prod(prod); Update_SR_Register(prod); @@ -1392,20 +1392,20 @@ void dsp_opc_mulxmv(uint16 opc) // NEW -void dsp_opc_mulxmvz(uint16 opc) +void dsp_opc_mulxmvz(u16 opc) { // overwrite acc and clear low part - uint8 rreg = (opc >> 8) & 0x1; - sint64 prod = dsp_get_long_prod(); - sint64 acc = prod & ~0xffff; + u8 rreg = (opc >> 8) & 0x1; + s64 prod = dsp_get_long_prod(); + s64 acc = prod & ~0xffff; dsp_set_long_acc(rreg, acc); // math prod - uint8 sreg = (opc >> 12) & 0x1; - uint8 treg = (opc >> 11) & 0x1; + u8 sreg = (opc >> 12) & 0x1; + u8 treg = (opc >> 11) & 0x1; - sint64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); - sint64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); + s64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); + s64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); prod = val1 * val2 * GetMultiplyModifier(); dsp_set_long_prod(prod); @@ -1415,11 +1415,11 @@ void dsp_opc_mulxmvz(uint16 opc) // NEW -void dsp_opc_sub(uint16 opc) +void dsp_opc_sub(u16 opc) { - uint8 D = (opc >> 8) & 0x1; - sint64 Acc1 = dsp_get_long_acc(D); - sint64 Acc2 = dsp_get_long_acc(1 - D); + u8 D = (opc >> 8) & 0x1; + s64 Acc1 = dsp_get_long_acc(D); + s64 Acc2 = dsp_get_long_acc(1 - D); Acc1 -= Acc2; @@ -1434,67 +1434,67 @@ void dsp_opc_sub(uint16 opc) //------------------------------------------------------------- // NEW -void dsp_opc_maddx(uint16 opc) +void dsp_opc_maddx(u16 opc) { - uint8 sreg = (opc >> 9) & 0x1; - uint8 treg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 9) & 0x1; + u8 treg = (opc >> 8) & 0x1; - sint64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); - sint64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); + s64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); + s64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); - sint64 prod = dsp_get_long_prod(); + s64 prod = dsp_get_long_prod(); prod += val1 * val2 * GetMultiplyModifier(); dsp_set_long_prod(prod); } // NEW -void dsp_opc_msubx(uint16 opc) +void dsp_opc_msubx(u16 opc) { - uint8 sreg = (opc >> 9) & 0x1; - uint8 treg = (opc >> 8) & 0x1; + u8 sreg = (opc >> 9) & 0x1; + u8 treg = (opc >> 8) & 0x1; - sint64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); - sint64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); + s64 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); + s64 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); - sint64 prod = dsp_get_long_prod(); + s64 prod = dsp_get_long_prod(); prod -= val1 * val2 * GetMultiplyModifier(); dsp_set_long_prod(prod); } // NEW -void dsp_opc_maddc(uint16 opc) +void dsp_opc_maddc(u16 opc) { - uint sreg = (opc >> 9) & 0x1; - uint treg = (opc >> 8) & 0x1; + u32 sreg = (opc >> 9) & 0x1; + u32 treg = (opc >> 8) & 0x1; - sint64 val1 = dsp_get_acc_m(sreg); - sint64 val2 = dsp_get_ax_h(treg); + s64 val1 = dsp_get_acc_m(sreg); + s64 val2 = dsp_get_ax_h(treg); - sint64 prod = dsp_get_long_prod(); + s64 prod = dsp_get_long_prod(); prod += val1 * val2 * GetMultiplyModifier(); dsp_set_long_prod(prod); } // NEW -void dsp_opc_msubc(uint16 opc) +void dsp_opc_msubc(u16 opc) { - uint sreg = (opc >> 9) & 0x1; - uint treg = (opc >> 8) & 0x1; + u32 sreg = (opc >> 9) & 0x1; + u32 treg = (opc >> 8) & 0x1; - sint64 val1 = dsp_get_acc_m(sreg); - sint64 val2 = dsp_get_ax_h(treg); + s64 val1 = dsp_get_acc_m(sreg); + s64 val2 = dsp_get_ax_h(treg); - sint64 prod = dsp_get_long_prod(); + s64 prod = dsp_get_long_prod(); prod -= val1 * val2 * GetMultiplyModifier(); dsp_set_long_prod(prod); } //------------------------------------------------------------- -void dsp_op0(uint16 opc) +void dsp_op0(u16 opc) { if (opc == 0) { @@ -1706,7 +1706,7 @@ void dsp_op0(uint16 opc) } -void dsp_op1(uint16 opc) +void dsp_op1(u16 opc) { switch ((opc >> 8) & 0xf) { @@ -1763,11 +1763,11 @@ void dsp_op1(uint16 opc) } -void dsp_op2(uint16 opc) +void dsp_op2(u16 opc) { // lrs, srs - uint8 reg = ((opc >> 8) & 0x7) + 0x18; - uint16 addr = (sint8) opc; + u8 reg = ((opc >> 8) & 0x7) + 0x18; + u16 addr = (s8) opc; if (opc & 0x0800) { @@ -1782,7 +1782,7 @@ void dsp_op2(uint16 opc) } -void dsp_op3(uint16 opc) +void dsp_op3(u16 opc) { dsp_op_ext_ops_pro(opc); @@ -1823,7 +1823,7 @@ void dsp_op3(uint16 opc) } -void dsp_op4(uint16 opc) +void dsp_op4(u16 opc) { dsp_op_ext_ops_pro(opc); @@ -1866,7 +1866,7 @@ void dsp_op4(uint16 opc) } -void dsp_op5(uint16 opc) +void dsp_op5(u16 opc) { dsp_op_ext_ops_pro(opc); @@ -1904,7 +1904,7 @@ void dsp_op5(uint16 opc) } -void dsp_op6(uint16 opc) +void dsp_op6(u16 opc) { dsp_op_ext_ops_pro(opc); @@ -1942,7 +1942,7 @@ void dsp_op6(uint16 opc) } -void dsp_op7(uint16 opc) +void dsp_op7(u16 opc) { dsp_op_ext_ops_pro(opc); @@ -1994,7 +1994,7 @@ void dsp_op7(uint16 opc) } -void dsp_op8(uint16 opc) +void dsp_op8(u16 opc) { dsp_op_ext_ops_pro(opc); @@ -2041,7 +2041,7 @@ void dsp_op8(uint16 opc) } -void dsp_op9(uint16 opc) +void dsp_op9(u16 opc) { dsp_op_ext_ops_pro(opc); @@ -2087,7 +2087,7 @@ void dsp_op9(uint16 opc) } -void dsp_opab(uint16 opc) +void dsp_opab(u16 opc) { dsp_op_ext_ops_pro(opc); @@ -2124,7 +2124,7 @@ void dsp_opab(uint16 opc) } -void dsp_opcd(uint16 opc) +void dsp_opcd(u16 opc) { dsp_op_ext_ops_pro(opc); @@ -2161,7 +2161,7 @@ void dsp_opcd(uint16 opc) } -void dsp_ope(uint16 opc) +void dsp_ope(u16 opc) { dsp_op_ext_ops_pro(opc); @@ -2191,7 +2191,7 @@ void dsp_ope(uint16 opc) } -void dsp_opf(uint16 opc) +void dsp_opf(u16 opc) { dsp_op_ext_ops_pro(opc); diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes.h index e44ffa1c8c..4d16153cf1 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes.h @@ -27,20 +27,20 @@ #include "Globals.h" -void dsp_op0(uint16 opc); -void dsp_op1(uint16 opc); -void dsp_op2(uint16 opc); -void dsp_op3(uint16 opc); -void dsp_op4(uint16 opc); -void dsp_op5(uint16 opc); -void dsp_op6(uint16 opc); -void dsp_op7(uint16 opc); -void dsp_op8(uint16 opc); -void dsp_op9(uint16 opc); -void dsp_opab(uint16 opc); -void dsp_opcd(uint16 opc); -void dsp_ope(uint16 opc); -void dsp_opf(uint16 opc); +void dsp_op0(u16 opc); +void dsp_op1(u16 opc); +void dsp_op2(u16 opc); +void dsp_op3(u16 opc); +void dsp_op4(u16 opc); +void dsp_op5(u16 opc); +void dsp_op6(u16 opc); +void dsp_op7(u16 opc); +void dsp_op8(u16 opc); +void dsp_op9(u16 opc); +void dsp_opab(u16 opc); +void dsp_opcd(u16 opc); +void dsp_ope(u16 opc); +void dsp_opf(u16 opc); #define R_SR 0x13 diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes_helper.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes_helper.h index 38ba759a80..5d920474ef 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes_helper.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_opcodes_helper.h @@ -40,13 +40,13 @@ // // --------------------------------------------------------------------------------------- -inline void dsp_SR_set_flag(uint8 flag) +inline void dsp_SR_set_flag(u8 flag) { g_dsp.r[R_SR] |= (1 << flag); } -inline bool dsp_SR_is_flag_set(uint8 flag) +inline bool dsp_SR_is_flag_set(u8 flag) { return((g_dsp.r[R_SR] & (1 << flag)) > 0); } @@ -58,9 +58,9 @@ inline bool dsp_SR_is_flag_set(uint8 flag) // // --------------------------------------------------------------------------------------- -inline uint16 dsp_op_read_reg(uint8 reg) +inline u16 dsp_op_read_reg(u8 reg) { - uint16 val; + u16 val; switch (reg & 0x1f) { @@ -80,7 +80,7 @@ inline uint16 dsp_op_read_reg(uint8 reg) } -inline void dsp_op_write_reg(uint8 reg, uint16 val) +inline void dsp_op_write_reg(u8 reg, u16 val) { switch (reg & 0x1f) { @@ -105,15 +105,15 @@ inline void dsp_op_write_reg(uint8 reg, uint16 val) // --------------------------------------------------------------------------------------- -inline sint64 dsp_get_long_prod() +inline s64 dsp_get_long_prod() { #if PROFILE ProfilerAddDelta(g_dsp.err_pc, 1); #endif - sint64 val; - sint64 low_prod; - val = (sint8)g_dsp.r[0x16]; + s64 val; + s64 low_prod; + val = (s8)g_dsp.r[0x16]; val <<= 32; low_prod = g_dsp.r[0x15]; low_prod += g_dsp.r[0x17]; @@ -124,17 +124,17 @@ inline sint64 dsp_get_long_prod() } -inline void dsp_set_long_prod(sint64 val) +inline void dsp_set_long_prod(s64 val) { #if PROFILE ProfilerAddDelta(g_dsp.err_pc, 1); #endif - g_dsp.r[0x14] = (uint16)val; + g_dsp.r[0x14] = (u16)val; val >>= 16; - g_dsp.r[0x15] = (uint16)val; + g_dsp.r[0x15] = (u16)val; val >>= 16; - g_dsp.r[0x16] = (uint16)val; + g_dsp.r[0x16] = (u16)val; g_dsp.r[0x17] = 0; } @@ -145,16 +145,16 @@ inline void dsp_set_long_prod(sint64 val) // // --------------------------------------------------------------------------------------- -inline sint64 dsp_get_long_acc(uint8 reg) +inline s64 dsp_get_long_acc(u8 reg) { #if PROFILE ProfilerAddDelta(g_dsp.err_pc, 1); #endif _assert_(reg < 2); - sint64 val; - sint64 low_acc; - val = (sint8)g_dsp.r[0x10 + reg]; + s64 val; + s64 low_acc; + val = (s8)g_dsp.r[0x10 + reg]; val <<= 32; low_acc = g_dsp.r[0x1e + reg]; low_acc <<= 16; @@ -164,16 +164,16 @@ inline sint64 dsp_get_long_acc(uint8 reg) } -inline uint64 dsp_get_ulong_acc(uint8 reg) +inline u64 dsp_get_ulong_acc(u8 reg) { #if PROFILE ProfilerAddDelta(g_dsp.err_pc, 1); #endif _assert_(reg < 2); - uint64 val; - uint64 low_acc; - val = (uint8)g_dsp.r[0x10 + reg]; + u64 val; + u64 low_acc; + val = (u8)g_dsp.r[0x10 + reg]; val <<= 32; low_acc = g_dsp.r[0x1e + reg]; low_acc <<= 16; @@ -183,36 +183,36 @@ inline uint64 dsp_get_ulong_acc(uint8 reg) } -inline void dsp_set_long_acc(uint8 _reg, sint64 val) +inline void dsp_set_long_acc(u8 _reg, s64 val) { #if PROFILE ProfilerAddDelta(g_dsp.err_pc, 1); #endif _assert_(_reg < 2); - g_dsp.r[0x1c + _reg] = (uint16)val; + g_dsp.r[0x1c + _reg] = (u16)val; val >>= 16; - g_dsp.r[0x1e + _reg] = (uint16)val; + g_dsp.r[0x1e + _reg] = (u16)val; val >>= 16; - g_dsp.r[0x10 + _reg] = (uint16)val; + g_dsp.r[0x10 + _reg] = (u16)val; } -inline sint16 dsp_get_acc_l(uint8 _reg) +inline s16 dsp_get_acc_l(u8 _reg) { _assert_(_reg < 2); return(g_dsp.r[0x1c + _reg]); } -inline sint16 dsp_get_acc_m(uint8 _reg) +inline s16 dsp_get_acc_m(u8 _reg) { _assert_(_reg < 2); return(g_dsp.r[0x1e + _reg]); } -inline sint16 dsp_get_acc_h(uint8 _reg) +inline s16 dsp_get_acc_h(u8 _reg) { _assert_(_reg < 2); return(g_dsp.r[0x10 + _reg]); @@ -226,29 +226,29 @@ inline sint16 dsp_get_acc_h(uint8 _reg) // --------------------------------------------------------------------------------------- -inline sint64 dsp_get_long_acx(uint8 _reg) +inline s64 dsp_get_long_acx(u8 _reg) { #if PROFILE ProfilerAddDelta(g_dsp.err_pc, 1); #endif _assert_(_reg < 2); - sint64 val = (sint16)g_dsp.r[0x1a + _reg]; + s64 val = (s16)g_dsp.r[0x1a + _reg]; val <<= 16; - sint64 low_acc = g_dsp.r[0x18 + _reg]; + s64 low_acc = g_dsp.r[0x18 + _reg]; val |= low_acc; return(val); } -inline sint16 dsp_get_ax_l(uint8 _reg) +inline s16 dsp_get_ax_l(u8 _reg) { _assert_(_reg < 2); return(g_dsp.r[0x18 + _reg]); } -inline sint16 dsp_get_ax_h(uint8 _reg) +inline s16 dsp_get_ax_h(u8 _reg) { _assert_(_reg < 2); return(g_dsp.r[0x1a + _reg]); diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_registers.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_registers.cpp index 3d70274479..b430ac07d5 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_registers.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_registers.cpp @@ -29,7 +29,7 @@ -void dsp_reg_stack_push(uint8 stack_reg) +void dsp_reg_stack_push(u8 stack_reg) { g_dsp.reg_stack_ptr[stack_reg]++; g_dsp.reg_stack_ptr[stack_reg] &= DSP_STACK_MASK; @@ -37,7 +37,7 @@ void dsp_reg_stack_push(uint8 stack_reg) } -void dsp_reg_stack_pop(uint8 stack_reg) +void dsp_reg_stack_pop(u8 stack_reg) { g_dsp.r[DSP_REG_ST0 + stack_reg] = g_dsp.reg_stack[stack_reg][g_dsp.reg_stack_ptr[stack_reg]]; g_dsp.reg_stack_ptr[stack_reg]--; @@ -45,16 +45,16 @@ void dsp_reg_stack_pop(uint8 stack_reg) } -void dsp_reg_store_stack(uint8 stack_reg, uint16 val) +void dsp_reg_store_stack(u8 stack_reg, u16 val) { dsp_reg_stack_push(stack_reg); g_dsp.r[DSP_REG_ST0 + stack_reg] = val; } -uint16 dsp_reg_load_stack(uint8 stack_reg) +u16 dsp_reg_load_stack(u8 stack_reg) { - uint16 val = g_dsp.r[DSP_REG_ST0 + stack_reg]; + u16 val = g_dsp.r[DSP_REG_ST0 + stack_reg]; dsp_reg_stack_pop(stack_reg); return(val); } diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_registers.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_registers.h index 20a2525ab4..5edb2f0d95 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_registers.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_registers.h @@ -35,8 +35,8 @@ #define DSP_STACK_C 0 #define DSP_STACK_D 1 -void dsp_reg_store_stack(uint8 stack_reg, uint16 val); -uint16 dsp_reg_load_stack(uint8 stack_reg); +void dsp_reg_store_stack(u8 stack_reg, u16 val); +u16 dsp_reg_load_stack(u8 stack_reg); #endif diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/main.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/main.cpp index 6dbd4029e7..8a7f6f7e43 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/main.cpp @@ -45,8 +45,8 @@ SoundStream *soundStream = NULL; #define GDSP_MBOX_CPU 0 #define GDSP_MBOX_DSP 1 -uint32 g_LastDMAAddress = 0; -uint32 g_LastDMASize = 0; +u32 g_LastDMAAddress = 0; +u32 g_LastDMASize = 0; extern u32 m_addressPBs; bool AXTask(u32& _uMail); diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/opcodes.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/opcodes.cpp index 16fc50030d..ff5e2b7b88 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/opcodes.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/opcodes.cpp @@ -232,6 +232,6 @@ opc_t opcodes_ext[] = {"XXX", 0x0000, 0x0000, 1, 1, {{P_VAL, 1, 0, 0, 0x00ff}},}, }; -const uint32 opcodes_size = sizeof(opcodes) / sizeof(opc_t); -const uint32 opcodes_ext_size = sizeof(opcodes_ext) / sizeof(opc_t); +const u32 opcodes_size = sizeof(opcodes) / sizeof(opc_t); +const u32 opcodes_ext_size = sizeof(opcodes_ext) / sizeof(opc_t); diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/opcodes.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/opcodes.h index c26e291c22..3cf9c31c0b 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/opcodes.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/opcodes.h @@ -55,28 +55,28 @@ enum partype_t typedef struct opcpar_t { partype_t type; - uint8 size; - uint8 loc; - sint8 lshift; - uint16 mask; + u8 size; + u8 loc; + s8 lshift; + u16 mask; } opcpar_t; typedef struct opc_t { const char* name; - uint16 opcode; - uint16 opcode_mask; - uint8 size; - uint8 param_count; + u16 opcode; + u16 opcode_mask; + u8 size; + u8 param_count; opcpar_t params[8]; } opc_t; extern opc_t opcodes[]; -extern const uint32 opcodes_size; +extern const u32 opcodes_size; extern opc_t opcodes_ext[]; -extern const uint32 opcodes_ext_size; +extern const u32 opcodes_ext_size; -inline uint16 swap16(uint16 x) +inline u16 swap16(u16 x) { return((x >> 8) | (x << 8)); }