mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
DSP: Add txt file with luigi ucode comments (very basic). Rename some stuff. Remove function pointer in g_dsp structure, replace with a "Host" function call. Fix a problem where symbols weren't loaded into DSP debugger.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3563 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -58,8 +58,7 @@
|
||||
#include "WII_IPC_HLE_Device_net.h"
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <winsock.h>
|
||||
typedef int socklen_t;
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -287,7 +286,7 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn,
|
||||
// Clean the location of the output buffer to zeroes as a safety precaution */
|
||||
Memory::Memset(BufferOut, 0, BufferOutSize);
|
||||
|
||||
switch(_Command)
|
||||
switch (_Command)
|
||||
{
|
||||
case IOCTL_SO_STARTUP:
|
||||
break;
|
||||
@ -297,7 +296,7 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn,
|
||||
u32 TYPE = Memory::Read_U32(_BufferIn + 0x04);
|
||||
u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2);
|
||||
u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3);
|
||||
u32 Socket = socket(AF,TYPE,PROT);
|
||||
u32 Socket = socket(AF, TYPE, PROT);
|
||||
return Common::swap32(Socket); // So it doesn't get mangled later on
|
||||
}
|
||||
break;
|
||||
|
@ -413,6 +413,14 @@
|
||||
RelativePath=".\Src\DspIntBranch.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DSPIntExtOps.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DSPIntExtOps.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DspIntLoadStore.cpp"
|
||||
>
|
||||
@ -425,6 +433,10 @@
|
||||
RelativePath=".\Src\DspIntMultiplier.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DSPIntUtil.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Debugger"
|
||||
@ -446,6 +458,14 @@
|
||||
RelativePath=".\Src\disassemble.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DSPAccelerator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DSPAccelerator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DSPAnalyzer.cpp"
|
||||
>
|
||||
@ -486,6 +506,14 @@
|
||||
RelativePath=".\Src\DSPJit.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DSPMemoryMap.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DSPMemoryMap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DSPTables.cpp"
|
||||
>
|
||||
@ -494,14 +522,6 @@
|
||||
RelativePath=".\Src\DSPTables.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\gdsp_aram.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\gdsp_aram.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\gdsp_condition_codes.cpp"
|
||||
>
|
||||
@ -510,14 +530,6 @@
|
||||
RelativePath=".\Src\gdsp_condition_codes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\gdsp_ext_op.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\gdsp_ext_op.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\gdsp_interface.cpp"
|
||||
>
|
||||
@ -534,18 +546,6 @@
|
||||
RelativePath=".\Src\gdsp_interpreter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\gdsp_memory.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\gdsp_memory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\gdsp_opcodes_helper.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\gdsp_registers.cpp"
|
||||
>
|
||||
|
@ -15,8 +15,8 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _GDSP_ARAM_H
|
||||
#define _GDSP_ARAM_H
|
||||
#ifndef _DSP_ACCELERATOR_H
|
||||
#define _DSP_ACCELERATOR_H
|
||||
|
||||
u16 dsp_read_accelerator();
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "DSPAnalyzer.h"
|
||||
#include "DSPInterpreter.h"
|
||||
#include "DSPTables.h"
|
||||
#include "gdsp_memory.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
|
||||
namespace DSPAnalyzer {
|
||||
|
||||
@ -30,12 +30,13 @@ u8 code_flags[ISPACE];
|
||||
// as well give up its time slice immediately, after executing once.
|
||||
|
||||
// Max signature length is 6. A 0 in a signature is ignored.
|
||||
#define NUM_IDLE_SIGS 4
|
||||
#define NUM_IDLE_SIGS 5
|
||||
#define MAX_IDLE_SIG_SIZE 6
|
||||
|
||||
// 0xFFFF means ignore.
|
||||
const u16 idle_skip_sigs[NUM_IDLE_SIGS][MAX_IDLE_SIG_SIZE + 1] =
|
||||
{
|
||||
// From AX:
|
||||
{ 0x26fc, // LRS $30, @DMBH
|
||||
0x02c0, 0x8000, // ANDCF $30, #0x8000
|
||||
0x029d, 0xFFFF, // JLZ 0x027a
|
||||
@ -52,6 +53,12 @@ const u16 idle_skip_sigs[NUM_IDLE_SIGS][MAX_IDLE_SIG_SIZE + 1] =
|
||||
0x03c0, 0x8000, // ANDCF $31, #0x8000
|
||||
0x029c, 0xFFFF, // JLNZ 0x0280
|
||||
0, 0 }, // RET
|
||||
|
||||
// From Zelda:
|
||||
{ 0x00de, 0xFFFE, // LR $AC0.M, @CMBH
|
||||
0x02c0, 0x8000, // ANDCF $AC0.M, #0x8000
|
||||
0x029c, 0xFFFF, // JLNZ 0x05cf
|
||||
0 }
|
||||
};
|
||||
|
||||
void Reset()
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "gdsp_interface.h"
|
||||
#include "gdsp_registers.h"
|
||||
#include "gdsp_opcodes_helper.h"
|
||||
#include "DSPIntUtil.h"
|
||||
|
||||
SDSP g_dsp;
|
||||
|
||||
@ -156,8 +156,7 @@ void DSPCore_CheckExternalInterrupt()
|
||||
// level 7 is the interrupt exception
|
||||
DSPCore_SetException(7);
|
||||
|
||||
// Uh, confusing. Can this really be right?
|
||||
g_dsp.cr &= ~0x0002;
|
||||
g_dsp.cr &= ~CR_EXTERNAL_INT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,23 +59,35 @@ struct SDSP
|
||||
#if PROFILE
|
||||
u16 err_pc;
|
||||
#endif
|
||||
u16 *iram;
|
||||
u16 *dram;
|
||||
u16 *irom;
|
||||
u16 *coef;
|
||||
u8 *cpu_ram;
|
||||
|
||||
// This is NOT the same cr as r[DSP_REG_CR].
|
||||
// This register is shared with the main emulation, see DSP.cpp
|
||||
// The plugin has control over 0x0C07 of this reg.
|
||||
// Bits are defined in a struct in DSP.cpp.
|
||||
u16 cr;
|
||||
|
||||
u8 reg_stack_ptr[4];
|
||||
u8 exceptions; // pending exceptions?
|
||||
bool exception_in_progress_hack; // is this the same as "exception enabled"?
|
||||
|
||||
// lets make stack depth to 32 for now
|
||||
// Let's make stack depth 32 for now. The real DSP has different depths
|
||||
// for the different stacks, but it would be strange if any ucode relied on stack
|
||||
// overflows since on the DSP, when the stack overflows, you're screwed.
|
||||
u16 reg_stack[4][DSP_STACK_DEPTH];
|
||||
void (*irq_request)(void);
|
||||
|
||||
// for debugger only
|
||||
// For debugging.
|
||||
u32 iram_crc;
|
||||
u64 step_counter;
|
||||
|
||||
// When state saving, all of the above can just be memcpy'd into the save state.
|
||||
// The below needs special handling.
|
||||
u16 *iram;
|
||||
u16 *dram;
|
||||
u16 *irom;
|
||||
u16 *coef;
|
||||
|
||||
// This one doesn't really belong here.
|
||||
u8 *cpu_ram;
|
||||
};
|
||||
|
||||
extern SDSP g_dsp;
|
||||
|
@ -27,6 +27,7 @@ u8 DSPHost_ReadHostMemory(u32 addr);
|
||||
void DSPHost_WriteHostMemory(u8 value, u32 addr);
|
||||
bool DSPHost_OnThread();
|
||||
bool DSPHost_Running();
|
||||
void DSPHost_InterruptRequest();
|
||||
u32 DSPHost_CodeLoaded(const u8 *ptr, int size);
|
||||
|
||||
#endif
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
====================================================================*/
|
||||
|
||||
#include "gdsp_opcodes_helper.h"
|
||||
#include "gdsp_memory.h"
|
||||
#include "DSPIntUtil.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
|
||||
// Extended opcodes do not exist on their own. These opcodes can only be
|
||||
// attached to opcodes that allow extending (8 lower bits of opcode not used by
|
@ -23,19 +23,18 @@
|
||||
|
||||
====================================================================*/
|
||||
|
||||
#ifndef _GDSP_OPCODES_HELPER_H
|
||||
#define _GDSP_OPCODES_HELPER_H
|
||||
#ifndef _DSP_INT_UTIL_H
|
||||
#define _DSP_INT_UTIL_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#include "DSPInterpreter.h"
|
||||
#include "DSPCore.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
|
||||
#include "gdsp_memory.h"
|
||||
#include "gdsp_interpreter.h"
|
||||
#include "gdsp_registers.h"
|
||||
#include "gdsp_ext_op.h"
|
||||
|
||||
// #include "DSPIntExtOps.h"
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// --- SR
|
||||
@ -51,20 +50,8 @@ inline bool dsp_SR_is_flag_set(int flag)
|
||||
}
|
||||
|
||||
|
||||
// See http://code.google.com/p/dolphin-emu/source/detail?r=3125
|
||||
inline void dsp_decrement_addr_reg(int reg)
|
||||
{
|
||||
// This one was easy. increment is worse...
|
||||
if ((g_dsp.r[reg] & g_dsp.r[DSP_REG_WR0 + reg]) == 0)
|
||||
g_dsp.r[reg] |= g_dsp.r[DSP_REG_WR0 + reg];
|
||||
else
|
||||
g_dsp.r[reg]--;
|
||||
}
|
||||
|
||||
|
||||
// HORRIBLE UGLINESS, someone please fix.
|
||||
// See http://code.google.com/p/dolphin-emu/source/detail?r=3125
|
||||
|
||||
inline u16 ToMask(u16 a)
|
||||
{
|
||||
a = a | (a >> 8);
|
||||
@ -82,6 +69,16 @@ inline void dsp_increment_addr_reg(int reg)
|
||||
g_dsp.r[reg]++;
|
||||
}
|
||||
|
||||
// See http://code.google.com/p/dolphin-emu/source/detail?r=3125
|
||||
inline void dsp_decrement_addr_reg(int reg)
|
||||
{
|
||||
// This one is easy. Looks like a hw implementation. Increment is worse...
|
||||
if ((g_dsp.r[reg] & g_dsp.r[DSP_REG_WR0 + reg]) == 0)
|
||||
g_dsp.r[reg] |= g_dsp.r[DSP_REG_WR0 + reg];
|
||||
else
|
||||
g_dsp.r[reg]--;
|
||||
}
|
||||
|
||||
inline void dsp_increase_addr_reg(int reg, s16 value)
|
||||
{
|
||||
// TODO: DO RIGHT!
|
@ -26,20 +26,20 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gdsp_interpreter.h"
|
||||
#include "gdsp_memory.h"
|
||||
#include "gdsp_interface.h"
|
||||
|
||||
#include "DSPMemoryMap.h"
|
||||
#include "DSPCore.h"
|
||||
|
||||
u16 dsp_imem_read(u16 addr)
|
||||
{
|
||||
switch (addr >> 12)
|
||||
{
|
||||
case 0:
|
||||
case 0: // 0xxx IRAM
|
||||
return g_dsp.iram[addr & DSP_IRAM_MASK];
|
||||
case 8:
|
||||
case 8: // 8xxx IROM - contains code to receive code for IRAM, and a bunch of mixing loops.
|
||||
return g_dsp.irom[addr & DSP_IROM_MASK];
|
||||
default:
|
||||
default: // Unmapped/non-existing memory
|
||||
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Executing from invalid (%04x) memory", g_dsp.pc, addr);
|
||||
return 0;
|
||||
}
|
||||
@ -49,16 +49,17 @@ u16 dsp_dmem_read(u16 addr)
|
||||
{
|
||||
switch (addr >> 12)
|
||||
{
|
||||
case 0x0: // 0xxx DRAM
|
||||
case 0x0: // 0xxx DRAM
|
||||
return g_dsp.dram[addr & DSP_DRAM_MASK];
|
||||
|
||||
case 0x1: // 1xxx COEF
|
||||
case 0x1: // 1xxx COEF
|
||||
// DEBUG_LOG(DSPLLE, "%04x : Coef Read @ %04x", g_dsp.pc, addr);
|
||||
return g_dsp.coef[addr & DSP_COEF_MASK];
|
||||
|
||||
case 0xf: // Fxxx HW regs
|
||||
case 0xf: // Fxxx HW regs
|
||||
return gdsp_ifx_read(addr);
|
||||
|
||||
default: // error
|
||||
default: // Unmapped/non-existing memory
|
||||
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Read from UNKNOWN (%04x) memory", g_dsp.pc, addr);
|
||||
return 0;
|
||||
}
|
||||
@ -73,14 +74,14 @@ void dsp_dmem_write(u16 addr, u16 val)
|
||||
break;
|
||||
|
||||
case 0x1: // 1xxx COEF
|
||||
ERROR_LOG(DSPLLE, "someone writes to COEF (pc = %02x)", g_dsp.pc);
|
||||
ERROR_LOG(DSPLLE, "Illegal write to COEF (pc = %02x)", g_dsp.pc);
|
||||
break;
|
||||
|
||||
case 0xf: // Fxxx HW regs
|
||||
gdsp_ifx_write(addr, val);
|
||||
break;
|
||||
|
||||
default: // error
|
||||
default: // Unmapped/non-existing memory
|
||||
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Write to UNKNOWN (%04x) memory", g_dsp.pc, addr);
|
||||
break;
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
====================================================================*/
|
||||
|
||||
#ifndef _GDSP_MEMORY_H
|
||||
#define _GDSP_MEMORY_H
|
||||
|
@ -53,7 +53,7 @@ jnz, ifs, retlnz
|
||||
|
||||
#include "DSPInterpreter.h"
|
||||
#include "DSPJit.h"
|
||||
#include "gdsp_ext_op.h"
|
||||
#include "DSPIntExtOps.h"
|
||||
|
||||
void nop(const UDSPInstruction& opc)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "DSPInterpreter.h"
|
||||
|
||||
#include "gdsp_condition_codes.h"
|
||||
#include "gdsp_opcodes_helper.h"
|
||||
#include "DSPIntUtil.h"
|
||||
|
||||
// Arithmetic and accumulator control.
|
||||
|
||||
|
@ -21,9 +21,8 @@
|
||||
#include "DSPCore.h"
|
||||
|
||||
#include "gdsp_condition_codes.h"
|
||||
#include "gdsp_opcodes_helper.h"
|
||||
#include "gdsp_memory.h"
|
||||
|
||||
#include "DSPIntUtil.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
|
||||
namespace DSPInterpreter {
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
#include "DSPInterpreter.h"
|
||||
|
||||
#include "gdsp_memory.h"
|
||||
#include "gdsp_opcodes_helper.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
#include "DSPIntUtil.h"
|
||||
|
||||
namespace DSPInterpreter {
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "DSPCore.h"
|
||||
|
||||
#include "gdsp_registers.h"
|
||||
#include "gdsp_opcodes_helper.h"
|
||||
#include "DSPIntUtil.h"
|
||||
|
||||
namespace DSPInterpreter {
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "DSPInterpreter.h"
|
||||
|
||||
#include "gdsp_condition_codes.h"
|
||||
#include "gdsp_opcodes_helper.h"
|
||||
#include "DSPIntUtil.h"
|
||||
#include "gdsp_registers.h"
|
||||
|
||||
namespace DSPInterpreter {
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "DSPHost.h"
|
||||
#include "DSPTables.h"
|
||||
#include "DSPAnalyzer.h"
|
||||
#include "gdsp_aram.h"
|
||||
#include "DSPAccelerator.h"
|
||||
#include "gdsp_interpreter.h"
|
||||
#include "gdsp_interface.h"
|
||||
|
||||
@ -124,7 +124,7 @@ void gdsp_ifx_write(u16 addr, u16 val)
|
||||
{
|
||||
case 0xfb: // DIRQ
|
||||
if (val & 0x1)
|
||||
g_dsp.irq_request();
|
||||
DSPHost_InterruptRequest();
|
||||
break;
|
||||
|
||||
case 0xfc: // DMBH
|
||||
@ -311,5 +311,3 @@ void gdsp_dma()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,12 +32,14 @@
|
||||
#include "DSPAnalyzer.h"
|
||||
|
||||
#include "gdsp_interface.h"
|
||||
#include "gdsp_opcodes_helper.h"
|
||||
#include "DSPIntUtil.h"
|
||||
|
||||
namespace DSPInterpreter {
|
||||
|
||||
volatile u32 gdsp_running;
|
||||
|
||||
// NOTE: These have nothing to do with g_dsp.r[DSP_REG_CR].
|
||||
|
||||
// Hm, should instructions that change CR use this? Probably not (but they
|
||||
// should call UpdateCachedCR())
|
||||
void WriteCR(u16 val)
|
||||
@ -69,6 +71,8 @@ u16 ReadCR()
|
||||
return g_dsp.cr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void HandleLoop()
|
||||
{
|
||||
// Handle looping hardware.
|
||||
|
@ -93,7 +93,8 @@
|
||||
#define DSP_STACK_D 1
|
||||
|
||||
|
||||
// CR bits
|
||||
// cr (Not g_dsp.r[CR]) bits
|
||||
// See HW/DSP.cpp.
|
||||
#define CR_HALT 0x0004
|
||||
#define CR_EXTERNAL_INT 0x0002
|
||||
|
||||
|
@ -19,14 +19,13 @@
|
||||
#include "FileUtil.h"
|
||||
#include "DSPCodeUtil.h"
|
||||
|
||||
//#include "dsp_test.h"
|
||||
|
||||
// Stub out the dsplib host stuff, since this is just a simple cmdline tools.
|
||||
u8 DSPHost_ReadHostMemory(u32 addr) { return 0; }
|
||||
void DSPHost_WriteHostMemory(u8 value, u32 addr) {}
|
||||
bool DSPHost_OnThread() { return false; }
|
||||
bool DSPHost_Running() { return true; }
|
||||
u32 DSPHost_CodeLoaded(const u8 *ptr, int size) {return 0x1337c0de;}
|
||||
void DSPHost_InterruptRequest() {}
|
||||
|
||||
// This test goes from text ASM to binary to text ASM and once again back to binary.
|
||||
// Then the two binaries are compared.
|
||||
|
@ -54,8 +54,8 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
|
||||
|
||||
case 0x088e38a5: // IPL - JAP
|
||||
case 0xd73338cf: // IPL
|
||||
case 0x42f64ac4: // Luigi (after fix)
|
||||
case 0x4be6a5cb: // AC, Pikmin (after fix)
|
||||
case 0x42f64ac4: // Luigi
|
||||
case 0x4be6a5cb: // AC, Pikmin
|
||||
INFO_LOG(CONSOLE, "JAC (early Zelda) ucode chosen\n");
|
||||
return new CUCode_Jac(_rMailHandler);
|
||||
// return new CUCode_Zelda(_rMailHandler, false);
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "disassemble.h"
|
||||
|
||||
#include "DSPSymbols.h"
|
||||
#include "gdsp_memory.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
|
||||
void DSPDebugInterface::disasm(unsigned int address, char *dest, int max_size)
|
||||
{
|
||||
|
@ -23,6 +23,14 @@
|
||||
|
||||
extern DSPInitialize g_dspInitialize;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
|
||||
#include "DSPConfigDlgLLE.h"
|
||||
#include "Debugger/Debugger.h" // For the DSPDebuggerLLE class
|
||||
extern DSPDebuggerLLE* m_DebuggerFrame;
|
||||
|
||||
#endif
|
||||
|
||||
// The user of the DSPCore library must supply a few functions so that the
|
||||
// emulation core can access the environment it runs in. If the emulation
|
||||
// core isn't used, for example in an asm/disasm tool, then most of these
|
||||
@ -48,6 +56,12 @@ bool DSPHost_Running()
|
||||
return !(*g_dspInitialize.pEmulatorState);
|
||||
}
|
||||
|
||||
void DSPHost_InterruptRequest()
|
||||
{
|
||||
// Fire an interrupt on the PPC ASAP.
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
|
||||
u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
|
||||
{
|
||||
u32 crc = GenerateCRC(ptr, size);
|
||||
@ -68,13 +82,22 @@ u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
|
||||
|
||||
// TODO: Don't hardcode for Zelda.
|
||||
NOTICE_LOG(DSPLLE, "CRC: %08x", ector_crc);
|
||||
if (ector_crc != 0x86840740 || !DSPSymbols::ReadAnnotatedAssembly("../../Docs/DSP/DSP_UC_Zelda.txt"))
|
||||
{
|
||||
DSPSymbols::Clear();
|
||||
|
||||
DSPSymbols::Clear();
|
||||
bool success = false;
|
||||
switch (ector_crc) {
|
||||
case 0x86840740: success = DSPSymbols::ReadAnnotatedAssembly("../../Docs/DSP/DSP_UC_Zelda.txt"); break;
|
||||
case 0x42f64ac4: success = DSPSymbols::ReadAnnotatedAssembly("../../Docs/DSP/DSP_UC_Luigi.txt"); break;
|
||||
default: success = false; break;
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
DSPSymbols::AutoDisassembly(0x0, 0x1000);
|
||||
}
|
||||
|
||||
// Always add the ROM.
|
||||
DSPSymbols::AutoDisassembly(0x8000, 0x9000);
|
||||
|
||||
m_DebuggerFrame->Refresh();
|
||||
return crc;
|
||||
}
|
@ -77,7 +77,7 @@ wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
|
||||
}
|
||||
|
||||
DSPRegisterView::DSPRegisterView(wxWindow *parent, wxWindowID id)
|
||||
: wxGrid(parent, id)
|
||||
: wxGrid(parent, id, wxDefaultPosition, wxSize(130, 120))
|
||||
{
|
||||
SetTable(new CRegTable(), true);
|
||||
SetRowLabelSize(0);
|
||||
|
@ -41,7 +41,6 @@ DSPDebuggerLLE::DSPDebuggerLLE(wxWindow *parent, wxWindowID id, const wxString &
|
||||
, m_CachedStepCounter(-1)
|
||||
, m_CachedCR(-1)
|
||||
, m_State(RUN)
|
||||
, m_CachedUCodeCRC(-1)
|
||||
{
|
||||
CreateGUIControls();
|
||||
}
|
||||
@ -64,31 +63,27 @@ void DSPDebuggerLLE::CreateGUIControls()
|
||||
m_Toolbar->AddTool(ID_JUMPTOTOOL, wxT("Jump"), wxNullBitmap, wxT("Jump to a specific Address"), wxITEM_NORMAL);
|
||||
m_Toolbar->AddSeparator();
|
||||
|
||||
m_Toolbar->AddCheckTool(ID_CHECK_ASSERTINT, wxT("AssertInt"), wxNullBitmap, wxNullBitmap, wxEmptyString);
|
||||
m_Toolbar->AddCheckTool(ID_CHECK_HALT, wxT("Halt"), wxNullBitmap, wxNullBitmap, wxEmptyString);
|
||||
m_Toolbar->AddCheckTool(ID_CHECK_INIT, wxT("Init"), wxNullBitmap, wxNullBitmap, wxEmptyString);
|
||||
m_Toolbar->AddSeparator();
|
||||
|
||||
m_Toolbar->AddControl(new wxTextCtrl(m_Toolbar, ID_ADDRBOX, _T("")));
|
||||
|
||||
m_Toolbar->Realize();
|
||||
|
||||
wxBoxSizer* sMain = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
sizerLeft->Add(m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND);
|
||||
sizerLeft->Add(m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition, wxSize(140, 100), 0, NULL, wxLB_SORT),
|
||||
1, wxEXPAND);
|
||||
|
||||
m_CodeView = new CCodeView(&debug_interface, &DSPSymbols::g_dsp_symbol_db, this, ID_CODEVIEW);
|
||||
m_CodeView->SetPlain();
|
||||
|
||||
sMain->Add(sizerLeft, 1, wxALL|wxEXPAND, 0);
|
||||
sMain->Add(sizerLeft, 0, wxEXPAND, 0);
|
||||
|
||||
sMain->Add(m_CodeView, 4, wxALL|wxEXPAND, 5);
|
||||
sMain->Add(m_CodeView, 4, wxEXPAND, 0);
|
||||
|
||||
wxStaticLine* m_staticline = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL);
|
||||
sMain->Add(m_staticline, 0, wxEXPAND|wxALL, 5);
|
||||
sMain->Add(m_staticline, 0, wxEXPAND|wxALL, 0);
|
||||
|
||||
m_Regs = new DSPRegisterView(this, ID_DSP_REGS);
|
||||
sMain->Add(m_Regs, 1, wxEXPAND|wxALL, 5);
|
||||
sMain->Add(m_Regs, 0, wxEXPAND|wxALL, 5);
|
||||
|
||||
this->SetSizer(sMain);
|
||||
this->Layout();
|
||||
@ -165,28 +160,15 @@ void DSPDebuggerLLE::UpdateSymbolMap()
|
||||
if (g_dsp.dram == NULL)
|
||||
return;
|
||||
|
||||
if (m_CachedUCodeCRC != g_dsp.iram_crc)
|
||||
m_SymbolList->Freeze(); // HyperIris: wx style fast filling
|
||||
m_SymbolList->Clear();
|
||||
for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator();
|
||||
iter != DSPSymbols::g_dsp_symbol_db.End(); iter++)
|
||||
{
|
||||
// load symbol map (if there is one)
|
||||
m_CachedUCodeCRC = g_dsp.iram_crc;
|
||||
char FileName[256];
|
||||
sprintf(FileName, "%sDSP_%08x.map", FULL_MAPS_DIR, m_CachedUCodeCRC);
|
||||
|
||||
// LoadSymbolMap(FileName);
|
||||
|
||||
m_SymbolList->Freeze(); // HyperIris: wx style fast filling
|
||||
m_SymbolList->Clear();
|
||||
for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator();
|
||||
iter != DSPSymbols::g_dsp_symbol_db.End(); iter++)
|
||||
{
|
||||
int idx = m_SymbolList->Append(wxString::FromAscii(iter->second.name.c_str()));
|
||||
m_SymbolList->SetClientData(idx, (void*)&iter->second);
|
||||
}
|
||||
m_SymbolList->Thaw();
|
||||
|
||||
// rebuild the disasm
|
||||
// RebuildDisAsmListView();
|
||||
int idx = m_SymbolList->Append(wxString::FromAscii(iter->second.name.c_str()));
|
||||
m_SymbolList->SetClientData(idx, (void*)&iter->second);
|
||||
}
|
||||
m_SymbolList->Thaw();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnSymbolListChange(wxCommandEvent& event)
|
||||
@ -209,9 +191,9 @@ void DSPDebuggerLLE::UpdateRegisterFlags()
|
||||
if (m_CachedCR == g_dsp.cr)
|
||||
return;
|
||||
|
||||
m_Toolbar->ToggleTool(ID_CHECK_ASSERTINT, g_dsp.cr & 0x02 ? true : false);
|
||||
m_Toolbar->ToggleTool(ID_CHECK_HALT, g_dsp.cr & 0x04 ? true : false);
|
||||
m_Toolbar->ToggleTool(ID_CHECK_INIT, g_dsp.cr & 0x800 ? true : false);
|
||||
// m_Toolbar->ToggleTool(ID_CHECK_ASSERTINT, g_dsp.cr & 0x02 ? true : false);
|
||||
// m_Toolbar->ToggleTool(ID_CHECK_HALT, g_dsp.cr & 0x04 ? true : false);
|
||||
// m_Toolbar->ToggleTool(ID_CHECK_INIT, g_dsp.cr & 0x800 ? true : false);
|
||||
|
||||
m_CachedCR = g_dsp.cr;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "disassemble.h"
|
||||
#include "gdsp_interpreter.h"
|
||||
#include "gdsp_memory.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
#include "../DSPDebugInterface.h"
|
||||
|
||||
class DSPRegisterView;
|
||||
@ -107,7 +107,6 @@ private:
|
||||
DSPDebugInterface debug_interface;
|
||||
u64 m_CachedStepCounter;
|
||||
u16 m_CachedCR;
|
||||
u32 m_CachedUCodeCRC;
|
||||
|
||||
// GUI updaters
|
||||
void UpdateDisAsmListView();
|
||||
|
@ -26,18 +26,18 @@
|
||||
// =======================================================================================
|
||||
// For PB address detection
|
||||
// --------------
|
||||
|
||||
// This will only work on GC, not Wii.
|
||||
u32 RAM_MASK = 0x1FFFFFF;
|
||||
|
||||
u16 Memory_Read_U16(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return Common::swap16(*(u16*)&g_dsp.cpu_ram[_uAddress]);
|
||||
return Common::swap16(*(u16*)&g_dsp.cpu_ram[_uAddress & RAM_MASK]);
|
||||
}
|
||||
|
||||
u32 Memory_Read_U32(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return Common::swap32(*(u32*)&g_dsp.cpu_ram[_uAddress]);
|
||||
return Common::swap32(*(u32*)&g_dsp.cpu_ram[_uAddress & RAM_MASK]);
|
||||
}
|
||||
|
||||
#if PROFILE
|
||||
|
@ -193,13 +193,6 @@ void DSP_DebugBreak()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void dspi_req_dsp_irq()
|
||||
{
|
||||
// Fire an interrupt on the PPC ASAP.
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
|
||||
void Initialize(void *init)
|
||||
{
|
||||
bCanWork = true;
|
||||
@ -211,8 +204,6 @@ void Initialize(void *init)
|
||||
std::string coef_filename = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + DSP_COEF;
|
||||
bCanWork = DSPCore_Init(irom_filename.c_str(), coef_filename.c_str());
|
||||
g_dsp.cpu_ram = g_dspInitialize.pGetMemoryPointer(0);
|
||||
g_dsp.irq_request = dspi_req_dsp_irq;
|
||||
// g_dsp.exception_in_progress_hack = false;
|
||||
DSPCore_Reset();
|
||||
|
||||
if (!bCanWork)
|
||||
|
Reference in New Issue
Block a user