mirror of
https://github.com/zoriya/ComSquare.git
synced 2025-12-19 21:55:11 +00:00
Displaying ??? when we don't know what we read on the bus's debugger
This commit is contained in:
@@ -161,17 +161,17 @@ namespace ComSquare::Debugger
|
||||
void MemoryBusDebug::write(uint24_t addr, uint8_t data)
|
||||
{
|
||||
auto accessor = this->getAccessor(addr);
|
||||
uint8_t value;
|
||||
std::optional<uint8_t> value;
|
||||
try {
|
||||
value = accessor->read(addr - accessor->getStart());
|
||||
} catch (InvalidAddress &) {
|
||||
value = 0;
|
||||
value = std::nullopt;
|
||||
}
|
||||
this->_model.log(BusLog(true, addr, accessor, value, data));
|
||||
MemoryBus::write(addr, data);
|
||||
}
|
||||
|
||||
BusLog::BusLog(bool _write, uint24_t _addr, std::shared_ptr<Memory::AMemory> &_accessor, uint8_t _oldData, uint8_t _newData) :
|
||||
BusLog::BusLog(bool _write, uint24_t _addr, std::shared_ptr<Memory::AMemory> &_accessor, std::optional<uint8_t> _oldData, uint8_t _newData) :
|
||||
write(_write), addr(_addr), accessor(std::move(_accessor)), oldData(_oldData), newData(_newData)
|
||||
{}
|
||||
}
|
||||
@@ -203,7 +203,9 @@ QVariant BusLogModel::data(const QModelIndex &index, int role) const
|
||||
case 3:
|
||||
return QString(log.accessor ? log.accessor->getValueName(log.addr - log.accessor->getStart()).c_str() : "Open bus");
|
||||
case 4:
|
||||
return QString(ComSquare::Utility::to_hex(log.oldData).c_str());
|
||||
if (!log.oldData)
|
||||
return QString("???");
|
||||
return QString(ComSquare::Utility::to_hex(*log.oldData).c_str());
|
||||
case 5:
|
||||
return QString(ComSquare::Utility::to_hex(log.newData).c_str());
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user