mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-07 11:45:07 +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)
|
void MemoryBusDebug::write(uint24_t addr, uint8_t data)
|
||||||
{
|
{
|
||||||
auto accessor = this->getAccessor(addr);
|
auto accessor = this->getAccessor(addr);
|
||||||
uint8_t value;
|
std::optional<uint8_t> value;
|
||||||
try {
|
try {
|
||||||
value = accessor->read(addr - accessor->getStart());
|
value = accessor->read(addr - accessor->getStart());
|
||||||
} catch (InvalidAddress &) {
|
} catch (InvalidAddress &) {
|
||||||
value = 0;
|
value = std::nullopt;
|
||||||
}
|
}
|
||||||
this->_model.log(BusLog(true, addr, accessor, value, data));
|
this->_model.log(BusLog(true, addr, accessor, value, data));
|
||||||
MemoryBus::write(addr, 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)
|
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:
|
case 3:
|
||||||
return QString(log.accessor ? log.accessor->getValueName(log.addr - log.accessor->getStart()).c_str() : "Open bus");
|
return QString(log.accessor ? log.accessor->getValueName(log.addr - log.accessor->getStart()).c_str() : "Open bus");
|
||||||
case 4:
|
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:
|
case 5:
|
||||||
return QString(ComSquare::Utility::to_hex(log.newData).c_str());
|
return QString(ComSquare::Utility::to_hex(log.newData).c_str());
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ namespace ComSquare::Debugger
|
|||||||
{
|
{
|
||||||
//! @brief The struct used to represent memory bus logs.
|
//! @brief The struct used to represent memory bus logs.
|
||||||
struct BusLog {
|
struct BusLog {
|
||||||
BusLog(bool write, uint24_t addr, std::shared_ptr<Memory::AMemory> &accessor, uint8_t oldData, uint8_t newData);
|
BusLog(bool write, uint24_t addr, std::shared_ptr<Memory::AMemory> &accessor, std::optional<uint8_t> oldData, uint8_t newData);
|
||||||
|
|
||||||
bool write;
|
bool write;
|
||||||
uint24_t addr;
|
uint24_t addr;
|
||||||
std::shared_ptr<Memory::AMemory> accessor;
|
std::shared_ptr<Memory::AMemory> accessor;
|
||||||
uint8_t oldData;
|
std::optional<uint8_t> oldData;
|
||||||
uint8_t newData;
|
uint8_t newData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -30,8 +30,7 @@ namespace ComSquare::PPU
|
|||||||
case 0x36:
|
case 0x36:
|
||||||
return this->_registers._mpy.mpyh;
|
return this->_registers._mpy.mpyh;
|
||||||
default:
|
default:
|
||||||
//throw InvalidAddress("PPU Internal Registers read", addr);
|
throw InvalidAddress("PPU Internal Registers read", addr);
|
||||||
std::cout << "PPU Internal Registers read" << addr << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user