From 44db8cd0b8c86f28a89365a5ff8db284cea67d0f Mon Sep 17 00:00:00 2001 From: "XTra.KrazzY" Date: Wed, 1 Apr 2009 22:41:16 +0000 Subject: [PATCH] LLE-WIP: More progress on the opcode lookup table. Still haven't put the correct interpreter functions into the opcode table. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2822 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Src/DSPInterpreter.cpp | 5 +++-- .../Plugin_DSP_LLE-testing/Src/DSPTables.cpp | 21 ++++++++----------- .../Plugin_DSP_LLE-testing/Src/DSPTables.h | 5 ++++- .../Plugin_DSP_LLE-testing/Src/main.cpp | 1 - 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp index 2445757273..80128e6096 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp @@ -177,9 +177,10 @@ bool CheckCondition(u8 _Condition) void unknown(const UDSPInstruction& opc) { - _assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception"); + //_assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception"); + PanicAlert("Unimplemented instruction %d", opc.hex); ERROR_LOG(DSPHLE, "unknown opcode %d", opc.hex); - g_dsp.pc = g_dsp.err_pc; + //g_dsp.pc = g_dsp.err_pc; } void call(const UDSPInstruction& opc) diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp index 646e8aa151..26d8f05afa 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp @@ -23,10 +23,6 @@ #include "DSPInterpreter.h" #include "DSPJit.h" -void unimplementedInst(const UDSPInstruction& inst) { - PanicAlert("Unimplemented instruction %d", inst.hex); -} - void nop(const UDSPInstruction&) {} // TODO(XK): Fill up the tables with the corresponding instructions @@ -239,15 +235,16 @@ DSPOPCTemplate opcodes_ext[] = const u32 opcodes_size = sizeof(opcodes) / sizeof(DSPOPCTemplate); const u32 opcodes_ext_size = sizeof(opcodes_ext) / sizeof(DSPOPCTemplate); -void InitInstructionTable() { - // TODO(XK): Fill -} +dspInstFunc opTable[OPTABLE_SIZE]; -void DestroyInstructionTable() { - // TODO(XK): Fill -} +void InitInstructionTable() { + for(int i = 0; i < OPTABLE_SIZE; i++) + opTable[i] = DSPInterpreter::unknown; + + for(int i = 0; i < opcodes_size; i++) + opTable[opcodes[i].opcode] = opcodes[i].interpFunc; +} void ComputeInstruction(const UDSPInstruction& inst) { - // TODO(XK): Fill - DSPInterpreter::unknown(inst); + opTable[inst.hex](inst); } diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.h index f9202873d5..6b434c4040 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.h @@ -48,6 +48,8 @@ enum parameterType #define P_EXT 0x80 +#define OPTABLE_SIZE 65536 + union UDSPInstruction { u16 hex; @@ -101,8 +103,9 @@ extern const u32 opcodes_size; extern DSPOPCTemplate opcodes_ext[]; extern const u32 opcodes_ext_size; +extern dspInstFunc opTable[]; + void InitInstructionTable(); -void DestroyInstructionTable(); void ComputeInstruction(const UDSPInstruction& inst); diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/main.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/main.cpp index 3a4d93e2e0..ad661732fa 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/main.cpp @@ -259,7 +259,6 @@ void Shutdown(void) { bIsRunning = false; gdsp_stop(); - DestroyInstructionTable(); AudioCommon::ShutdownSoundStream(); }