From b6bca2485055a5920aa03834ede34bdfc29293c3 Mon Sep 17 00:00:00 2001 From: Kingcom Date: Sun, 28 Jul 2013 15:24:33 +0200 Subject: [PATCH] -added assemble option to disassembly view -added 16bit li --- Core/MIPS/MIPSAsm.cpp | 4 ++-- Core/MIPS/MIPSAsm.h | 2 +- Core/MIPS/MIPSAsmTables.cpp | 1 + Windows/Debugger/CtrlDisAsmView.cpp | 27 +++++++++++++++++++++++++++ Windows/Debugger/CtrlDisAsmView.h | 1 + Windows/ppsspp.rc | Bin 39214 -> 39406 bytes Windows/resource.h | Bin 26754 -> 26848 bytes 7 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Core/MIPS/MIPSAsm.cpp b/Core/MIPS/MIPSAsm.cpp index fa3248a0c7..a9c96856de 100644 --- a/Core/MIPS/MIPSAsm.cpp +++ b/Core/MIPS/MIPSAsm.cpp @@ -28,10 +28,10 @@ void SplitLine(const char* Line, char* Name, char* Arguments) *Arguments = 0; } -bool MipsAssembleOpcode(std::string& line, DebugInterface* cpu, u32 address, u32& dest) +bool MipsAssembleOpcode(char* line, DebugInterface* cpu, u32 address, u32& dest) { char name[64],args[256]; - SplitLine(line.c_str(),name,args); + SplitLine(line,name,args); CMipsInstruction Opcode(cpu); if (cpu == NULL || Opcode.Load(name,args,(int)address) == false) diff --git a/Core/MIPS/MIPSAsm.h b/Core/MIPS/MIPSAsm.h index 92c29d130d..9c851c06b4 100644 --- a/Core/MIPS/MIPSAsm.h +++ b/Core/MIPS/MIPSAsm.h @@ -6,7 +6,7 @@ namespace MIPSAsm { -bool MipsAssembleOpcode(std::string& line, DebugInterface* cpu, u32 address, u32& dest); +bool MipsAssembleOpcode(char* line, DebugInterface* cpu, u32 address, u32& dest); typedef enum eMipsImmediateType { MIPS_NOIMMEDIATE, MIPS_IMMEDIATE5, MIPS_IMMEDIATE16, MIPS_IMMEDIATE20, MIPS_IMMEDIATE26 }; diff --git a/Core/MIPS/MIPSAsmTables.cpp b/Core/MIPS/MIPSAsmTables.cpp index a49b68c58e..b1ecfbf4d4 100644 --- a/Core/MIPS/MIPSAsmTables.cpp +++ b/Core/MIPS/MIPSAsmTables.cpp @@ -219,6 +219,7 @@ const tMipsOpcode MipsOpcodes[] = { // OPCODE 09 - ADDIU { "addiu", "t,s,i", 0x24000000, O_RT|O_RS|O_I16 }, { "addiu", "s,i", 0x24000000, O_RST|O_I16 }, + { "li", "t,i", 0x24000000, O_RT|O_I16 }, // OPCODE 0A - SLTI { "slti", "t,s,i", 0x28000000, O_RT|O_RS|O_I16 }, { "slti", "s,i", 0x28000000, O_RST|O_I16 }, diff --git a/Windows/Debugger/CtrlDisAsmView.cpp b/Windows/Debugger/CtrlDisAsmView.cpp index bb6e938868..4a87d5bf06 100644 --- a/Windows/Debugger/CtrlDisAsmView.cpp +++ b/Windows/Debugger/CtrlDisAsmView.cpp @@ -7,6 +7,7 @@ #include "../WndMainWindow.h" #include "../InputBox.h" +#include "Core/MIPS/MIPSAsm.h" #include "Core/Config.h" #include "CtrlDisAsmView.h" #include "Debugger_MemoryDlg.h" @@ -284,6 +285,25 @@ void CtrlDisAsmView::parseDisasm(const char* disasm, char* opcode, char* argumen *arguments = 0; } +void CtrlDisAsmView::assembleOpcode(u32 address, std::string defaultText) +{ + char op[256]; + u32 encoded; + + bool result = InputBox_GetString(MainWindow::GetHInstance(),wnd,"Assemble opcode",(char*)defaultText.c_str(),op); + if (result == false) return; + + result = MIPSAsm::MipsAssembleOpcode(op,debugger,address,encoded); + if (result == true) + { + Memory::Write_U32(encoded,address); + MIPSComp::jit->ClearCacheAt(address); + redraw(); + } else { + MessageBox(wnd,"Couldn''t assemble.","Error",MB_OK); + } +} + void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam) { if (!debugger->isAlive()) return; @@ -498,6 +518,10 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam) case 'x': disassembleToFile(); break; + case 'a': + controlHeld = false; + assembleOpcode(curAddress,""); + break; case 'g': { u32 addr; @@ -691,6 +715,9 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) toggleBreakpoint(); redraw(); break; + case ID_DISASM_ASSEMBLE: + assembleOpcode(curAddress,""); + break; case ID_DISASM_COPYINSTRUCTIONDISASM: { int space = 256 * (selectRangeEnd - selectRangeStart) / instructionSize; diff --git a/Windows/Debugger/CtrlDisAsmView.h b/Windows/Debugger/CtrlDisAsmView.h index 59b2b5f8be..01403d6055 100644 --- a/Windows/Debugger/CtrlDisAsmView.h +++ b/Windows/Debugger/CtrlDisAsmView.h @@ -71,6 +71,7 @@ class CtrlDisAsmView bool searching; bool dontRedraw; + void assembleOpcode(u32 address, std::string defaultText); void disassembleToFile(); void search(bool continueSearch); void followBranch(); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 4eebf6a5f15a43e7131f010d2f771f0afcfbb5f9..652c424c6f6ed1fddc892646debf2cf4a09748aa 100644 GIT binary patch delta 70 zcmZ3tiRs;DrVVag(vA$pK$yyq%aFv71Edug@)-&kl7VE(