Minor disassembly tweaks

This commit is contained in:
Kingcom 2013-11-26 11:38:01 +01:00
parent 3d4bb3f20b
commit 274632f304
3 changed files with 10 additions and 14 deletions

View File

@ -30,7 +30,7 @@ DebugInterface* DisassemblyManager::cpu;
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)

View File

@ -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,
L"Lucida Console");
curAddress=0;
instructionSize=4;
showHex=false;
hasFocus = false;
dontRedraw = false;
@ -655,11 +654,11 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam)
toggleBreakpoint(true);
break;
case VK_UP:
windowStart -= instructionSize;
scrollWindow(-1);
scanFunctions();
break;
case VK_DOWN:
windowStart += instructionSize;
scrollWindow(1);
scanFunctions();
break;
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)
{
int count = (endAddr - startAddr) / instructionSize;
if (withDisasm == false)
{
int instructionSize = debugger->getInstructionSize(0);
int count = (endAddr - startAddr) / instructionSize;
int space = count * 32;
char *temp = new char[space];
@ -1153,7 +1152,7 @@ std::string CtrlDisAsmView::disassembleRange(u32 start, u32 size)
// gather all branch targets without labels
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);

View File

@ -50,7 +50,6 @@ class CtrlDisAsmView
u32 windowStart;
int visibleRows;
int instructionSize;
bool whiteBackground;
bool displaySymbols;
@ -110,7 +109,6 @@ public:
{
debugger=deb;
curAddress=debugger->getPC();
instructionSize=debugger->getInstructionSize(0);
manager.setCpu(deb);
}
DebugInterface *getDebugger()
@ -123,13 +121,12 @@ public:
void gotoAddr(unsigned int addr)
{
addr = manager.getStartAddress(addr);
u32 windowEnd = windowStart+visibleRows*instructionSize;
u32 newAddress = addr&(~(instructionSize-1));
u32 windowEnd = manager.getNthNextAddress(windowStart,visibleRows);
u32 newAddress = manager.getStartAddress(addr);
if (newAddress < windowStart || newAddress >= windowEnd)
{
windowStart = newAddress-visibleRows/2*instructionSize;
windowStart = manager.getNthPreviousAddress(newAddress,visibleRows/2);
}
setCurAddress(newAddress);
@ -138,7 +135,7 @@ public:
}
void gotoPC()
{
gotoAddr(debugger->getPC()&(~(instructionSize-1)));
gotoAddr(debugger->getPC());
}
u32 getSelection()
{