Minor disassembly tweaks
This commit is contained in:
parent
3d4bb3f20b
commit
274632f304
3 changed files with 10 additions and 14 deletions
|
@ -30,7 +30,7 @@ DebugInterface* DisassemblyManager::cpu;
|
||||||
|
|
||||||
bool isInInterval(u32 start, u32 size, u32 value)
|
bool isInInterval(u32 start, u32 size, u32 value)
|
||||||
{
|
{
|
||||||
return start <= value && value < start+size;
|
return start <= value && value <= (start+size-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseDisasm(const char* disasm, char* opcode, char* arguments, bool insertSymbols)
|
void parseDisasm(const char* disasm, char* opcode, char* arguments, bool insertSymbols)
|
||||||
|
|
|
@ -167,7 +167,6 @@ CtrlDisAsmView::CtrlDisAsmView(HWND _wnd)
|
||||||
boldfont = CreateFont(rowHeight-2,charWidth,0,0,FW_DEMIBOLD,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,
|
boldfont = CreateFont(rowHeight-2,charWidth,0,0,FW_DEMIBOLD,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,
|
||||||
L"Lucida Console");
|
L"Lucida Console");
|
||||||
curAddress=0;
|
curAddress=0;
|
||||||
instructionSize=4;
|
|
||||||
showHex=false;
|
showHex=false;
|
||||||
hasFocus = false;
|
hasFocus = false;
|
||||||
dontRedraw = false;
|
dontRedraw = false;
|
||||||
|
@ -655,11 +654,11 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam)
|
||||||
toggleBreakpoint(true);
|
toggleBreakpoint(true);
|
||||||
break;
|
break;
|
||||||
case VK_UP:
|
case VK_UP:
|
||||||
windowStart -= instructionSize;
|
scrollWindow(-1);
|
||||||
scanFunctions();
|
scanFunctions();
|
||||||
break;
|
break;
|
||||||
case VK_DOWN:
|
case VK_DOWN:
|
||||||
windowStart += instructionSize;
|
scrollWindow(1);
|
||||||
scanFunctions();
|
scanFunctions();
|
||||||
break;
|
break;
|
||||||
case VK_NEXT:
|
case VK_NEXT:
|
||||||
|
@ -819,10 +818,10 @@ void CtrlDisAsmView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
|
||||||
|
|
||||||
void CtrlDisAsmView::copyInstructions(u32 startAddr, u32 endAddr, bool withDisasm)
|
void CtrlDisAsmView::copyInstructions(u32 startAddr, u32 endAddr, bool withDisasm)
|
||||||
{
|
{
|
||||||
int count = (endAddr - startAddr) / instructionSize;
|
|
||||||
|
|
||||||
if (withDisasm == false)
|
if (withDisasm == false)
|
||||||
{
|
{
|
||||||
|
int instructionSize = debugger->getInstructionSize(0);
|
||||||
|
int count = (endAddr - startAddr) / instructionSize;
|
||||||
int space = count * 32;
|
int space = count * 32;
|
||||||
char *temp = new char[space];
|
char *temp = new char[space];
|
||||||
|
|
||||||
|
@ -1153,7 +1152,7 @@ std::string CtrlDisAsmView::disassembleRange(u32 start, u32 size)
|
||||||
|
|
||||||
// gather all branch targets without labels
|
// gather all branch targets without labels
|
||||||
std::set<u32> branchAddresses;
|
std::set<u32> branchAddresses;
|
||||||
for (u32 i = 0; i < size; i += instructionSize)
|
for (u32 i = 0; i < size; i += debugger->getInstructionSize(0))
|
||||||
{
|
{
|
||||||
MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(debugger,start+i);
|
MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(debugger,start+i);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ class CtrlDisAsmView
|
||||||
|
|
||||||
u32 windowStart;
|
u32 windowStart;
|
||||||
int visibleRows;
|
int visibleRows;
|
||||||
int instructionSize;
|
|
||||||
bool whiteBackground;
|
bool whiteBackground;
|
||||||
bool displaySymbols;
|
bool displaySymbols;
|
||||||
|
|
||||||
|
@ -110,7 +109,6 @@ public:
|
||||||
{
|
{
|
||||||
debugger=deb;
|
debugger=deb;
|
||||||
curAddress=debugger->getPC();
|
curAddress=debugger->getPC();
|
||||||
instructionSize=debugger->getInstructionSize(0);
|
|
||||||
manager.setCpu(deb);
|
manager.setCpu(deb);
|
||||||
}
|
}
|
||||||
DebugInterface *getDebugger()
|
DebugInterface *getDebugger()
|
||||||
|
@ -123,13 +121,12 @@ public:
|
||||||
|
|
||||||
void gotoAddr(unsigned int addr)
|
void gotoAddr(unsigned int addr)
|
||||||
{
|
{
|
||||||
addr = manager.getStartAddress(addr);
|
u32 windowEnd = manager.getNthNextAddress(windowStart,visibleRows);
|
||||||
u32 windowEnd = windowStart+visibleRows*instructionSize;
|
u32 newAddress = manager.getStartAddress(addr);
|
||||||
u32 newAddress = addr&(~(instructionSize-1));
|
|
||||||
|
|
||||||
if (newAddress < windowStart || newAddress >= windowEnd)
|
if (newAddress < windowStart || newAddress >= windowEnd)
|
||||||
{
|
{
|
||||||
windowStart = newAddress-visibleRows/2*instructionSize;
|
windowStart = manager.getNthPreviousAddress(newAddress,visibleRows/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
setCurAddress(newAddress);
|
setCurAddress(newAddress);
|
||||||
|
@ -138,7 +135,7 @@ public:
|
||||||
}
|
}
|
||||||
void gotoPC()
|
void gotoPC()
|
||||||
{
|
{
|
||||||
gotoAddr(debugger->getPC()&(~(instructionSize-1)));
|
gotoAddr(debugger->getPC());
|
||||||
}
|
}
|
||||||
u32 getSelection()
|
u32 getSelection()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue