diff --git a/inc/Rom.h b/inc/Rom.h index 1ed95ed..38baef6 100644 --- a/inc/Rom.h +++ b/inc/Rom.h @@ -26,6 +26,8 @@ namespace EightBit { static int load(std::string path, std::vector& output, int writeOffset = 0, int readOffset = 0, int limit = -1, int maximumSize = -1); Rom(size_t size = 0) noexcept; + Rom(const Rom& rhs); + Rom& operator=(const Rom& rhs); [[nodiscard]] size_t size() const noexcept final; diff --git a/src/Rom.cpp b/src/Rom.cpp index 579c12d..7deaaa7 100644 --- a/src/Rom.cpp +++ b/src/Rom.cpp @@ -44,6 +44,15 @@ void EightBit::Rom::poke(const uint16_t address, const uint8_t value) noexcept { EightBit::Rom::Rom(const size_t size) noexcept : m_bytes(size) {} +EightBit::Rom::Rom(const Rom& rhs) +: m_bytes(rhs.m_bytes) {} + +EightBit::Rom& EightBit::Rom::operator=(const Rom& rhs) { + if (this != &rhs) + m_bytes = rhs.m_bytes; + return *this; +} + size_t EightBit::Rom::size() const noexcept { return m_bytes.size(); }