mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user