From 9d5cbb4ed24d8af2c0458265ae8965fc9caafec7 Mon Sep 17 00:00:00 2001 From: Anonymus Raccoon Date: Mon, 6 Apr 2020 14:10:27 +0200 Subject: [PATCH] Cleaning up --- sources/Debugger/CPU/CPUDebug.cpp | 25 +++++++++++--- ui/cpu.ui | 55 ++++++++++++++++++++----------- ui/ui_cpu.h | 54 +++++++++++++++++++----------- 3 files changed, 90 insertions(+), 44 deletions(-) diff --git a/sources/Debugger/CPU/CPUDebug.cpp b/sources/Debugger/CPU/CPUDebug.cpp index 9463824..5be3734 100644 --- a/sources/Debugger/CPU/CPUDebug.cpp +++ b/sources/Debugger/CPU/CPUDebug.cpp @@ -33,6 +33,7 @@ namespace ComSquare::Debugger this->_updateDisassembly(this->_cartridgeHeader.emulationInterrupts.reset, 0xFFFF - this->_cartridgeHeader.emulationInterrupts.reset); //Parse the first page of the ROM (the code can't reach the second page without a jump). this->_ui.disassembly->setModel(&this->_model); this->_ui.disassembly->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + this->_ui.disassembly->horizontalHeader()->setStretchLastSection(true); this->_ui.disassembly->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); this->_ui.disassembly->verticalHeader()->setHighlightSections(false); this->_ui.disassembly->setItemDelegate(&this->_painter); @@ -45,6 +46,7 @@ namespace ComSquare::Debugger this->_ui.history->setModel(&this->_historyModel); this->_ui.history->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); + this->_ui.history->horizontalHeader()->setStretchLastSection(true); this->_ui.history->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); this->_ui.history->verticalHeader()->hide(); @@ -183,6 +185,7 @@ namespace ComSquare::Debugger this->_ui.mCheckbox->setCheckState(this->_registers.p.m ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); this->_ui.xCheckbox->setCheckState(this->_registers.p.x_b ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); + this->_ui.bCheckbox->setCheckState(this->_registers.p.x_b ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); this->_ui.iCheckbox->setCheckState(this->_registers.p.i ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); this->_ui.vCheckbox->setCheckState(this->_registers.p.v ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); this->_ui.dCheckbox->setCheckState(this->_registers.p.d ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); @@ -327,8 +330,20 @@ QVariant DisassemblyModel::data(const QModelIndex &index, int role) const QVariant DisassemblyModel::headerData(int section, Qt::Orientation orientation, int role) const { - if (orientation == Qt::Horizontal) - return QVariant(); + if (orientation == Qt::Horizontal) { + switch (section) { + case 0: + return QString("INST"); + case 1: + return QString("Parameter"); + case 2: + return QString("Thrust"); + case 3: + return QString("Data Address"); + default: + return QVariant(); + } + } if (role != Qt::DisplayRole) return QVariant(); ComSquare::Debugger::DisassembledInstruction instruction = this->_cpu.disassembledInstructions[section]; @@ -447,13 +462,13 @@ QVariant HistoryModel::headerData(int section, Qt::Orientation orientation, int return QVariant(); switch (section) { case 0: - return QString("OP"); + return QString("op"); case 1: - return QString("INST"); + return QString("ins"); case 2: return QString("Parameter"); case 3: - return QString("Data Addr"); + return QString("Pointer"); default: return QVariant(); } diff --git a/ui/cpu.ui b/ui/cpu.ui index 220c344..0f8d2f2 100644 --- a/ui/cpu.ui +++ b/ui/cpu.ui @@ -6,7 +6,7 @@ 0 0 - 971 + 1058 673 @@ -22,7 +22,7 @@ - + @@ -74,7 +74,7 @@ - + @@ -179,7 +179,7 @@ - + @@ -203,7 +203,7 @@ - + Flags @@ -233,10 +233,13 @@ 7 + + 0 + - Memory/Accumulator Select (M) + Memory Select (M) @@ -250,7 +253,7 @@ - Index Select (X) / Break (B) + Index Select (X) @@ -261,90 +264,104 @@ - + Interupt Request Disable (I) - + Qt::RightToLeft - + Overflow (V) - + Qt::RightToLeft - + Decimal (D) - + Qt::RightToLeft - + Carry (C) - + Qt::RightToLeft - + Zero (Z) - + Negative (N) - + Qt::RightToLeft - + Qt::RightToLeft + + + + Break (B) + + + + + + + Qt::RightToLeft + + + diff --git a/ui/ui_cpu.h b/ui/ui_cpu.h index f99cb91..97769dd 100644 --- a/ui/ui_cpu.h +++ b/ui/ui_cpu.h @@ -81,13 +81,15 @@ public: QLabel *irqDisableLabel; QCheckBox *nCheckbox; QCheckBox *zCheckbox; + QLabel *breakBLabel; + QCheckBox *bCheckbox; QToolBar *toolBar; void setupUi(QMainWindow *CPUView) { if (CPUView->objectName().isEmpty()) CPUView->setObjectName(QString::fromUtf8("CPUView")); - CPUView->resize(971, 673); + CPUView->resize(1058, 673); QIcon icon; icon.addFile(QString::fromUtf8(":/resources/Logo.png"), QSize(), QIcon::Normal, QIcon::Off); CPUView->setWindowIcon(icon); @@ -126,7 +128,7 @@ public: disassembly->horizontalHeader()->setVisible(false); disassembly->horizontalHeader()->setHighlightSections(false); - gridLayout_3->addWidget(disassembly, 0, 0, 2, 1); + gridLayout_3->addWidget(disassembly, 0, 0, 3, 1); gridLayout_2 = new QGridLayout(); gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); @@ -240,7 +242,7 @@ public: formLayout->setWidget(8, QFormLayout::FieldRole, emulationModeCheckBox); - gridLayout_3->addLayout(formLayout, 0, 2, 1, 1); + gridLayout_3->addLayout(formLayout, 0, 2, 2, 1); gridLayout = new QGridLayout(); gridLayout->setObjectName(QString::fromUtf8("gridLayout")); @@ -261,7 +263,7 @@ public: gridLayout->addWidget(history, 1, 0, 1, 1); - gridLayout_3->addLayout(gridLayout, 1, 1, 1, 1); + gridLayout_3->addLayout(gridLayout, 1, 1, 2, 1); formGroupBox = new QGroupBox(centralwidget); formGroupBox->setObjectName(QString::fromUtf8("formGroupBox")); @@ -273,7 +275,7 @@ public: formLayout_2->setSizeConstraint(QLayout::SetDefaultConstraint); formLayout_2->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); formLayout_2->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); - formLayout_2->setContentsMargins(26, 7, -1, -1); + formLayout_2->setContentsMargins(26, 7, 0, -1); negativeLabel = new QLabel(formGroupBox); negativeLabel->setObjectName(QString::fromUtf8("negativeLabel")); @@ -299,71 +301,82 @@ public: carryLabel = new QLabel(formGroupBox); carryLabel->setObjectName(QString::fromUtf8("carryLabel")); - formLayout_2->setWidget(2, QFormLayout::LabelRole, carryLabel); + formLayout_2->setWidget(3, QFormLayout::LabelRole, carryLabel); iCheckbox = new QCheckBox(formGroupBox); iCheckbox->setObjectName(QString::fromUtf8("iCheckbox")); iCheckbox->setLayoutDirection(Qt::RightToLeft); - formLayout_2->setWidget(2, QFormLayout::FieldRole, iCheckbox); + formLayout_2->setWidget(3, QFormLayout::FieldRole, iCheckbox); Overflow = new QLabel(formGroupBox); Overflow->setObjectName(QString::fromUtf8("Overflow")); - formLayout_2->setWidget(3, QFormLayout::LabelRole, Overflow); + formLayout_2->setWidget(4, QFormLayout::LabelRole, Overflow); vCheckbox = new QCheckBox(formGroupBox); vCheckbox->setObjectName(QString::fromUtf8("vCheckbox")); vCheckbox->setLayoutDirection(Qt::RightToLeft); - formLayout_2->setWidget(3, QFormLayout::FieldRole, vCheckbox); + formLayout_2->setWidget(4, QFormLayout::FieldRole, vCheckbox); decimalLabel = new QLabel(formGroupBox); decimalLabel->setObjectName(QString::fromUtf8("decimalLabel")); - formLayout_2->setWidget(4, QFormLayout::LabelRole, decimalLabel); + formLayout_2->setWidget(5, QFormLayout::LabelRole, decimalLabel); dCheckbox = new QCheckBox(formGroupBox); dCheckbox->setObjectName(QString::fromUtf8("dCheckbox")); dCheckbox->setLayoutDirection(Qt::RightToLeft); - formLayout_2->setWidget(4, QFormLayout::FieldRole, dCheckbox); + formLayout_2->setWidget(5, QFormLayout::FieldRole, dCheckbox); memoryAccumulatorSelectLabel = new QLabel(formGroupBox); memoryAccumulatorSelectLabel->setObjectName(QString::fromUtf8("memoryAccumulatorSelectLabel")); - formLayout_2->setWidget(5, QFormLayout::LabelRole, memoryAccumulatorSelectLabel); + formLayout_2->setWidget(6, QFormLayout::LabelRole, memoryAccumulatorSelectLabel); cCheckbox = new QCheckBox(formGroupBox); cCheckbox->setObjectName(QString::fromUtf8("cCheckbox")); cCheckbox->setLayoutDirection(Qt::RightToLeft); - formLayout_2->setWidget(5, QFormLayout::FieldRole, cCheckbox); + formLayout_2->setWidget(6, QFormLayout::FieldRole, cCheckbox); indeXSelectLabel = new QLabel(formGroupBox); indeXSelectLabel->setObjectName(QString::fromUtf8("indeXSelectLabel")); - formLayout_2->setWidget(6, QFormLayout::LabelRole, indeXSelectLabel); + formLayout_2->setWidget(7, QFormLayout::LabelRole, indeXSelectLabel); irqDisableLabel = new QLabel(formGroupBox); irqDisableLabel->setObjectName(QString::fromUtf8("irqDisableLabel")); - formLayout_2->setWidget(7, QFormLayout::LabelRole, irqDisableLabel); + formLayout_2->setWidget(8, QFormLayout::LabelRole, irqDisableLabel); nCheckbox = new QCheckBox(formGroupBox); nCheckbox->setObjectName(QString::fromUtf8("nCheckbox")); nCheckbox->setLayoutDirection(Qt::RightToLeft); - formLayout_2->setWidget(7, QFormLayout::FieldRole, nCheckbox); + formLayout_2->setWidget(8, QFormLayout::FieldRole, nCheckbox); zCheckbox = new QCheckBox(formGroupBox); zCheckbox->setObjectName(QString::fromUtf8("zCheckbox")); zCheckbox->setLayoutDirection(Qt::RightToLeft); - formLayout_2->setWidget(6, QFormLayout::FieldRole, zCheckbox); + formLayout_2->setWidget(7, QFormLayout::FieldRole, zCheckbox); + + breakBLabel = new QLabel(formGroupBox); + breakBLabel->setObjectName(QString::fromUtf8("breakBLabel")); + + formLayout_2->setWidget(2, QFormLayout::LabelRole, breakBLabel); + + bCheckbox = new QCheckBox(formGroupBox); + bCheckbox->setObjectName(QString::fromUtf8("bCheckbox")); + bCheckbox->setLayoutDirection(Qt::RightToLeft); + + formLayout_2->setWidget(2, QFormLayout::FieldRole, bCheckbox); - gridLayout_3->addWidget(formGroupBox, 1, 2, 1, 1); + gridLayout_3->addWidget(formGroupBox, 2, 2, 1, 1); CPUView->setCentralWidget(centralwidget); toolBar = new QToolBar(CPUView); @@ -421,14 +434,15 @@ public: loggerLabel->setText(QCoreApplication::translate("CPUView", "Instructions History", nullptr)); clear->setText(QCoreApplication::translate("CPUView", "Clear History", nullptr)); formGroupBox->setTitle(QCoreApplication::translate("CPUView", "Flags", nullptr)); - negativeLabel->setText(QCoreApplication::translate("CPUView", "Memory/Accumulator Select (M)", nullptr)); - zeroLabel->setText(QCoreApplication::translate("CPUView", "Index Select (X) / Break (B)", nullptr)); + negativeLabel->setText(QCoreApplication::translate("CPUView", "Memory Select (M)", nullptr)); + zeroLabel->setText(QCoreApplication::translate("CPUView", "Index Select (X)", nullptr)); carryLabel->setText(QCoreApplication::translate("CPUView", "Interupt Request Disable (I)", nullptr)); Overflow->setText(QCoreApplication::translate("CPUView", "Overflow (V)", nullptr)); decimalLabel->setText(QCoreApplication::translate("CPUView", "Decimal (D)", nullptr)); memoryAccumulatorSelectLabel->setText(QCoreApplication::translate("CPUView", "Carry (C)", nullptr)); indeXSelectLabel->setText(QCoreApplication::translate("CPUView", "Zero (Z)", nullptr)); irqDisableLabel->setText(QCoreApplication::translate("CPUView", "Negative (N)", nullptr)); + breakBLabel->setText(QCoreApplication::translate("CPUView", "Break (B)", nullptr)); toolBar->setWindowTitle(QCoreApplication::translate("CPUView", "toolBar", nullptr)); } // retranslateUi