13static constexpr byte ID = 0xFE;
22 sram = std::make_unique<SRAM>(
23 getName() +
" SRAM",
"S1985 Backup RAM",
26 sram = std::make_unique<SRAM>(
27 getName() +
" SRAM",
"S1985 Backup RAM",
32 byte mask = 0b0001'1111;
33 auto baseValue = narrow_cast<byte>(config.
getChildDataAsInt(
"MapperReadBackBaseValue", 0x80));
36 reset(EmuTime::dummy());
46 color1 = color2 = pattern = address = 0;
52 switch (port & 0x0F) {
54 pattern =
byte((pattern << 1) | (pattern >> 7));
62 switch (port & 0x0F) {
66 return (*sram)[address];
68 return (pattern & 0x80) ? color2 : color1;
76 switch (port & 0x0F) {
78 address = value & 0x0F;
81 sram->write(address, value);
95template<
typename Archive>
98 ar.template serializeBase<MSXDevice>(*
this);
101 if (ar.versionAtLeast(version, 2)) {
103 ar.serialize(
"sram", *sram);
105 assert(Archive::IS_LOADER);
111 std::array<byte, 0x10> tmp;
113 ar.serialize_blob(
"ram", tmp);
116 sram->write(
unsigned(i),
t);
120 ar.serialize(
"address", address,
#define REGISTER_MSXDEVICE(CLASS, NAME)
const XMLElement * findChild(std::string_view name) const
int getChildDataAsInt(std::string_view name, int defaultValue) const
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
MSXMotherBoard & getMotherBoard() const
Get the mother board this device belongs to.
virtual const std::string & getName() const
Returns a human-readable name for this device.
MSXMapperIO & createMapperIO()
All memory mappers in one MSX machine share the same four (logical) memory mapper registers.
byte readSwitchedIO(word port, EmuTime::param time) override
MSXS1985(const DeviceConfig &config)
byte peekSwitchedIO(word port, EmuTime::param time) const override
void reset(EmuTime::param time) override
This method is called on reset.
void serialize(Archive &ar, unsigned version)
void writeSwitchedIO(word port, byte value, EmuTime::param time) override
constexpr auto enumerate(Iterable &&iterable)
Heavily inspired by Nathan Reed's blog post: Python-Like enumerate() In C++17 http://reedbeta....
This file implemented 3 utility functions:
uint8_t byte
8 bit unsigned integer
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)