29 sram = std::make_unique<SRAM>(
getName() +
" SRAM", size, config);
30 reset(EmuTime::dummy());
41 if ((1 << (address >> 14)) & sramEnabled) {
42 return (*
sram)[address & (
sram->size() - 1)];
50 if ((1 << (address >> 14)) & sramEnabled) {
51 return &(*sram)[address & (
sram->size() - 1)];
59 if ((0x6000 <= address) && (address < 0x7800) && !(address & 0x0800)) {
61 byte region = ((address >> 12) & 1) + 1;
64 sramEnabled |= (1 << region);
68 sramEnabled &=
byte(~(1 << region));
73 if ((1 << (address >> 14)) & sramEnabled & 0x04) {
74 sram->write(address & (
sram->size() - 1), value);
81 if ((1 << (address >> 14)) & sramEnabled & 0x04) {
89template<
typename Archive>
92 ar.template serializeBase<RomAscii16kB>(*
this);
93 ar.serialize(
"sramEnabled", sramEnabled);
#define REGISTER_MSXDEVICE(CLASS, NAME)
virtual const std::string & getName() const
Returns a human-readable name for this device.
void invalidateDeviceRWCache()
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is lo...
RomAscii16_2(const DeviceConfig &config, Rom &&rom, SubType subType)
byte * getWriteCacheLine(word address) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
void serialize(Archive &ar, unsigned version)
void reset(EmuTime::param time) override
This method is called on reset.
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.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
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.
std::unique_ptr< SRAM > sram
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
void setRom(unsigned region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
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)