fixed bugs

This commit is contained in:
zanostro 2025-12-06 22:55:01 +01:00
parent d3ab78e76c
commit 098766bb65
5 changed files with 64 additions and 15 deletions

View file

@ -19,6 +19,7 @@
#include <QFont>
#include <QFileDialog>
#include <QMessageBox>
#include <QScrollBar>
class Loader;
@ -698,7 +699,18 @@ MainWindow::DisassembledInstruction MainWindow::disassembleAt(int address)
QString reg1Str = (r1 < 10) ? regNames[r1] : "?";
QString reg2Str = (r2 < 10) ? regNames[r2] : "?";
result.operand = QString("%1, %2").arg(reg1Str).arg(reg2Str);
// Check if this is a single-operand Format 2 instruction
QString mnem = result.mnemonic.toUpper();
if (mnem == "CLEAR" || mnem == "TIXR") {
result.operand = reg1Str;
} else if (mnem == "SVC") {
result.operand = QString::number(r1);
} else if (mnem == "SHIFTL" || mnem == "SHIFTR") {
result.operand = QString("%1, %2").arg(reg1Str).arg(r2);
} else {
// Two register operands (ADDR, SUBR, COMPR, etc.)
result.operand = QString("%1, %2").arg(reg1Str).arg(reg2Str);
}
}
break;
}
@ -852,7 +864,13 @@ void MainWindow::updateDisassemblyDisplay()
layout->addStretch();
container->setLayout(layout);
// Save scroll position before updating
int scrollPos = ui->DisasemblyScrollArea->verticalScrollBar()->value();
ui->DisasemblyScrollArea->setWidget(container);
// Restore scroll position after updating
ui->DisasemblyScrollArea->verticalScrollBar()->setValue(scrollPos);
}
void MainWindow::updateMemoryDisplay()
@ -919,7 +937,11 @@ void MainWindow::updateMemoryDisplay()
layout->addStretch();
container->setLayout(layout);
int scrollPos = ui->MemoryScrollArea->verticalScrollBar()->value();
ui->MemoryScrollArea->setWidget(container);
ui->MemoryScrollArea->verticalScrollBar()->setValue(scrollPos);
}
void MainWindow::loadObjectFile()