diff --git a/Machines/Acorn/Archimedes/CMOSRAM.hpp b/Machines/Acorn/Archimedes/CMOSRAM.hpp index b966bca6c..f97ef80bb 100644 --- a/Machines/Acorn/Archimedes/CMOSRAM.hpp +++ b/Machines/Acorn/Archimedes/CMOSRAM.hpp @@ -9,7 +9,9 @@ #pragma once #include "../../../Components/I2C/I2C.hpp" +#include "../../../Outputs/Log.hpp" +#include namespace Archimedes { @@ -25,6 +27,10 @@ struct CMOSRAM: public I2C::Peripheral { // TODO: first 16 addresses are registers, not RAM. std::optional read() override { + if(address_ < 16) { + logger.error().append("TODO: read at %d", address_); + } + const uint8_t result = ram_[address_]; ++address_; return result; @@ -34,10 +40,16 @@ struct CMOSRAM: public I2C::Peripheral { if(expecting_address_) { address_ = value; expecting_address_ = false; - } else { - ram_[address_] = value; - ++address_; + return true; } + + if(address_ < 16) { + logger.error().append("TODO: write at %d", address_); + return true; + } + + ram_[address_] = value; + ++address_; return true; } @@ -66,6 +78,8 @@ private: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, }; + + Log::Logger logger; }; } diff --git a/Outputs/Log.hpp b/Outputs/Log.hpp index 276cf9e60..c5b860550 100644 --- a/Outputs/Log.hpp +++ b/Outputs/Log.hpp @@ -31,6 +31,7 @@ enum class Source { AtariST, AtariSTDMAController, CommodoreStaticAnalyser, + CMOSRTC, DirectAccessDevice, Enterprise, i8272, @@ -100,6 +101,7 @@ constexpr const char *prefix(Source source) { case Source::AtariST: return "AtariST"; case Source::AtariSTDMAController: return "DMA"; case Source::CommodoreStaticAnalyser: return "Commodore Static Analyser"; + case Source::CMOSRTC: return "CMOSRTC"; case Source::DirectAccessDevice: return "Direct Access Device"; case Source::Enterprise: return "Enterprise"; case Source::i8272: return "i8272";