Fixing a bug with the write in 0x0

This commit is contained in:
AnonymusRaccoon
2020-02-13 11:09:18 +01:00
parent b1a2222b55
commit a6c3e54f9f
11 changed files with 96 additions and 9 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
namespace ComSquare
{
//! @brief Exception thrown when someone tries to load an invalid rom.
class InvalidAction : std::exception {
class InvalidAction : public std::exception {
private:
std::string _msg;
public:
+19 -1
View File
@@ -13,7 +13,7 @@
namespace ComSquare
{
//! @brief Exception thrown when trying to read/write to an invalid address.
class InvalidAddress : std::exception {
class InvalidAddress : public std::exception {
private:
std::string _msg;
public:
@@ -25,6 +25,24 @@ namespace ComSquare
}
const char *what() const noexcept override { return this->_msg.c_str(); }
};
//! @brief Exception thrown when trying to read/write to an invalid address in a rectangle memory region.
class InvalidRectangleAddress : public std::exception {
private:
std::string _msg;
public:
InvalidRectangleAddress(std::string where, int32_t addr, int16_t subaddr, int16_t start, int16_t end)
{
std::stringstream stream;
stream << "Could not read/write data at address: 0x" << std::hex << addr << " from " << where;
if (subaddr < start)
stream << " (" << std::hex << subaddr << " < " << start << ")";
else
stream << " (" << std::hex << subaddr << " > " << end << ")";
this->_msg = stream.str();
}
const char *what() const noexcept override { return this->_msg.c_str(); }
};
}
#endif //COMSQUARE_INVALIDADDRESS_HPP
+1 -1
View File
@@ -11,7 +11,7 @@
namespace ComSquare
{
//! @brief Exception thrown when someone tries to load an invalid rom.
class InvalidRomException : std::exception {
class InvalidRomException : public std::exception {
private:
std::string _msg;
public:
@@ -10,7 +10,7 @@
namespace ComSquare
{
//! @brief When this is thrown, it means that we should work more.
class NotImplementedException : std::exception {
class NotImplementedException : public std::exception {
public:
explicit NotImplementedException() = default;
const char *what() const noexcept override { return "Not implemented yet."; }