From 1acdb31490ba7951c265a3f7bc18c4425ce67c40 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sat, 15 Jan 2022 23:47:42 -0500 Subject: [PATCH] Changed Qt RAM search logic to skip over RAM mirrors. Changed GUI to allow for searching of RAM, SRAM, and ROM regions to be individually selectable. Issue #446. --- src/drivers/Qt/RamSearch.cpp | 123 +++++++++++++++++++++++++---------- src/drivers/Qt/RamSearch.h | 4 ++ 2 files changed, 94 insertions(+), 33 deletions(-) diff --git a/src/drivers/Qt/RamSearch.cpp b/src/drivers/Qt/RamSearch.cpp index d76d674d..3a916fd5 100644 --- a/src/drivers/Qt/RamSearch.cpp +++ b/src/drivers/Qt/RamSearch.cpp @@ -61,7 +61,9 @@ #include "Qt/ConsoleWindow.h" #include "Qt/ConsoleUtilities.h" -static bool ShowROM = false; +static bool ShowRAM = true; +static bool ShowSRAM = false; +static bool ShowROM = false; static RamSearchDialog_t *ramSearchWin = NULL; struct memoryState_t @@ -203,7 +205,7 @@ RamSearchDialog_t::RamSearchDialog_t(QWidget *parent) { QVBoxLayout *mainLayout; QHBoxLayout *hbox, *hbox1, *hbox2, *hbox3; - QVBoxLayout *vbox, *vbox1, *vbox2; + QVBoxLayout *vbox, *vbox1, *vbox2, *vbox3; QGridLayout *grid; QGroupBox *frame; ramSearchInputValidator *inpValidator; @@ -287,9 +289,27 @@ RamSearchDialog_t::RamSearchDialog_t(QWidget *parent) connect(undoButton, SIGNAL(clicked(void)), this, SLOT(undoSearch(void))); undoButton->setEnabled(false); - searchROMCbox = new QCheckBox(tr("Search ROM")); - vbox->addWidget(searchROMCbox); + frame = new QGroupBox( tr("Search Regions") ); + vbox3 = new QVBoxLayout(); + frame->setLayout(vbox3); + vbox->addWidget(frame); + + searchRAMCbox = new QCheckBox(tr("RAM")); + vbox3->addWidget(searchRAMCbox); + searchRAMCbox->setChecked(ShowRAM); + searchRAMCbox->setToolTip( tr("Search RAM Address Range: 0x0000 - 0x07FF") ); + connect(searchRAMCbox, SIGNAL(stateChanged(int)), this, SLOT(searchRAMChanged(int))); + + searchSRAMCbox = new QCheckBox(tr("SRAM")); + vbox3->addWidget(searchSRAMCbox); + searchSRAMCbox->setChecked(ShowSRAM); + searchSRAMCbox->setToolTip( tr("Search SRAM Address Range: 0x6000 - 0x7FFF") ); + connect(searchSRAMCbox, SIGNAL(stateChanged(int)), this, SLOT(searchSRAMChanged(int))); + + searchROMCbox = new QCheckBox(tr("ROM")); + vbox3->addWidget(searchROMCbox); searchROMCbox->setChecked(ShowROM); + searchROMCbox->setToolTip( tr("Search ROM Address Range: 0x8000 - 0xFFFF") ); connect(searchROMCbox, SIGNAL(stateChanged(int)), this, SLOT(searchROMChanged(int))); elimButton = new QPushButton(tr("Eliminate")); @@ -582,6 +602,16 @@ void RamSearchDialog_t::vbarChanged(int val) ramView->update(); } //---------------------------------------------------- +void RamSearchDialog_t::searchRAMChanged(int state) +{ + ShowRAM = (state != Qt::Unchecked); +} +//---------------------------------------------------- +void RamSearchDialog_t::searchSRAMChanged(int state) +{ + ShowSRAM = (state != Qt::Unchecked); +} +//---------------------------------------------------- void RamSearchDialog_t::searchROMChanged(int state) { ShowROM = (state != Qt::Unchecked); @@ -1467,9 +1497,30 @@ void RamSearchDialog_t::hexTypeClicked(void) //---------------------------------------------------------------------------- void RamSearchDialog_t::calcRamList(void) { - int addr; - int dataSize = 1; - int endAddr = ShowROM ? 0x10000 : 0x8000; + int i, addr, startAddr, endAddr; + int numRegions = 0, dataSize = 1; + int regionStart[5], regionEnd[5]; + + if ( ShowRAM ) + { + regionStart[ numRegions ] = 0x0000; + regionEnd[ numRegions ] = 0x0800; + numRegions++; + } + + if ( ShowSRAM ) + { + regionStart[ numRegions ] = 0x6000; + regionEnd[ numRegions ] = 0x8000; + numRegions++; + } + + if ( ShowROM ) + { + regionStart[ numRegions ] = 0x08000; + regionEnd[ numRegions ] = 0x10000; + numRegions++; + } if (chkMisAligned) { @@ -1490,39 +1541,45 @@ void RamSearchDialog_t::calcRamList(void) actvSrchList.clear(); - for (addr = 0; addr < endAddr; addr += dataSize) + for (i=0; isetMaximum(actvSrchList.size()); diff --git a/src/drivers/Qt/RamSearch.h b/src/drivers/Qt/RamSearch.h index a8036b19..9c16367e 100644 --- a/src/drivers/Qt/RamSearch.h +++ b/src/drivers/Qt/RamSearch.h @@ -116,6 +116,8 @@ class RamSearchDialog_t : public QDialog QLineEdit *specAddrEdit; QLineEdit *numChangeEdit; + QCheckBox *searchRAMCbox; + QCheckBox *searchSRAMCbox; QCheckBox *searchROMCbox; QCheckBox *misalignedCbox; QCheckBox *autoSearchCbox; @@ -148,6 +150,8 @@ class RamSearchDialog_t : public QDialog void periodicUpdate(void); void hbarChanged(int val); void vbarChanged(int val); + void searchRAMChanged(int state); + void searchSRAMChanged(int state); void searchROMChanged(int state); void misalignedChanged(int state); void ds1Clicked(void);