Cleaning up

This commit is contained in:
Zoe Roux
2021-07-04 02:56:44 +02:00
57 changed files with 5597 additions and 5173 deletions

View File

@@ -9,7 +9,8 @@
namespace ComSquare::Memory
{
//! @brief Base memory class to map non continuous rectangle to the memory. (A rectangle that spam across more than one bank but that does not start at $0000 or end at $FFFF).
class ARectangleMemory : public IMemory {
class ARectangleMemory : public IMemory
{
protected:
//! @brief The first bank to map to.
uint8_t _startBank = 0;
@@ -19,16 +20,19 @@ namespace ComSquare::Memory
uint16_t _startPage = 0;
//! @brief The last address of each bank to map.
uint16_t _endPage = 0;
public:
//! @brief Translate an absolute address to a relative address
//! @param addr The absolute address (in the 24 bit bus)
//! @return The local address (0 refers to the first byte of this component).
//! @throw InvalidAddress is thrown if the address is not mapped by this component.
virtual uint24_t getRelativeAddress(uint24_t addr) const override;
[[nodiscard]] uint24_t getRelativeAddress(uint24_t addr) const override;
//! @brief Return true if this component has mapped the address.
//! @param addr The address to check.
//! @return True if this address is mapped to the component. False otherwise.
bool hasMemoryAt(uint24_t addr) const override;
[[nodiscard]] bool hasMemoryAt(uint24_t addr) const override;
//! @brief Change starting and ending points of this mapped memory.
//! @param startBank The first bank mapped to this component.
//! @param endBank The last bank mapped to this component.
@@ -36,15 +40,12 @@ namespace ComSquare::Memory
//! @param endPage The end page mapped to this component (every mapped banks will have this pages lower than this mapped)
//! @warning The start/end address should be a rectangle. To mirror memory, use the MemoryShadow class and not this one.
void setMemoryRegion(uint8_t startBank, uint8_t endBank, uint16_t startPage, uint16_t endPage);
//! @brief Check if this memory is a mirror or not.
//! @return True if this memory is a mirror. False otherwise.
virtual bool isMirror() const override;
//! @brief Get the name of the data at the address
//! @param addr The address (in local space)
virtual std::string getValueName(uint24_t addr) const override;
//! @brief Return the memory accessor this accessor mirror if any
//! @return nullptr if isMirror is false, the source otherwise.
virtual std::shared_ptr<IMemory> getMirrored() const override;
virtual ~ARectangleMemory() override = default;
[[nodiscard]] std::string getValueName(uint24_t addr) const override;
//! @brief A default destructor.
~ARectangleMemory() override = default;
};
}
}// namespace ComSquare::Memory