50 sram = std::make_unique<SRAM>(
getName() +
" SRAM", 0x2000, config);
51 reset(EmuTime::dummy());
59 for (
auto i :
xrange(4, 12)) {
62 for (
auto i :
xrange(12, 16)) {
71 if ((0x6000 <= address) && (address < 0xB000)) {
72 if (!(address & 0x1000)) {
73 auto region = address >> 12;
75 sramEnabled = (value & 0x10) != 0;
80 sramOffset = (value & 0x20) ? 0x1000: 0x0000;
85 setRom(region, 2 * (value & 0x0F));
86 setRom(region + 1, 2 * (value & 0x0F) + 1);
89 }
else if ((0xB000 <= address) && (address < 0xC000)) {
92 sram->write(sramOffset | (address & 0x0FFF), value);
99 if ((0x6000 <= address) && (address < 0xB000)) {
100 if (!(address & 0x1000)) {
105 }
else if ((0xB000 <= address) && (address < 0xC000) && sramEnabled) {
113template<
typename Archive>
116 ar.template serializeBase<Rom4kBBlocks>(*
this);
117 ar.serialize(
"sramOffset", sramOffset,
118 "sramEnabled", sramEnabled);
#define REGISTER_MSXDEVICE(CLASS, NAME)
void invalidateDeviceWCache()
virtual const std::string & getName() const
Returns a human-readable name for this device.
static std::array< byte, 0x10000 > unmappedWrite
void setBank(unsigned region, const byte *adr, byte block)
Sets the memory visible for reading in a certain region.
void setUnmapped(unsigned region)
Select 'unmapped' memory for this region.
std::unique_ptr< SRAM > sram
void setRom(unsigned region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
void reset(EmuTime::param time) override
This method is called on reset.
byte * getWriteCacheLine(word address) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
RomGameMaster2(const DeviceConfig &config, Rom &&rom)
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
void serialize(Archive &ar, unsigned version)
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
constexpr auto xrange(T e)