aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/memorymodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_gui/memorymodel.h')
-rw-r--r--qtmips_gui/memorymodel.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/qtmips_gui/memorymodel.h b/qtmips_gui/memorymodel.h
index e85d476..b06eff8 100644
--- a/qtmips_gui/memorymodel.h
+++ b/qtmips_gui/memorymodel.h
@@ -57,6 +57,8 @@ public:
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool adjustRowAndOffset(int &row, int optimal_row, std::uint32_t address);
+ void update_all();
void setCellsPerRow(unsigned int cells);
@@ -68,6 +70,10 @@ public:
return &data_font;
}
+ inline const std::uint32_t getIndex0Offset() const {
+ return index0_offset;
+ }
+
inline unsigned int cellSizeBytes() const {
switch (cell_size) {
case CELLSIZE_BYTE:
@@ -83,6 +89,18 @@ public:
address = index0_offset + (row * cells_per_row * cellSizeBytes());
return address >= index0_offset;
}
+ inline bool get_row_for_address(int &row, std::uint32_t address) const {
+ if (address < index0_offset) {
+ row = -1;
+ return false;
+ }
+ row = (address - index0_offset) / (cells_per_row * cellSizeBytes());
+ if ((address - index0_offset > 0x80000000) || row > rowCount()) {
+ row = rowCount();
+ return false;
+ }
+ return true;
+ }
public slots:
void setup(machine::QtMipsMachine *machine);